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 40a8eb7
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 144 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
134 changes: 67 additions & 67 deletions deploy/charts/rook-ceph/templates/resources.yaml
Expand Up @@ -4771,6 +4771,73 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
helm.sh/resource-policy: keep
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
Expand Down Expand Up @@ -6001,73 +6068,6 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
helm.sh/resource-policy: keep
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
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
132 changes: 66 additions & 66 deletions deploy/examples/crds.yaml
Expand Up @@ -4769,6 +4769,72 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
Expand Down Expand Up @@ -5998,72 +6064,6 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
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 40a8eb7

Please sign in to comment.