feat: Support pod-level standard fields on all managed CRs - #410
Draft
miconeilaws wants to merge 1 commit into
Draft
feat: Support pod-level standard fields on all managed CRs#410miconeilaws wants to merge 1 commit into
miconeilaws wants to merge 1 commit into
Conversation
Adds these standard EKS addon configuration fields to the operator CRs
so the amazon-cloudwatch-observability Helm chart / EKS addon can wire
them through:
AmazonCloudWatchAgent:
* Adds Spec.PodLabels (merged into managed workload pod template
labels; operator-reserved selector labels cannot be overridden).
* Applies Spec.TopologySpreadConstraints to DaemonSet mode (previously
only Deployment and StatefulSet honored it).
DcgmExporter:
* Adds Spec.PodAnnotations, PodLabels, TopologySpreadConstraints,
PriorityClassName, and PodDisruptionBudget.
* Reconciles a policy/v1 PodDisruptionBudget when the field is set.
NeuronMonitor:
* Same additions as DcgmExporter.
The PodDisruptionBudgetSpec type from AmazonCloudWatchAgent is reused
for the exporter CRs.
Tests: adds unit tests for PDB creation and DaemonSet pod field
propagation for DcgmExporter and NeuronMonitor, plus PodLabels /
TopologySpreadConstraints tests for AmazonCloudWatchAgent.
Note: CRD YAMLs under config/crd/bases/ still need to be regenerated
with 'make generate && make manifests' in an environment with public
Go module network access. This commit does not include the regenerated
CRD/deep-copy diff for those artifacts; only the source of truth (Go
types) and hand-updated deep-copy stubs are included.
This was referenced Sep 2, 2026
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.
Summary
Adds the standard EKS addon pod-level configuration fields to the operator-managed CRs so that the
amazon-cloudwatch-observabilityHelm chart / EKS addon can wire them all the way through to the underlying pods. Required by the EKS addon build standards taking effect end of Q3 2026.Companion Helm chart change: aws-observability/helm-charts#364
Changes
API (source of truth — Go types)
AmazonCloudWatchAgent(apis/v1alpha1/amazoncloudwatchagent_types.go)Spec.PodLabels(map[string]string). Merged into managed workload pod template labels; operator-reserved selector labels are preserved.DcgmExporter(apis/v1alpha1/dcgmexpoter_types.go) andNeuronMonitor(apis/v1alpha1/neuronmonitor_types.go)Spec.PodAnnotations,Spec.PodLabels,Spec.TopologySpreadConstraints,Spec.PriorityClassName, andSpec.PodDisruptionBudget. Reuses the existingPodDisruptionBudgetSpectype from the CWA API.Reconcile logic
AmazonCloudWatchAgent:internal/manifests/collector/annotations.go— newPodLabels(instance, base)helper.internal/manifests/collector/{daemonset,deployment,statefulset}.go— pod templatemetadata.labelsnow composed viaPodLabels()soSpec.PodLabelsis applied while operator-managed selector labels (app.kubernetes.io/*) still win.daemonset.gonow appliesSpec.TopologySpreadConstraints. Previously the field existed in the schema but was silently dropped for DaemonSet mode (Deployment and StatefulSet already honored it).DcgmExporter/NeuronMonitor:annotations.go— newPodAnnotations()andPodLabels()helpers, mirroring the CWA collector helpers (metadata-annotation inheritance + config sha256 preservation).daemonset.go— pod template now setsLabelsviaPodLabels(),AnnotationsviaPodAnnotations(), and pod spec now propagatesPriorityClassNameandTopologySpreadConstraints.poddisruptionbudget.gobuilds apolicy/v1PodDisruptionBudgetwhenSpec.PodDisruptionBudgetis set (returnsnilotherwise, matching the collector behavior).{dcgmexporter,neuronmonitor}.go—PodDisruptionBudgetadded to the factory list inBuild().Deep-copy
apis/v1alpha1/zz_generated.deepcopy.go— deep-copy blocks added for all new fields, matching controller-gen output patterns (nil-check + explicit copy for maps, slices withDeepCopyInto, and pointer toPodDisruptionBudgetSpec).Tests
internal/manifests/collector/daemonset_test.go—TestDaemonsetPodLabels,TestDaemonsetPodLabelsCannotOverrideSelectorLabels,TestDaemonsetTopologySpreadConstraints.//go:build ignore_testconstraint (not introduced by this PR) that keeps its contents out of the default test binary. Recommend removing that constraint in a follow-up.internal/manifests/dcgmexporter/daemonset_test.go— new file, four tests coveringPodLabels,PodAnnotations,TopologySpreadConstraints,PriorityClassNamepropagation.internal/manifests/dcgmexporter/poddisruptionbudget_test.go— new file, three tests (nil-skip,MinAvailableint,MaxUnavailablepercent).internal/manifests/neuronmonitor/{daemonset,poddisruptionbudget}_test.go— parallel to DCGM.Not included — needs a maintainer with public Go module network access
The following require running
make generate && make manifestsfrom a machine that can reachproxy.golang.org(the environment where this PR was authored has that endpoint blocked):config/crd/bases/{amazoncloudwatchagents,dcgmexporters,neuronmonitors}.yamlneed the new fields added. Without this, the API server will reject CRs that set the new fields.bundle/,docs/api.md,config/may need regen.make ensure-generate-is-noopwill flag this.I hand-updated
apis/v1alpha1/zz_generated.deepcopy.gobecause those blocks are mechanical and reviewable — but the CRD YAMLs are large and better regenerated authoritatively. Happy to push a follow-up commit with the regen output if a maintainer runsmake generate manifestsand shares the diff, or run it myself once we have network access sorted.Companion Helm chart PR
aws-observability/helm-charts#364 — introduces top-level
podLabels,podAnnotations,topologySpreadConstraints,priorityClassName, andpodDisruptionBudgetvalues wired into the operator CRs. Once this operator PR merges and a new operator image ships, the Helm chart PR's "known limitations" section (podLabels on CWA; all 5 fields on DcgmExporter / NeuronMonitor) can be dropped and the CR templates can pass those fields through.