Merge pull request #14742 from rook/mergify/bp/release-1.15/pr-14731
core: Enable annotations on crash collector (backport #14731)
This commit is contained in:
3 files changed
+14
-3
No files matched your search
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user