Repository navigation
fix(otel): give the CI Karpenter node the EKS cluster security group and fail the validator when any suite fails - #804
Open
petruanica wants to merge 1 commit into
Open
petruanica wants to merge 1 commit into
petruanica wants to merge 1 commit into
Conversation
…and fail the validator when any suite fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue
The
eks_daemon:otel_standard_testjob has two problems interraform/eks/daemon/otel/main.tf.First, the Karpenter node sends no node-agent metrics. The
EC2NodeClassselects the security group by thekarpenter.sh/discoverytag. The job puts this tag on the shared VPC security group. The managed nodes have only the EKS cluster security group, and that group accepts traffic only from its own members. The Karpenter node therefore cannot reach the managed nodes. The node agent uses host networking with theClusterFirstWithHostNetDNS policy, and CoreDNS runs on the managed nodes. On the Karpenter node, the agent cannot resolve the CloudWatch endpoint and exports nothing. Its readiness probe is local, so the pod stays Ready. As a result,TestKarpenterInstanceLabelsRemovedandTestKarpenterGroupingLabelsRetainedfail for every node-agent metric. The kube-state-metrics subtests pass, because the cluster scraper runs on a managed node.The shared tag also has a second problem. Parallel CI jobs tag the one shared security group, each with its own cluster name. So the last job to apply wins, and the destroy of one job removes the tag for the others. The subnet tags keep this problem, and a follow-up handles them.
Second, the job hides suite failures. The
null_resource.validatorstep runs three suites in onelocal-execcommand:test/otel/standard,test/otel/solutions/karpenterandtest/otel/solutions/keda. The command returns the exit status of its last command, which is the KEDAgo test. When the standard suite or the Karpenter suite fails, the job still reports success. For example, on main the standard suite printsFAIL github.com/aws/amazon-cloudwatch-agent-test/test/otel/standardfor the two Karpenter tests above, and the job is green.Description of changes
EC2NodeClassselects the EKS cluster security group by ID:- id: "${aws_eks_cluster.this.vpc_config[0].cluster_security_group_id}". The Karpenter node then has the same security group as the managed nodes. Theaws_ec2_tag.sg_karpenterresource is deleted, because nothing reads that tag anymore. The subnet selector and itskarpenter.sh/discoverysubnet tags do not change.rc=0, appends|| rc=1to each of the threego testcommands and ends withexit $rc. All three suites still run. If any of them fails, the step fails. The command uses POSIX shell only, becauselocal-execruns it with/bin/sh. The sleeps and the test flags do not change.The two changes are in one PR. Without the security group change, the validator change turns the job red for the two Karpenter tests.
Customer-visible. None. This change affects only the CI terraform of the EKS OTel daemon tests.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
terraform fmt -check -recursive terraform/eks/daemon/otelandmake check-fmtinterraform/pass.terraform init -backend=falseandterraform validatepass interraform/eks/daemon/otel.karpenter_nodepoolcommand, rendered withterraform console, passessh -n, and its two YAML documents parse. TheEC2NodeClasshassecurityGroupSelectorTerms: [{id: <cluster security group ID>}]and the unchanged subnet selector.terraform console, passessh -n. It ran with stubgoandsleepcommands. With no failing suite, it exits 0. With the standard suite, the Karpenter suite, the KEDA suite, or the standard and KEDA suites failing, it exits 1. In each case, all threego testcommands run. When the standard suite fails, the command on main exits 0.make compilepasses../test/otel/standardon this commit: theeks_daemon:otel_standard_testjob passes.TestKarpenterInstanceLabelsRemovedandTestKarpenterGroupingLabelsRetainedpass, with all 22 subtests each, including the 18 node-agent metrics. The standard, Karpenter and KEDA suites printok, and no test fails.PR Checklist
makepasses locally (build, unit tests, lint):make compileand the terraform format check pass. This PR changes no Go code../test/otel/standardis under Tests.test/otel/standardcover it.test/otel/standardfail on main and pass with this change. The stub run under Tests reproduces the green job with a failing suite.