-
Notifications
You must be signed in to change notification settings - Fork 802
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
Labels and Selectors - a common practice within the templates #538
Comments
https://github.com/kubernetes/helm/blob/master/docs/chart_best_practices/labels.md is where I took my cues from, and I think we should stick to it. Note that I didn't see that page until after a few releases, so it isn't consistently applied. I'm happy for us to standardize this! I think we should include all the 5 ones that helm recommends in all our components. There's nothing wrong with changing them, but I think sticking to the standards helps other tooling / people who are used to helm charts to identify / write additional scripts that deal with z2jh. |
Ah! What about label selection in a |
@consideRatio good question! I wonder what the charts in github.com/kubernetes/charts do. We should probably follow whatever it is they do... |
Hello. I like the fact that every names are prepended with the release name, so that two helm deployment can be done on the same namespace without conflict. Do you think it can be feasible for Zero-to-Jupyterhub?
And all name metadata are prepended with this:
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ template "jupyterhub.fullname" . }}-hub-config"
data:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "jupyterhub.fullname" . }}-hub
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "jupyterhub.fullname" . }}-hub-db-dir And so on. This is not really documented in the Helm Best Practice, but we see more and more in the official charts (ex: stable/influxdb) |
@gsemet while it's not impossible for two hubs in one namespace to work, I think it's probably good practice to always deploy only one jupyterhub per namespace. Namespaces are a very low-cost entity, and it makes it very easy to be sure what belongs together. There's one case where we have |
I understand, however I do not have this option on our environment (baremetal with team that is ramping up on this subject) :( |
@minrk the @gsemet thanks for insights into this! For that reason it makes sense to me to add a release to the name. I will probably clutter output from I conclude that I don't understand enough about namespaces to be confident enough on a stance for or against including release in the kubernetes objects' names or not. RelatedWhat is a release? The helm documentation. Update 1I realize that if we are using labels like this, and selectors like that below, we allow for multiple releases, but not really because there is a name conflict anyhow without @gsemet's suggestion. So I figure we should not include the release name in the selection if we do not add the release name as part of the name as well. The labels we declare
The important labels within a selector
Ping @yuvipanda - got further input? I'm hoping to get actionable enough in order to make a PR making the k8s objects' labels and label selectors systematic throughout z2jh. Update 2Regarding chart names and replacing of + with _. |
I'll make a PR focusing on the labels and selectors Included in PRI'll let the name field (not a label) be as it is Potential future PRIf we decide on updating the name to include the helm release name, we should also select based on the release label. |
@consideRatio that sounds great! |
@minrk got any ideas on the chart label? ingress.yaml is deviating from the others for some reason I fail to find, but I recall reading something about this, perhaps it was in the gitter chat.
Should I make all chart labels replace +, only the ingress.yaml one, or none? |
sounds great! I must admit I do not have the full experience of helm yet to tell if it is better to use 1 namespace per app vs several app per namespace. There are a tons of internal talks in our team here.
Also, when I look at the tons of official helm charts that provide this release prefix (throught a template), to app, selectors, pod names, etc, I simply want to the same. So, I just would like to recommend to use _helpers.tpl trick to automatize this template that could render the code highly difficult to maintain (see this example for instance) |
@gsemet The bigger problem with multiple hubs in a namespace is that kubespawner doesn't support that atm - it assumes it 'owns' the namespace. We need to fix that first IMO. Changing the names might also have backwards compatibility issues, primarily around renaming the hub PVC. So we should do that carefully and IMO make a point release specifically for it. |
@consideRatio I think that .replace exists simply from copy pasting from kubernetes/charts :) I think including it is a good option! |
I know that helm support hooks that may be used (I guess) to handle smooth transition, maybe it can do the pod rename... never tried it myself sadly |
@yuvipanda according to helm's best practices one should use the replace + with _. Still not confident why. I also found about 1/4 of all the kubernetes/charts to do that. I'll make sure to follow the Helm best practices. @gsemet regarding the name field, it seems almost all charts in kubernetes/charts is naming their objects similarly to how you suggest! I'm creating an issue for further discussion about implementing helm-release dependent naming. |
i guess restriction related to chart templating has something to do with DNS, when one use systems such as calico or other advanced networking environment. |
Closed by #625 |
Related issue: #615
I was about to make set labels and selectors for a StatefulSet I tried out, and wanted to mimic what had been done for other k8s object templates, but did not find a clear pattern.
So, I'd like to figure out a practice to follow within the guide.
I'd like to discuss the following labels:
My take
chart
label, or is there a benefit to including that?Perhaps something like below?
The labels we declare on controllers
The important labels within a selector and a controllers pod template
The text was updated successfully, but these errors were encountered: