-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved global repos to their own namespace and outside the kubeapps one #3990
Conversation
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
PinnipedProxyURL string | ||
Clusters map[string]ClusterConfig | ||
KubeappsClusterName string | ||
GlobalReposNamespace string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best place to add the global repos namespace...otherwise we might need to extend the register RPC method signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's fine for now.
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@@ -76,6 +76,7 @@ spec: | |||
{{- end }} | |||
- --repo-sync-cmd=/asset-syncer | |||
- --namespace={{ .Release.Namespace }} | |||
- --global-repos-namespace={{ .Release.Namespace }}-{{ .Values.apprepository.globalReposNamespaceSuffix }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preferred to add a proper flag instead of passing the value through env variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+100.
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: "{{ .Release.Namespace }}-{{ .Values.apprepository.globalReposNamespaceSuffix }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creates the global repos namespace
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long PR,
Heh - at +161 −91
this isn't a long PR, the focused change just touches a lot of files :) Start to worry about that if it's over +400 (IMO).
but in order to have the feature working it is all or nothing smile
Hmm, I'm not sure this is the case... in particular, have you checked how this code handles upgrading an existing deployment, where there are existing global repos? Won't they disappear with this change (anything other than the default bitnami repo, that is). I think it'd be easy to update so this is a non-breaking change by. See what you think (more context inline).
@@ -7,7 +7,7 @@ metadata: | |||
{{- if .namespace }} | |||
namespace: {{ .namespace | quote }} | |||
{{- else }} | |||
namespace: {{ $.Release.Namespace | quote }} | |||
namespace: {{ printf "%s-%s" $.Release.Namespace $.Values.apprepository.globalReposNamespaceSuffix | quote }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding making this a non-breaking change, could we instead do:
namespace: {{ printf "%s-%s" $.Release.Namespace $.Values.apprepository.globalReposNamespaceSuffix | quote }} | |
namespace: {{ printf "%s%s" $.Release.Namespace $.Values.apprepository.globalReposNamespaceSuffix | quote }} |
so that if globalReposNamespaceSuffix
is empty (which can be the default, initially), we will have the existing behavior? We can then update the default value to -repos-global
when we do a major version change, breaking the backwards compatibility?
It'd require a conditional around the namespace creation later too, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion Michael, it makes sense. So, defaulting now to the same kubeapps
namespace, would mean leaving without effect the purpose of this change until next major version 3.x?
As-is in a Kubeapps upgrade scenario, new global repos will go to the new ns and old global repos will stay in the kubeapps
ns, just not being considered global anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion Michael, it makes sense. So, defaulting now to the same
kubeapps
namespace, would mean leaving without effect the purpose of this change until next major version 3.x?
By default, yes, but we can verify it works as expected, even update CI to use it (by setting a value for the suffix) if we want, to ensure that switching the default later is a non-event (other than the instructions for users).
As-is in a Kubeapps upgrade scenario, new global repos will go to the new ns and old global repos will stay in the
kubeapps
ns, just not being considered global anymore.
Yep, we'll just ensure we document that in the release notes so people can move their repos as needed.
@@ -76,6 +76,7 @@ spec: | |||
{{- end }} | |||
- --repo-sync-cmd=/asset-syncer | |||
- --namespace={{ .Release.Namespace }} | |||
- --global-repos-namespace={{ .Release.Namespace }}-{{ .Values.apprepository.globalReposNamespaceSuffix }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+100.
PinnipedProxyURL string | ||
Clusters map[string]ClusterConfig | ||
KubeappsClusterName string | ||
GlobalReposNamespace string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's fine for now.
I don't remember from the top of my head if I tested that scenario before Christmas 😅 , will give it a try. We are talking about:
Old global repos will stay in |
Yeah - in particular, does that affect existing installations (ie. if I'd installed apache in |
chart/kubeapps/values.yaml
Outdated
@@ -719,6 +719,9 @@ apprepository: | |||
## - myRegistryKeySecretName | |||
## | |||
pullSecrets: [] | |||
## @param apprepository.globalReposNamespaceSuffix Suffix for the namespace of global repos | |||
## | |||
globalReposNamespaceSuffix: repos-global |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the rest of the comments in that the suffix should also include the -
to prevent backward-incompatible changes.
Also, in order to stick close to similar names within our organization, why not go with a similar suffix as Carvel people does: -packaging-global
? (source: carvel-dev/kapp-controller@d199158)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find using the word repos
more intuitive 😄
Is there any accepted terminology for this?
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@absoludity I tested the scenario of updating Kubeapps to the new global repos ns, and as expected:
By now we are safe as we are defaulting to |
Excellent, thanks for testing Rafa.
Great, yes, at the very least, instructions in the release notes when the default changes. +1, thanks! |
Description of the change
Sorry for the long PR, but in order to have the feature working it is all or nothing 😄
This PR moves the global repos from the Kubeapps namespace to its own namespace.
Based on the problem stated by @dlaloue-vmware and the discussion in #3680, this allows to give read access to users to the global repos namespace, and therefore not having to grant them with access to the kubeapps namespace.
Changes are done e.g. to Helm templates,
repositories-controller
,asset-syncer
andkubeapps-apis
, so it is large change, but basically it is adding the global namespace parameter and substituting the kubeapps namespace where needed.No changes done to the double secrets kept for non-global repos.
Modifications in Kubeops are done for compatibility reasons.
Benefits
Global repos can be placed into their own namespace, and therefore better RBAC can be applied separated from the kubeapps namespace. Hopefully this helps somehow to implement #1647.
Possible drawbacks
Assets syncing should not be affected, but we could keep an eye on it.
Applicable issues