Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph: ability to set label to crash collector #9044

Merged
merged 1 commit into from Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
leseb marked this conversation as resolved.
Show resolved Hide resolved
* `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