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
add version labels to deployments managed by controllers #13176
Conversation
Signed-off-by: Simon Bein <simontheleg@gmail.com>
I know what this is towards to, why aren't we "just" checking the container image in the |
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. |
/cc @xrstf |
|
||
deployment, ok := obj.(*appsv1.Deployment) | ||
if !ok { | ||
return obj, nil |
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.
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.
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.
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") |
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.
fmt.Errorf("VersionLabelModifier is only implemented for deployments, not %T", obj)
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.
(let's not make it sound like there is a technical reason version labels are not allowed/supported on other objects)
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.
sounds good. Fixed
Signed-off-by: Simon Bein <simontheleg@gmail.com>
f1269aa
to
f1162ad
Compare
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.
/approve
LGTM label has been added. Git tree hash: d9c272d7fe22d59878ee673aeaf7e7e67a5004a0
|
[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 |
/milestone KKP 2.25 |
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:
Documentation: