Skip to content
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

Add modern labels to pods controlled by deployments etc. #3596

Merged
merged 3 commits into from
Jan 12, 2025

Conversation

samyuh
Copy link
Contributor

@samyuh samyuh commented Jan 10, 2025

Some labels are missing in the pods, such as:

    app.kubernetes.io/name: "jupyterhub"
    app.kubernetes.io/instance: "release-name"
    app.kubernetes.io/managed-by: Helm

The issue occurred because 'jupyterhub.matchLabels' was imported instead of 'jupyterhub.labels'.

Closes #3595

@samyuh samyuh changed the title fix: Change labels from 'jupyterhub.matchLabels' to 'jupyterhub.labels' fix: change labels from 'jupyterhub.matchLabels' to 'jupyterhub.labels' Jan 10, 2025
@consideRatio
Copy link
Member

Oh there were plenty of resources bugged like this - oops

@samyuh
Copy link
Contributor Author

samyuh commented Jan 10, 2025

Yup, I reviewed all of them :)

@consideRatio
Copy link
Member

consideRatio commented Jan 10, 2025

Screenshot_20250110-213931

Hmmm okay so this is the catch and why it wasnt done. We don't want to always restart pods just because we upgrade, and some labels added now will trigger a restart now no matter what - those with chart versions in them.

I think chart and heritage shouldn't be added, either old/new version of those labels

@samyuh
Copy link
Contributor Author

samyuh commented Jan 10, 2025

Yeah it makes sense. I will look into a way to have this working without having chart and heritage

@consideRatio consideRatio changed the title fix: change labels from 'jupyterhub.matchLabels' to 'jupyterhub.labels' Add modern labels to pods controlled by deployments etc. Jan 11, 2025
@consideRatio
Copy link
Member

I'll refer to legacy and modern "match labels" below, with it I mean:

  • legacy match labels: component, app, release
  • modern match labels: app.kubernetes.io/component, app.kubernetes.io/name, app.kubernetes.io/instance

Note that I don't think pods should have the old heritage label or the modern app.kubernetes.io/managed-by label, because they are actually managed by the Deployment etc, which in turn is managed by Helm. Currently they only have the legacy match labels not including heritage.

I think currently we have a need for:

  • specifying legacy match labels on spec.selector.matchLabels as we already do, which is done by including the jupyterhub.matchLabels helper.
  • specifying legacy and new match labels on spec.template.metadata.labels, where we currently just provide the legacy labels, but want to provide both legacy and modern.

I think in the future, we'll have a need for specifying just the new match labels on spec.selector.matchLabels.


With this in mind, I think practically, we should have one new helper function named for example like jupyterhub.modernMatchLabels which is added to be included next to jupyterhub.matchLabels in spec.template.metadata.labels, and in the future, we'll replace use of jupyterhub.matchLabels in spec.selector.matchLabels with jupyterhub.modernMatchLabels.

@consideRatio
Copy link
Member

@samyuh I hope I didn't cause trouble pushing a commit without a heads up - I was worried I wouldn't find time to review future work in the near future and wanted to get this resolved.

image

@consideRatio consideRatio merged commit 5ad350e into jupyterhub:main Jan 12, 2025
14 checks passed
consideRatio pushed a commit to jupyterhub/helm-chart that referenced this pull request Jan 12, 2025
@samyuh
Copy link
Contributor Author

samyuh commented Jan 12, 2025

No worries! I'm a bit tied up this weekend and haven't had a chance to work on this yet. I really appreciate your help! Thanks again for taking the time to fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modern labels not yet introduced for the pods controlled by deployments etc
2 participants