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 version labels to deployments managed by controllers #13176

Merged

Conversation

SimonTheLeg
Copy link
Member

What this PR does / why we need it:
Adds the version label to all deployments and pods that are owned by our controllers. This is required for a different task which needs this label to be in place to determine the currently deployed version of a component.

What type of PR is this?

/kind cleanup

Special notes for your reviewer:

Does this PR introduce a user-facing change? Then add your Release Note here:

NONE

Documentation:

NONE

Signed-off-by: Simon Bein <simontheleg@gmail.com>
@kubermatic-bot kubermatic-bot added release-note-none Denotes a PR that doesn't merit a release note. docs/none Denotes a PR that doesn't need documentation (changes). kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. do-not-merge/code-freeze Indicates that a PR should not merge because it has not been approved for code freeze yet. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 13, 2024
@embik
Copy link
Member

embik commented Mar 13, 2024

I know what this is towards to, why aren't we "just" checking the container image in the Deployment?

@SimonTheLeg
Copy link
Member Author

So my understanding of our code is that this would be the safest way to check. It allows us to write a check in the installer that waits for "label == installerversion". Otherwise the only thing we could check for is "has the version of the tag changed", because - the way I understand it - the tag could point to any version specified in the operator.

@SimonTheLeg
Copy link
Member Author

/cc @xrstf


deployment, ok := obj.(*appsv1.Deployment)
if !ok {
return obj, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an error maybe. Silently not doing anything if someone used the modifier on something invalid could lead to sadness.

For other modifiers, like the volume revision thingy, I think we also support DaemonSets and StatefulSets -- if we decide to skip those here for now, it would be good if the code screamed at us if someone decided to use this in the future on a DS/STS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a really good point. Added an error


deployment, ok := obj.(*appsv1.Deployment)
if !ok {
return obj, fmt.Errorf("VersionLabelModifier can only be used with deployments")
Copy link
Contributor

@xrstf xrstf Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf("VersionLabelModifier is only implemented for deployments, not %T", obj)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(let's not make it sound like there is a technical reason version labels are not allowed/supported on other objects)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good. Fixed

Signed-off-by: Simon Bein <simontheleg@gmail.com>
@SimonTheLeg SimonTheLeg force-pushed the version-label-modifier-factory branch from f1269aa to f1162ad Compare March 13, 2024 15:02
Copy link
Contributor

@xrstf xrstf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2024
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: d9c272d7fe22d59878ee673aeaf7e7e67a5004a0

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 13, 2024
@embik embik added the code-freeze-approved Indicates a PR has been approved by release managers during code freeze. label Mar 13, 2024
@kubermatic-bot kubermatic-bot removed the do-not-merge/code-freeze Indicates that a PR should not merge because it has not been approved for code freeze yet. label Mar 13, 2024
@embik
Copy link
Member

embik commented Mar 13, 2024

/milestone KKP 2.25

@kubermatic-bot kubermatic-bot added this to the KKP 2.25 milestone Mar 13, 2024
@kubermatic-bot kubermatic-bot merged commit db54555 into kubermatic:main Mar 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. code-freeze-approved Indicates a PR has been approved by release managers during code freeze. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. docs/none Denotes a PR that doesn't need documentation (changes). kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants