Skip to content

Commit

Permalink
Adds default container annotation to Thanos Ruler pod (prometheus-ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSalisbury authored Apr 14, 2021
1 parent 39f8c96 commit 0b7eff8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/thanos/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ func makeStatefulSetSpec(tr *monitoringv1.ThanosRuler, config Config, ruleConfig
podLabels[thanosRulerLabel] = tr.Name
finalLabels := config.Labels.Merge(podLabels)

podAnnotations["kubectl.kubernetes.io/default-container"] = "thanos-ruler"

storageVolName := volumeName(tr.Name)
if tr.Spec.Storage != nil {
if tr.Spec.Storage.VolumeClaimTemplate.Name != "" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/thanos/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func TestPodLabelsAnnotations(t *testing.T) {
},
}, defaultTestConfig, nil, "")
require.NoError(t, err)
if _, ok := sset.Spec.Template.ObjectMeta.Labels["testlabel"]; !ok {
if val, ok := sset.Spec.Template.ObjectMeta.Labels["testlabel"]; !ok || val != "testvalue" {
t.Fatal("Pod labels are not properly propagated")
}
if !reflect.DeepEqual(annotations, sset.Spec.Template.ObjectMeta.Annotations) {
if val, ok := sset.Spec.Template.ObjectMeta.Annotations["testannotation"]; !ok || val != "testvalue" {
t.Fatal("Pod annotations are not properly propagated")
}
}
Expand Down

0 comments on commit 0b7eff8

Please sign in to comment.