Skip to content

Add automountServiceAccountToken to the pod options - #911

Open
shaynhornik wants to merge 1 commit into
apache:mainfrom
shaynhornik:feat/automount-service-account-token
Open

shaynhornik wants to merge 1 commit into
apache:mainfrom
shaynhornik:feat/automount-service-account-token

Conversation

@shaynhornik

Copy link
Copy Markdown

Summary

Fixes #701.

Adds an optional automountServiceAccountToken to the pod options of SolrCloud (customSolrKubeOptions.podOptions) and SolrPrometheusExporter (customKubeOptions.podOptions). It is passed to the pod spec of the StatefulSet and the Deployment, so the Service Account token can be kept out of the pods, which is what the AKS / Azure Defender finding in the issue asks for.

  • Unset (the default): the field is left out of the pod spec, as today. Kubernetes does not default it on pod templates, so there is no update loop.
  • Set: CopyPodTemplates copies it, so setting, changing or removing it reaches an existing StatefulSet or Deployment.
  • Does anything need the token? I checked the Solr container, the setup-zk and TLS init containers, the backup code and the exporter, and found nothing that uses the Kubernetes API or the mounted token. The field comment and docs only warn about the user's own sidecar and init containers.
  • Zookeeper pods are not covered. The issue asks for them too, but PodPolicy in zookeeper-operator v0.2.15 has no such option. The docs say so and point to the Service Account setting instead.

Also included: regenerated CRDs and deepcopy, a "Service Account Token" section in custom-kube-options.adoc, the solr Helm chart (podOptions.automountServiceAccountToken, rendered for false as well as true, README row) and changelog entries in both charts.

Test plan

  • Controller tests (envtest): the field is absent by default and false when set, on the SolrCloud StatefulSet and the exporter Deployment; a new context sets and then removes it on an existing StatefulSet. With the controllers/util changes reverted, 3 specs fail.
  • go test ./controllers -v: 88 of 88 specs pass. go test ./api/... ./controllers/util/... passes.
  • make manifests generate, check-format, check-manifests, check-generated, vet, check-docs and ./hack/check_license.sh pass.
  • helm lint and helm template on helm/solr: unset renders nothing; false and true render. ah lint passes.
  • Not run: the e2e/kind tests.

Generated-by: Claude Code (Claude Fable 5.2). I reviewed and tested the change.

🤖 Generated with Claude Code

SolrCloud and SolrPrometheusExporter pod options get an optional
automountServiceAccountToken, which is passed on to the pod spec of the
StatefulSet and the Deployment. When it is not set the field is left out
of the pod spec, as before. Solr, the Prometheus Exporter and the
containers the operator creates do not use the Kubernetes API, so the
docs only warn about user-provided sidecar and init containers. The
ZookeeperCluster CRD of the Zookeeper Operator has no such option, so
provided Zookeeper pods are not covered.

Generated-by: Claude Code (Claude Fable 5.2)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

adding automountServiceAccountToken

1 participant