Skip to content

Commit

Permalink
Merge pull request #14742 from rook/mergify/bp/release-1.15/pr-14731
Browse files Browse the repository at this point in the history
core: Enable annotations on crash collector (backport #14731)
  • Loading branch information
mergify[bot] authored Sep 19, 2024
2 parents 03f9aab + 8c64dec commit dff8f6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pkg/apis/ceph.rook.io/v1/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func GetCmdReporterAnnotations(a AnnotationsSpec) Annotations {
return mergeAllAnnotationsWithKey(a, KeyCmdReporter)
}

// GetCrashCollectorAnnotations returns the Annotations for the crash collector
func GetCrashCollectorAnnotations(a AnnotationsSpec) Annotations {
return mergeAllAnnotationsWithKey(a, KeyCrashCollector)
}

func GetClusterMetadataAnnotations(a AnnotationsSpec) Annotations {
return a[KeyClusterMetadata]
}
Expand Down
11 changes: 8 additions & 3 deletions pkg/apis/ceph.rook.io/v1/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ func TestCephAnnotationsMerge(t *testing.T) {

// Merge with "all"
testAnnotations = AnnotationsSpec{
"all": {"allkey1": "allval1", "allkey2": "allval2"},
"mgr": {"mgrkey": "mgrval"},
"cmdreporter": {"myversions": "detect"},
"all": {"allkey1": "allval1", "allkey2": "allval2"},
"mgr": {"mgrkey": "mgrval"},
"cmdreporter": {"myversions": "detect"},
"crashcollector": {"crash": "crashval"},
}
a = GetMonAnnotations(testAnnotations)
assert.Equal(t, "allval1", a["allkey1"])
Expand All @@ -75,6 +76,10 @@ func TestCephAnnotationsMerge(t *testing.T) {
assert.Equal(t, "detect", b["myversions"])
assert.Equal(t, "allval1", b["allkey1"])
assert.Equal(t, "allval2", b["allkey2"])
c := GetCrashCollectorAnnotations(testAnnotations)
assert.Equal(t, "crashval", c["crash"])
assert.Equal(t, "allval1", c["allkey1"])
assert.Equal(t, "allval2", c["allkey2"])
}

func TestAnnotationsSpec(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/ceph/cluster/nodedaemon/crash.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (r *ReconcileNode) createOrUpdateCephCrash(node corev1.Node, tolerations []
ServiceAccountName: k8sutil.DefaultServiceAccount,
},
}
cephv1.GetCrashCollectorAnnotations(cephCluster.Spec.Annotations).ApplyToObjectMeta(&deploy.Spec.Template.ObjectMeta)

return nil
}
Expand Down

0 comments on commit dff8f6a

Please sign in to comment.