diff --git a/Documentation/ceph-cluster-crd.md b/Documentation/ceph-cluster-crd.md index 08e83d2d92a9..47f2c7dbd0ba 100755 --- a/Documentation/ceph-cluster-crd.md +++ b/Documentation/ceph-cluster-crd.md @@ -517,6 +517,8 @@ You can set annotations / labels for Rook components for the list of key value p * `mon`: Set annotations / labels for mons * `osd`: Set annotations / labels for OSDs * `prepareosd`: Set annotations / labels for OSD Prepare Jobs +* `monitoring`: Set annotations / labels for service monitor +* `crashcollector`: Set annotations / labels for crash collectors When other keys are set, `all` will be merged together with the specific component. ### Placement Configuration Settings diff --git a/cluster/examples/kubernetes/ceph/cluster.yaml b/cluster/examples/kubernetes/ceph/cluster.yaml index 3a325a780e7d..7c28ea92e01a 100644 --- a/cluster/examples/kubernetes/ceph/cluster.yaml +++ b/cluster/examples/kubernetes/ceph/cluster.yaml @@ -178,6 +178,7 @@ spec: # monitoring is a list of key-value pairs. It is injected into all the monitoring resources created by operator. # These labels can be passed as LabelSelector to Prometheus # monitoring: +# crashcollector: resources: # The requests and limits set here, allow the mgr pod to use half of one CPU core and 1 gigabyte of memory # mgr: diff --git a/pkg/apis/ceph.rook.io/v1/keys.go b/pkg/apis/ceph.rook.io/v1/keys.go index 931d5868d958..3257a312f08f 100644 --- a/pkg/apis/ceph.rook.io/v1/keys.go +++ b/pkg/apis/ceph.rook.io/v1/keys.go @@ -17,13 +17,14 @@ limitations under the License. package v1 const ( - KeyAll = "all" - KeyMds KeyType = "mds" - KeyMon KeyType = "mon" - KeyMonArbiter KeyType = "arbiter" - KeyMgr KeyType = "mgr" - KeyOSDPrepare KeyType = "prepareosd" - KeyOSD KeyType = "osd" - KeyCleanup KeyType = "cleanup" - KeyMonitoring KeyType = "monitoring" + KeyAll = "all" + KeyMds KeyType = "mds" + KeyMon KeyType = "mon" + KeyMonArbiter KeyType = "arbiter" + KeyMgr KeyType = "mgr" + KeyOSDPrepare KeyType = "prepareosd" + KeyOSD KeyType = "osd" + KeyCleanup KeyType = "cleanup" + KeyMonitoring KeyType = "monitoring" + KeyCrashCollector KeyType = "crashcollector" ) diff --git a/pkg/apis/ceph.rook.io/v1/labels.go b/pkg/apis/ceph.rook.io/v1/labels.go index 49226dfbc4cb..b64498f9e143 100644 --- a/pkg/apis/ceph.rook.io/v1/labels.go +++ b/pkg/apis/ceph.rook.io/v1/labels.go @@ -63,6 +63,11 @@ func GetMonitoringLabels(a LabelsSpec) Labels { return mergeAllLabelsWithKey(a, KeyMonitoring) } +// GetCrashCollectorLabels returns the Labels for the crash collector resources +func GetCrashCollectorLabels(a LabelsSpec) Labels { + return mergeAllLabelsWithKey(a, KeyCrashCollector) +} + func mergeAllLabelsWithKey(a LabelsSpec, name KeyType) Labels { all := a.All() if all != nil { diff --git a/pkg/operator/ceph/cluster/crash/crash.go b/pkg/operator/ceph/cluster/crash/crash.go index 0fef8b65b936..d5836a02f369 100644 --- a/pkg/operator/ceph/cluster/crash/crash.go +++ b/pkg/operator/ceph/cluster/crash/crash.go @@ -95,6 +95,7 @@ func (r *ReconcileNode) createOrUpdateCephCrash(node corev1.Node, tolerations [] } deploy.ObjectMeta.Labels = deploymentLabels + cephv1.GetCrashCollectorLabels(cephCluster.Spec.Labels).ApplyToObjectMeta(&deploy.ObjectMeta) k8sutil.AddRookVersionLabelToDeployment(deploy) if cephVersion != nil { controller.AddCephVersionLabelToDeployment(*cephVersion, deploy)