nifikop icon indicating copy to clipboard operation
nifikop copied to clipboard

Support --namespace helm arg

Open StevenBarre opened this issue 3 years ago • 3 comments

Q A
Bug fix? no
New feature? yes
API breaks? nos
Deprecations? nos
Related tickets None
License Apache 2.0

What's in this PR?

Adds support for --namespace helm argument to specify which ns to create objects in.

Why?

When installing this chart, it would be nice to be able to specify --namespace somens and have the objects put in the right namespace instead of always relying on the kube client being pointing at the correct ns.

Additional context

I don't actually know much about helm or if this is the correct way to do this.

Checklist

  • [ ] Implementation tested
  • [ ] Error handling code meets the guideline
  • [ ] User guide and development docs updated (if needed)
  • [ ] Append changelog with changes

To Do

  • [ ] Someone smarter than me should test this

StevenBarre avatar Jan 17 '22 23:01 StevenBarre

Helm will add those metadata properties for you when you specify the --namespace argument via the helm client. :)

This is also shown in the docs: https://orange-opensource.github.io/nifikop/docs/2_setup/1_getting_started#installing-with-helm

Do some resources not get created in the specified namespace?

mh013370 avatar Jan 18 '22 09:01 mh013370

Do some resources not get created in the specified namespace?

# helm template nifikop orange-incubator/nifikop \
    --version 0.7.5 \
    --set image.tag=v0.7.5-release \
    --include-crds \
    --set "namespaces={openshift-bcgov-nifi}" \
    --namespace openshift-bcgov-nifi \
    | grep 'namespace: '
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi

Only the Role and RoleBinding are getting their namespace set, even with the --namespace arg set. The Deployment, and ServiceAccount are not.

StevenBarre avatar Jan 18 '22 16:01 StevenBarre

Do some resources not get created in the specified namespace?

# helm template nifikop orange-incubator/nifikop \
    --version 0.7.5 \
    --set image.tag=v0.7.5-release \
    --include-crds \
    --set "namespaces={openshift-bcgov-nifi}" \
    --namespace openshift-bcgov-nifi \
    | grep 'namespace: '
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi

Only the Role and RoleBinding are getting their namespace set, even with the --namespace arg set. The Deployment, and ServiceAccount are not.

Do some resources not get created in the specified namespace?

# helm template nifikop orange-incubator/nifikop \
    --version 0.7.5 \
    --set image.tag=v0.7.5-release \
    --include-crds \
    --set "namespaces={openshift-bcgov-nifi}" \
    --namespace openshift-bcgov-nifi \
    | grep 'namespace: '
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi
  namespace: openshift-bcgov-nifi

Only the Role and RoleBinding are getting their namespace set, even with the --namespace arg set. The Deployment, and ServiceAccount are not.

That's interesting. One difference might be that I'm using ArgoCD to deploy nifikop (which just uses Helm) and I provide the namespace as an argument in the ArgoCD Application yaml. Perhaps ArgoCD adds a little more logic to ensure every resource is created in the specified namespace.

mh013370 avatar Jan 19 '22 09:01 mh013370