diff --git a/pkg/apis/ceph.rook.io/v1/annotations.go b/pkg/apis/ceph.rook.io/v1/annotations.go index 9610420be28c..efd40793f01f 100644 --- a/pkg/apis/ceph.rook.io/v1/annotations.go +++ b/pkg/apis/ceph.rook.io/v1/annotations.go @@ -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] } diff --git a/pkg/apis/ceph.rook.io/v1/annotations_test.go b/pkg/apis/ceph.rook.io/v1/annotations_test.go index b832690c3567..c3137d8ed549 100644 --- a/pkg/apis/ceph.rook.io/v1/annotations_test.go +++ b/pkg/apis/ceph.rook.io/v1/annotations_test.go @@ -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"]) @@ -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) { diff --git a/pkg/operator/ceph/cluster/nodedaemon/crash.go b/pkg/operator/ceph/cluster/nodedaemon/crash.go index 97abb34a3f9d..87ed94fb7ee8 100644 --- a/pkg/operator/ceph/cluster/nodedaemon/crash.go +++ b/pkg/operator/ceph/cluster/nodedaemon/crash.go @@ -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 }