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

Correct statefulset name label for Logstash pods #7788

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/controller/logstash/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ func ensureSTSNameLabelIsSetOnPods(params Params) error {
if err != nil {
return err
}
if _, ok := sts.Spec.Template.Labels[labels.StatefulSetNameLabelName]; ok {
if val, ok := sts.Spec.Template.Labels[labels.StatefulSetNameLabelName]; ok && (val == logstashv1alpha1.Name(params.Logstash.Name)) {
// label is already in place, great
return nil
}
// add the missing label and update the sts resource
if sts.Spec.Template.Labels == nil {
sts.Spec.Template.Labels = map[string]string{}
}
sts.Spec.Template.Labels[labels.StatefulSetNameLabelName] = params.Logstash.Name
sts.Spec.Template.Labels[labels.StatefulSetNameLabelName] = logstashv1alpha1.Name(params.Logstash.Name)
return params.Client.Update(params.Context, &sts)
}