Skip to content

Commit

Permalink
core: support priority class for crashcollector
Browse files Browse the repository at this point in the history
Support priorityClass to crashcollectos as mons, mgrs, and osds.

https://rook.io/docs/rook/v1.8/ceph-cluster-crd.html#priority-class-names-configuration-settings

The main use case is applying the high priority to crashcollectors to preempt normal pods
under heavy load. Without this feature, we might lose crash information.

Closes: rook#9500

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
  • Loading branch information
satoru-takeuchi committed Dec 28, 2021
1 parent 32e7084 commit a900df8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Documentation/ceph-cluster-crd.md
Expand Up @@ -238,10 +238,10 @@ These are general purpose Ceph container with all necessary daemons and dependen

| TAG | MEANING |
| -------------------- | --------------------------------------------------------- |
| vRELNUM | Latest release in this series (e.g., *v15* = Octopus) |
| vRELNUM | Latest release in this series (e.g., *v15* = Octopus) |
| vRELNUM.Y | Latest stable release in this stable series (e.g., v15.2) |
| vRELNUM.Y.Z | A specific release (e.g., v15.2.5) |
| vRELNUM.Y.Z-YYYYMMDD | A specific build (e.g., v15.2.11-20200419) |
| vRELNUM.Y.Z-YYYYMMDD | A specific build (e.g., v15.2.11-20200419) |

A specific will contain a specific release of Ceph as well as security fixes from the Operating System.

Expand Down Expand Up @@ -597,10 +597,11 @@ Priority class names can be specified so that the Rook components will have thos

You can set priority class names for Rook components for the list of key value pairs:

* `all`: Set priority class names for MGRs, Mons, OSDs.
* `all`: Set priority class names for MGRs, Mons, OSDs, and crashcollectos.
* `mgr`: Set priority class names for MGRs.
* `mon`: Set priority class names for Mons.
* `osd`: Set priority class names for OSDs.
* `crashcollector`: Set priority class names for crashcollectors.

The specific component keys will act as overrides to `all`.

Expand Down
1 change: 1 addition & 0 deletions deploy/charts/rook-ceph-cluster/values.yaml
Expand Up @@ -238,6 +238,7 @@ cephClusterSpec:
# mon: rook-ceph-mon-priority-class
# osd: rook-ceph-osd-priority-class
# mgr: rook-ceph-mgr-priority-class
# crashcollector: rook-ceph-crashcollector-priority-class

storage: # cluster level storage configuration and selection
useAllNodes: true
Expand Down
1 change: 1 addition & 0 deletions deploy/examples/cluster.yaml
Expand Up @@ -207,6 +207,7 @@ spec:
# mon: rook-ceph-mon-priority-class
# osd: rook-ceph-osd-priority-class
# mgr: rook-ceph-mgr-priority-class
# crashcollector: rook-ceph-crashcollector-priority-class
storage: # cluster level storage configuration and selection
useAllNodes: true
useAllDevices: true
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/ceph.rook.io/v1/priorityclasses.go
Expand Up @@ -55,3 +55,11 @@ func GetCleanupPriorityClassName(p PriorityClassNamesSpec) string {
}
return p[KeyCleanup]
}

// GetCrashCollectorPriorityClassName returns the priority class name for the crashcollector
func GetCrashCollectorPriorityClassName(p PriorityClassNamesSpec) string {
if _, ok := p[KeyCrashCollector]; !ok {
return p.All()
}
return p[KeyCrashCollector]
}
10 changes: 6 additions & 4 deletions pkg/apis/ceph.rook.io/v1/priorityclasses_test.go
Expand Up @@ -30,6 +30,7 @@ all: all-class
mgr: mgr-class
mon: mon-class
osd: osd-class
crashcollector: crashcollector-class
`)

// convert the raw spec yaml into JSON
Expand All @@ -43,10 +44,11 @@ osd: osd-class

// the unmarshalled priority class names spec should equal the expected spec below
expected := PriorityClassNamesSpec{
"all": "all-class",
"mgr": "mgr-class",
"mon": "mon-class",
"osd": "osd-class",
"all": "all-class",
"mgr": "mgr-class",
"mon": "mon-class",
"osd": "osd-class",
"crashcollector": "crashcollector-class",
}
assert.Equal(t, expected, priorityClassNames)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/operator/ceph/cluster/crash/crash.go
Expand Up @@ -113,10 +113,11 @@ func (r *ReconcileNode) createOrUpdateCephCrash(node corev1.Node, tolerations []
Containers: []corev1.Container{
getCrashDaemonContainer(cephCluster, *cephVersion),
},
Tolerations: tolerations,
RestartPolicy: corev1.RestartPolicyAlways,
HostNetwork: cephCluster.Spec.Network.IsHost(),
Volumes: volumes,
Tolerations: tolerations,
RestartPolicy: corev1.RestartPolicyAlways,
HostNetwork: cephCluster.Spec.Network.IsHost(),
Volumes: volumes,
PriorityClassName: cephv1.GetCrashCollectorPriorityClassName(cephCluster.Spec.PriorityClassNames),
},
}

Expand Down

0 comments on commit a900df8

Please sign in to comment.