Skip to content

[RFC-0010] Full multi-tenancy lockdown support #5465

@matheuscscp

Description

@matheuscscp

Part of: #5022

In multi-tenant clusters, users normally set the optional controller flag --default-service-account in kustomize-controller and helm-controller. This dictates that any Flux Kustomization and HelmRelease objects must either specify the field .spec.serviceAccountName or use the value of --default-service-account as the name of the ServiceAccount in the same namespace of the object that needs to be impersonated for the reconciliation.

After RFC-0010, Flux now supports .spec.serviceAccountName for most APIs and also .spec.decryption.serviceAccountName for Kustomization. For KubeConfig Workload Identity in the Kustomization and HelmRelease APIs, the ConfigMap pointed at by .spec.kubeConfig.configMapRef may specify the field .data.serviceAccountName. This creates three classes of ServiceAccount name fields that need to be locked down on multi-tenant clusters:

  • --default-service-account must be implemented across all Flux controllers, for enforcing multi-tenancy lockdown over .spec.serviceAccountName fields. Only kustomize-controller and helm-controller currently implement this flag.
  • --default-decryption-service-account must be implemented in kustomize-controller, for enforcing multi-tenancy lockdown over the .spec.decryption.serviceAccountName field of the Kustomization API.
  • --default-kubeconfig-service-account must be implemented in both kustomize-controller and helm-controller, for enforcing multi-tenancy lockdown over the .data.serviceAccountName field in ConfigMaps pointed at by the .spec.kubeConfig.configMapRef field present in the Kustomization and HelmRelease APIs.

For the implementation we must define three constants in the auth package, one for each controller flag. The file can be controller_flags.go (we should rename feature_gate.go to feature_gates.go). The main.go of each controller must import and use the relevant constants accordingly.

Metadata

Metadata

Assignees

Labels

area/securitySecurity related issues and pull requestsenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions