Added AutoMountServiceAccountToken Volume and VolumeMount #46
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
This PR introduces changes to the AppDynamics Operator pod spec to handle Kubernetes’ automountServiceAccountToken (AMT) security requirement.
By default, Kubernetes automatically mounts the ServiceAccount token into pods through automountServiceAccountToken: true. However, some security scanners and compliance tools flag this as a violation, because pods should not have an auto-mounted token unless explicitly required.
To resolve this, we make the token mounting explicit and controlled:
Added the automountServiceAccountToken field to the operator pod definition (default true in values.yaml, but can be overridden).
Introduced manual volumes and volumeMounts for the ServiceAccount token, CA certificate, and namespace data, ensuring that the operator can still communicate with the Kubernetes API even when automountServiceAccountToken: false.
Technical Details
automountServiceAccountTokentovalues.yamlunderoperatorPod(default:true).volumeMountsandvolumesconfiguration tovalues.yamlfor manual mounting..Values.operatorPod.automountServiceAccountTokenis set tofalse, the operator pod will not auto-mount the token.kube-api-accessvolume is defined and mounted manually:Why This Change?
Problem: If we disable
automountServiceAccountToken, pods fail because they cannot authenticate to the Kubernetes API.Solution: Provide explicit
volumesandvolumeMountsthat replicate the default mount behavior. This ensures the operator continues functioning while resolving security/compliance violations.Benefits