Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Use .Release.Namespace instead of .Release.Name as a prefix for cluster-scoped objects #1257

Open
jandubois opened this issue Dec 3, 2020 · 6 comments
Labels
accepted bug Something isn't working

Comments

@jandubois
Copy link
Member

Right now cf-operator.fullname prefixes the chart name with the release name and not the namespace:

https://github.com/cloudfoundry-incubator/quarks-operator/blob/master/deploy/helm/quarks/templates/_helpers.tpl#L14-L25

This is used to create names for e.g. cluster roles and cluster rolebindings. The problem is that with helm 3 the release name is no longer unique (and it wasn't with helm 2 either if you had more than one tiller instance).

So you can have a cf-operator release in both ns1 and ns2. Both will try to create a cluster role called cf-operator-quarks-cluster (among others for job, secret, and statefulset), creating a collision.

If you prefix with the namespace, the role and rolebinding will be ns1-quarks-cluster and ns2-quarks-cluster, which can be removed independently when their corresponding release is removed from ns1 or ns2.

Given that the namespace-scoped objects don't include the release name in their object names, it isn't supported to install multiple releases of the same quarks chart into the same namespace anyways, so dropping the release name from the objects should not be an issue.

The kubecf cluster-scoped objects have the same problem, but I thought I would raise it here first.

@jandubois jandubois added the bug Something isn't working label Dec 3, 2020
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/175984792

The labels on this github issue will be updated when the story is started.

@mudler
Copy link
Member

mudler commented Dec 4, 2020

Makes perfectly sense, and this I think got mostly unnoticed since we added multi-ns support for a single operator install

@manno
Copy link
Member

manno commented Dec 7, 2020

I don't think we have any explicit tests for installing multiple operators in a single cluster. The e2e tests on the flintstone Concourse could have catched this, but they are red.
This shouldn't create any problems when updating the operator, right?

@jandubois
Copy link
Member Author

This shouldn't create any problems when updating the operator, right?

I don't think so; during update the roles and rolebindings with the old names should get deleted, and the new ones should get created. But I've obviously not actually tested it...

@manno
Copy link
Member

manno commented Dec 9, 2020

If we want to allow multipe operators per namespace, we could use 'monitoredID' to prefix all cluster resources. We'd also have to prefix all the release namespace resources, right now I think only webhook is missing.

However, if we decide not to support multiple per namespace, we can drop the prefixes and just prefix cluster resources with the Release.Namespace as suggested.

In any case you should be able to use Values.fullnameOverride to work around the helm chart issue.
It's not a straight forward fix, since the operator update test relies on the default name and we probably have to do it for all helm charts.

@jandubois
Copy link
Member Author

If we want to allow multipe operators per namespace

Does this make sense? In general helm charts don't really support installing the same chart multiple times into the same namespace because things like services and statefulset have fixed names. Namespace are already the mechanism to avoid name collisions, so why invent another mechanism to create essentially nested namespaces?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants