Skip to content

Commit

Permalink
Corrected Logstash label logstash.k8s.elastic.co/statefulset-name to …
Browse files Browse the repository at this point in the history
…include the -ls suffix, fixing issues preventing pod recreation during ECK upgrade from version 2.11 to 2.12. (#7788)

Fixes: #7742
  • Loading branch information
kaisecheng authored May 14, 2024
1 parent ac44d7d commit 09e75f8
Showing 1 changed file with 2 additions and 2 deletions.
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)
}

0 comments on commit 09e75f8

Please sign in to comment.