-
Notifications
You must be signed in to change notification settings - Fork 395
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 label to target allocator resources #2455
Add version label to target allocator resources #2455
Conversation
b8bf5b6
to
10352fe
Compare
if _, ok := base["app.kubernetes.io/name"]; !ok { | ||
base["app.kubernetes.io/name"] = name | ||
} | ||
return manifestutils.Labels(instance.ObjectMeta, name, instance.Spec.TargetAllocator.Image, ComponentOpenTelemetryTargetAllocator, 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 is awesome
@@ -44,7 +44,7 @@ func Deployment(params manifests.Params) (*appsv1.Deployment, error) { | |||
Spec: appsv1.DeploymentSpec{ | |||
Replicas: params.OtelCol.Spec.TargetAllocator.Replicas, | |||
Selector: &metav1.LabelSelector{ | |||
MatchLabels: labels, | |||
MatchLabels: SelectorLabels(params.OtelCol), |
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.
Isn't this immutable field? https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates
Can you confirm that this will not break during the upgrade?
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'll test it. If there's a problem with that, then it's probably for the best to leave the selector as is.
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.
@pavolloffay we do have logic in our reconciler to just delete and recreate when it sees this immutable change, so it should just work (with a small blip for the reconciler logic)
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.
Deleting and recreating resources is a bit heavyhanded though, and I'm not sure if we want to do it just to have uniform selector labels between the collector and target allocator.
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 brought this label back. I don't think it makes the code substantially messier - check it our for yourselves.
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.
fair enough! Maybe lets keep it as it is then, and leave a comment explaining the divergence between the two.
10352fe
to
994e5bf
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.
looks good to me, thanks for leaving the comment as well :)
* Add version label to target allocator resources * Use manifestutils.SelectorLabels for target allocator resources
Description:
Add
app.kubernetes.io/version
label to all target allocator resources. Where the label was present, it now uses the target allocator version instead of the collector version. Usemanifestutils.Labels
as the implementation.I've also used
manifestutils.SelectorLabels
where it makes sense.Link to tracking Issue: #2454
Testing:
Modified existing tests.