@@ -945,18 +945,6 @@ To make a HelmRelease react immediately to changes in the referenced Secret
945945or ConfigMap see [this](#reacting-immediately-to-configuration-dependencies)
946946section.
947947
948- When both `.spec.kubeConfig` and
949- [`.spec.serviceAccountName`](#service-account-reference) are specified,
950- the controller will impersonate the ServiceAccount on the target cluster,
951- i.e. a ServiceAccount with name `.spec.serviceAccountName` must exist in
952- the target cluster inside a namespace with the same name as the namespace
953- of the HelmRelease. For example, if the HelmRelease is in the namespace
954- ` apps` of the cluster where Flux is running, then the ServiceAccount
955- must be in the `apps` namespace of the target remote cluster, and have the
956- name `.spec.serviceAccountName`. In other words, the namespace of the
957- HelmRelease must exist both in the cluster where Flux is running
958- and in the target remote cluster where Flux will apply resources.
959-
960948The Helm storage is stored on the remote cluster in a namespace that equals to
961949the namespace of the HelmRelease, or the [configured storage namespace](#storage-namespace).
962950The release itself is made in a namespace that equals to the namespace of the
@@ -965,6 +953,35 @@ namespaces are expected to exist, with the exception that the target namespace
965953can be created on demand by Helm when namespace creation is [configured during
966954install](#install-configuration).
967955
956+ When both `.spec.kubeConfig` and
957+ [`.spec.serviceAccountName`](#service-account-reference) are specified,
958+ the controller will impersonate the ServiceAccount on the target cluster.
959+ The ServiceAccount must have the necessary RBAC permissions to perform
960+ the operations associated with the HelmRelease. This includes permissions
961+ on both the target and storage namespaces.
962+
963+ Example of RoleBinding on the target cluster granting *namespaced* `admin` :
964+
965+ ` ` ` yaml
966+ apiVersion: rbac.authorization.k8s.io/v1
967+ kind: RoleBinding
968+ metadata:
969+ name: apps-sa-binding
970+ namespace: apps # This namespace SHOULD be the target/storage namespace on the target cluster.
971+ roleRef:
972+ apiGroup: rbac.authorization.k8s.io
973+ kind: ClusterRole
974+ name: admin
975+ subjects:
976+ - apiGroup: rbac.authorization.k8s.io
977+ kind: ServiceAccount
978+ name: apps-sa
979+ namespace: apps # This namespace MUST match the HelmRelease namespace on the source cluster.
980+ ` ` `
981+
982+ If the target and storage namespaces are different, the RoleBinding
983+ above must be created in both namespaces.
984+
968985Other references to Kubernetes resources in the HelmRelease, like
969986[values references](#values-references), are expected to exist on
970987the cluster where Flux is running.
0 commit comments