Skip to content

Not creating new namespace with impersonation ServiceAccount even though it has proper role. #338

Description

@hongkunyoo

Hello, I really enjoy using helm-controller because of its great concept.

However, I'm not sure whether I'm wrong or there is a bug, I have experienced unexpected behavior.

If I do not use impersonation (without serviceAccount property in HelmRelease) creating new namespace with createNamespace: true and targetNamespace works fine.

However, If I use impersonation(using specific ServiceAccount), helm-controller does not create new namespace for me.
Of course I've check that the ServiceAccount I'm impersonating has a proper ClusterRole.

Is this behavior on purpose or did I do something wrong? otherwise is it a bug?

This is my settings:

Kubernetes

kubectl version 
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.7", GitCommit:"be3d344ed06bff7a4fc60656200a93c74f31f9a4", GitTreeState:"clean", BuildDate:"2020-02-11T19:34:02Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.7", GitCommit:"be3d344ed06bff7a4fc60656200a93c74f31f9a4", GitTreeState:"clean", BuildDate:"2020-02-11T19:24:46Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}

flux-system: v0.13.4

Manifest:

  • HelmRepository:
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
  name: bitnami
  namespace: flux-system
spec:
  interval: 30m0s
  timeout: 1m0s
  url: https://charts.bitnami.com/bitnami
  • HelmRelease:
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: hr-test
  namespace: default
spec:
  chart:
    spec:
      chart: nginx
      interval: 1m0s
      sourceRef:
        kind: HelmRepository
        name: bitnami
        namespace: flux-system
      version: 9.5.8
  interval: 5m0s
  targetNamespace: new-ns
  serviceAccountName: default    # <-- HERE: if I add this property, it does not create new Namespace.
  install:
    createNamespace: true
    disableWait: true
  values:
    podLabels:
      plz: work
  • ClusterRole, RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ns-create-role
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: ns-create-rb
  namespace: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ns-create-role
subjects:
- kind: ServiceAccount
  name: default
  namespace: default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions