Skip to content

Commit

Permalink
Merge pull request #9044 from leseb/fix-9039
Browse files Browse the repository at this point in the history
ceph: ability to set label to crash collector
  • Loading branch information
leseb committed Oct 27, 2021
2 parents c97f70b + 4f2c685 commit f55479b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Documentation/ceph-cluster-crd.md
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cluster/examples/kubernetes/ceph/cluster.yaml
Expand Up @@ -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:
Expand Down
19 changes: 10 additions & 9 deletions pkg/apis/ceph.rook.io/v1/keys.go
Expand Up @@ -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"
)
5 changes: 5 additions & 0 deletions pkg/apis/ceph.rook.io/v1/labels.go
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/ceph/cluster/crash/crash.go
Expand Up @@ -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)
Expand Down

0 comments on commit f55479b

Please sign in to comment.