Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add AWS Fault Injection Service test for varying degrees of zonal failures #7838

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rschalo
Copy link
Contributor

@rschalo rschalo commented Mar 4, 2025

Fixes #N/A

Description
Utilizes the AWS Fault Injection Service to test and observe Karpenter's behavior during zonal outages. This should serve as the scaffolding for future Fault Injection Service tests and can be expanded to included specific APIs (list of supported actions here).

The most challenging part of adding a test is getting the permissions correctly configured. There are managed policies here but actions may still fail. Double check CloudTrail if errors are encountered.

How was this change tested?
make e2etest

Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: #
  • No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rschalo rschalo requested a review from a team as a code owner March 4, 2025 18:43
@rschalo rschalo requested a review from danxwang22 March 4, 2025 18:43
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for karpenter-docs-prod canceled.

Name Link
🔨 Latest commit a529871
🔍 Latest deploy log https://app.netlify.com/sites/karpenter-docs-prod/deploys/67c74d7f274a3c000871a3c1

env.CleanupObjects(common.CleanableObjects...)
env.EventuallyExpectNoLeakedKubeNodeLease()
env.ConsistentlyExpectNodeCount(">=", 0, time.Second*5)
env.ExpectActiveKarpenterPod()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just check for an active Karpenter pod because a network failure in these tests can cause a crash/restart due to the underlying node failing its kubelet heartbeat.

@coveralls
Copy link

coveralls commented Mar 4, 2025

Pull Request Test Coverage Report for Build 13660927806

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 67.131%

Totals Coverage Status
Change from base Build 13645882462: 0.0%
Covered Lines: 6746
Relevant Lines: 10049

💛 - Coveralls

)
})

func createExperimentTemplate(ctx context.Context, env *awsenv.Environment, targetAZ string, instances []ec2types.Instance, failurePercentage string) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating the experiments and roles in the github actions? We can keep these resources as part of the cluster setup. This will make it easier to manage these resources with the existing scripts for cleanup and monitoring

ResourceType: aws.String("aws:ec2:instance"),
SelectionMode: aws.String("ALL"),
ResourceArns: lo.Map(targetInstances, func(id string, _ int) string {
return fmt.Sprintf("arn:aws:ec2:%s:%s:instance/%s", env.Region, env.ExpectAccountID(), id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use tags instead of ids? This way we can have one experiment for many instances. This will also make it less leak the experiments


func setupRoles(env *awsenv.Environment) {
// First, check if the FIS service-linked role exists
serviceRoleName := "AWSServiceRoleForFIS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just set up all the necessary role in the GH actions as part of cluster creation?

})
}

func getSubnetsInAZ(ctx context.Context, env *awsenv.Environment, targetAZ string) []string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you tink about making this an env expectation?

subnetARNs := getSubnetsInAZ(ctx, env, targetAZ)
By(fmt.Sprintf("Found %d subnets in AZ %s", len(subnetARNs), targetAZ))

template := &fis.CreateExperimentTemplateInput{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding the experiment resource to our resource monitoring dashboard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants