UNCLASSIFIED - NO CUI

Harden ServiceAccount tokens, honor defender clusterName, fix upgrade-job labels, run the unit-test job

Summary

The chart's ServiceAccounts auto-mount API tokens with no way to disable it, the defenderOnly DaemonSet discards the required defender.clusterName, the volume upgrade job renders duplicate label keys that fail the strict post-renderer on upgrade, and the helm-unittest job never runs because the suites are in a directory the pipeline does not scan.

Details

  1. ServiceAccount tokens. The console, init, and defender-only ServiceAccount templates expose no automountServiceAccountToken knob, so every twistlock SA auto-mounts a token. Enabling the kyverno disallow-auto-mount-service-account-token policy (CIS Kubernetes Benchmark 5.1.6) flags every one of them, and consumers currently patch the rendered SAs with post-renderers to comply. The console SA needs no token at all; the init and defender SAs need one but can take it from an explicit projected volume instead of auto-mount.

  2. Defender cluster name. The defender-only DaemonSet hardcodes DEFENDER_CLUSTER_NAME_RESOLVING_METHOD: default while requiring defender.clusterName. The defender only honors the supplied name when the method is manual, so the value is discarded and the defender logs "resolving method is not manual, ignoring cluster name" on every start.

  3. Volume upgrade job labels. init/volume-upgrade-job.yaml appends explicit name and app.kubernetes.io/name labels after a helper that already sets those keys, producing duplicate mapping keys. Helm tolerates them, but BigBang's strict post-renderer rejects them ("mapping key name already defined"). The job renders only on upgrade (.Release.IsUpgrade), so clean install passes and the upgrade jobs fail.

  4. Unit-test discovery. The BB package pipeline globs chart/unittests/**/*_test.yaml and gates the job on that directory existing, but the suites live in chart/tests/, so the helm-unittest job runs nothing.

Proposed

  • Add automountServiceAccountToken values on the console, init, and defender ServiceAccounts (default false). Give the init Job and defender (both the Helm DaemonSet and the API-returned DaemonSet applied by the init script) an explicit projected token volume at the standard path; leave pod-level automount unset.
  • Set the defender-only resolving method to manual so defender.clusterName is honored.
  • Dedupe the volume upgrade job labels so each key renders once with its intended value.
  • Move the helm-unittest suites to chart/unittests/ so the job runs.
Edited by Carl Lawson