Merge pull request #10113 from rook/mergify/bp/release-1.9/pr-10096

core: Examples set default priority class names (backport #10096)
This commit is contained in:
Travis Nielsen authored and GitHub committed 2022-04-20 09:25:33 -06:00
commit cf200bed36
18 files changed
+136 -96

No files matched your search

+5 -5
View File
@@ -211,7 +211,7 @@ For more details on the mons and when to choose a number other than `3`, see the
* `labels`: [labels configuration settings](#annotations-and-labels)
* `placement`: [placement configuration settings](#placement-configuration-settings)
* `resources`: [resources configuration settings](#cluster-wide-resources-configuration-settings)
* `priorityClassNames`: [priority class names configuration settings](#priority-class-names-configuration-settings)
* `priorityClassNames`: [priority class names configuration settings](#priority-class-names)
* `storage`: Storage selection and configuration that will be used across the cluster. Note that these settings can be overridden for specific nodes.
* `useAllNodes`: `true` or `false`, indicating if all nodes in the cluster should be used for storage according to the cluster level storage selection and configuration values.
If individual nodes are specified under the `nodes` field, then `useAllNodes` must be set to `false`.
@@ -619,16 +619,16 @@ For more information on resource requests/limits see the official Kubernetes doc
* `cpu`: Limit for CPU (example: one CPU core `1`, 50% of one CPU core `500m`).
* `memory`: Limit for Memory (example: one gigabyte of memory `1Gi`, half a gigabyte of memory `512Mi`).
### Priority Class Names Configuration Settings
### Priority Class Names
Priority class names can be specified so that the Rook components will have those priority class names added to them.
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, and crashcollectors.
* `mgr`: Set priority class names for MGRs.
* `mon`: Set priority class names for Mons.
* `osd`: Set priority class names for OSDs.
* `mgr`: Set priority class names for MGRs. Examples default to system-cluster-critical.
* `mon`: Set priority class names for Mons. Examples default to system-node-critical.
* `osd`: Set priority class names for OSDs. Examples default to system-node-critical.
* `crashcollector`: Set priority class names for crashcollectors.
The specific component keys will act as overrides to `all`.
+6 -6
View File
@@ -288,12 +288,10 @@ cephClusterSpec:
removeOSDsIfOutAndSafeToRemove: false
# priority classes to apply to ceph resources
# priorityClassNames:
# all: rook-ceph-default-priority-class
# mon: rook-ceph-mon-priority-class
# osd: rook-ceph-osd-priority-class
# mgr: rook-ceph-mgr-priority-class
# crashcollector: rook-ceph-crashcollector-priority-class
priorityClassNames:
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
storage: # cluster level storage configuration and selection
useAllNodes: true
@@ -442,6 +440,7 @@ cephFileSystems:
requests:
cpu: "1000m"
memory: "4Gi"
priorityClassName: system-cluster-critical
storageClass:
enabled: true
isDefault: false
@@ -511,6 +510,7 @@ cephObjectStores:
# securePort: 443
# sslCertificateRef:
instances: 1
priorityClassName: system-cluster-critical
healthCheck:
bucket:
interval: 60s
+6 -5
View File
@@ -69,14 +69,15 @@ csi:
# set to false to disable deployment of snapshotter container in RBD provisioner pod.
enableRBDSnapshotter: true
# set to false if the selinux is not enabled or unavailable in cluster nodes.
enablePluginSelinuxHostMount : false
enablePluginSelinuxHostMount: false
# set to true to enable Ceph CSI pvc encryption support.
enableCSIEncryption: false
# (Optional) set user created priorityclassName for csi plugin pods.
# pluginPriorityClassName: system-node-critical
pluginPriorityClassName: system-node-critical
# (Optional) set user created priorityclassName for csi provisioner pods.
# provisionerPriorityClassName: system-cluster-critical
provisionerPriorityClassName: system-cluster-critical
# (Optional) policy for modifying a volume's ownership or permissions when the RBD PVC is being mounted.
# supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html
@@ -85,7 +86,7 @@ csi:
# (Optional) policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted.
# supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html
cephFSFSGroupPolicy: "ReadWriteOnceWithFSType"
# (Optional) policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted.
# supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html
nfsFSGroupPolicy: "ReadWriteOnceWithFSType"
@@ -117,7 +118,7 @@ csi:
# Allow starting unsupported ceph-csi image
allowUnsupportedVersion: false
# CEPH CSI RBD provisioner resource requirement list, Put here list of resource
# CEPH CSI RBD provisioner resource requirement list, Put here list of resource
# requests and limits you want to apply for provisioner pod
# csi-omap-generator resources will be applied only if enableOMAPGenerator is set to true
csiRBDProvisionerResource: |
@@ -256,6 +256,10 @@ spec:
# requests:
# cpu: "200m"
# memory: "200Mi"
priorityClassNames:
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
disruptionManagement:
managePodBudgets: true
osdMaintenanceTimeout: 30
+6
View File
@@ -169,6 +169,12 @@ spec:
# requests:
# cpu: "200m"
# memory: "200Mi"
priorityClassNames:
# If there are multiple nodes available in a failure domain (e.g. zones), the
# mons and osds can be portable and set the system-cluster-critical priority class.
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
disruptionManagement:
managePodBudgets: true
osdMaintenanceTimeout: 30
@@ -132,5 +132,9 @@ spec:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
priorityClassNames:
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
disruptionManagement:
managePodBudgets: true
+4
View File
@@ -70,5 +70,9 @@ spec:
values:
- b
- c
priorityClassNames:
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
disruptionManagement:
managePodBudgets: true
+3
View File
@@ -49,6 +49,9 @@ spec:
mon:
interval: 45s
timeout: 600s
priorityClassNames:
all: system-node-critical
mgr: system-cluster-critical
disruptionManagement:
managePodBudgets: true
---
+6 -6
View File
@@ -214,12 +214,12 @@ spec:
# cleanup:
# The option to automatically remove OSDs that are out and are safe to destroy.
removeOSDsIfOutAndSafeToRemove: false
# priorityClassNames:
# all: rook-ceph-default-priority-class
# mon: rook-ceph-mon-priority-class
# osd: rook-ceph-osd-priority-class
# mgr: rook-ceph-mgr-priority-class
# crashcollector: rook-ceph-crashcollector-priority-class
priorityClassNames:
#all: rook-ceph-default-priority-class
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
#crashcollector: rook-ceph-crashcollector-priority-class
storage: # cluster level storage configuration and selection
useAllNodes: true
useAllDevices: true
+1 -1
View File
@@ -101,7 +101,7 @@ spec:
# requests:
# cpu: "500m"
# memory: "1024Mi"
# priorityClassName: my-priority-class
priorityClassName: system-cluster-critical
livenessProbe:
disabled: false
startupProbe:
+1 -1
View File
@@ -99,7 +99,7 @@ spec:
# requests:
# cpu: "500m"
# memory: "1024Mi"
# priorityClassName: my-priority-class
priorityClassName: system-cluster-critical
#zone:
#name: zone-a
# service endpoint healthcheck
+2 -2
View File
@@ -182,10 +182,10 @@ data:
# ROOK_CSI_NFS_IMAGE: "mcr.microsoft.com/k8s/csi/nfs-csi:v3.1.0"
# (Optional) set user created priorityclassName for csi plugin pods.
# CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
# (Optional) set user created priorityclassName for csi provisioner pods.
# CSI_PROVISIONER_PRIORITY_CLASSNAME: "system-cluster-critical"
CSI_PROVISIONER_PRIORITY_CLASSNAME: "system-cluster-critical"
# CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate.
# Default value is RollingUpdate.
+2 -2
View File
@@ -97,10 +97,10 @@ data:
# ROOK_CSI_NFS_IMAGE: "mcr.microsoft.com/k8s/csi/nfs-csi:v3.1.0"
# (Optional) set user created priorityclassName for csi plugin pods.
# CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
# (Optional) set user created priorityclassName for csi provisioner pods.
# CSI_PROVISIONER_PRIORITY_CLASSNAME: "system-cluster-critical"
CSI_PROVISIONER_PRIORITY_CLASSNAME: "system-cluster-critical"
# CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate.
# Default value is RollingUpdate.
@@ -22,6 +22,7 @@ import (
"time"
"github.com/pkg/errors"
"github.com/rook/rook/tests/framework/utils"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -58,12 +59,18 @@ func (h *CephInstaller) configureRookOperatorViaHelm(upgrade bool) error {
"image": map[string]interface{}{"tag": h.settings.RookVersion},
"monitoring": map[string]interface{}{"enabled": true},
}
values["csi"] = map[string]interface{}{
"csiRBDProvisionerResource": nil,
"csiRBDPluginResource": nil,
csiValues := map[string]interface{}{
"csiRBDProvisionerResource": nil,
"csiRBDPluginResource": nil,
"csiCephFSProvisionerResource": nil,
"csiCephFSPluginResource": nil,
"csiCephFSPluginResource": nil,
}
if !utils.VersionAtLeast(h.settings.KubernetesVersion, "v1.17.0") {
// Older than K8s 1.17 cannot apply priority classes
csiValues["pluginPriorityClassName"] = ""
csiValues["provisionerPriorityClassName"] = ""
}
values["csi"] = csiValues
// create the operator namespace before the admission controller is created
if err := h.k8shelper.CreateNamespace(h.settings.OperatorNamespace); err != nil {
@@ -116,8 +123,8 @@ func (h *CephInstaller) configureRookCephClusterViaHelm(upgrade bool) error {
values["operatorNamespace"] = h.settings.OperatorNamespace
values["configOverride"] = clusterCustomSettings
values["toolbox"] = map[string]interface{}{
"enabled": true,
"image": "rook/ceph:" + h.settings.RookVersion,
"enabled": true,
"image": "rook/ceph:" + h.settings.RookVersion,
"resources": nil,
}
values["monitoring"] = map[string]interface{}{
@@ -136,6 +143,10 @@ func (h *CephInstaller) configureRookCephClusterViaHelm(upgrade bool) error {
},
},
}
if !utils.VersionAtLeast(h.settings.KubernetesVersion, "v1.17.0") {
values["cephFilesystems"] = map[string]interface{}{}
values["cephObjectStores"] = map[string]interface{}{}
}
if err := h.CreateBlockPoolConfiguration(values, BlockPoolName, BlockPoolSCName); err != nil {
return err
+55 -61
View File
@@ -126,8 +126,7 @@ func (m *CephManifestsMaster) GetCephCluster() string {
if m.settings.MultipleMgrs {
mgrCount = 2
}
if m.settings.UsePVC {
return `apiVersion: ceph.rook.io/v1
clusterSpec := `apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
# set the name to something different from the namespace
@@ -136,15 +135,6 @@ metadata:
spec:
resources: null
dataDirHostPath: ` + m.settings.DataDirHostPath + `
mon:
count: ` + strconv.Itoa(m.settings.Mons) + `
allowMultiplePerNode: true
volumeClaimTemplate:
spec:
storageClassName: ` + m.settings.StorageClassName + `
resources:
requests:
storage: 5Gi
cephVersion:
image: ` + m.settings.CephVersion.Image + `
allowUnsupported: ` + strconv.FormatBool(m.settings.CephVersion.AllowUnsupported) + `
@@ -153,6 +143,11 @@ spec:
mgr:
count: ` + strconv.Itoa(mgrCount) + `
allowMultiplePerNode: true
modules:
- name: pg_autoscaler
enabled: true
- name: rook
enabled: true
dashboard:
enabled: true
network:
@@ -165,6 +160,33 @@ spec:
crashCollector:
disable: false
` + pruner + `
disruptionManagement:
managePodBudgets: true
osdMaintenanceTimeout: 30
pgHealthCheckTimeout: 0
manageMachineDisruptionBudgets: false
machineDisruptionBudgetNamespace: openshift-machine-api
healthCheck:
daemonHealth:
mon:
interval: 10s
timeout: 15s
osd:
interval: 10s
status:
interval: 5s`
if m.settings.UsePVC {
clusterSpec += `
mon:
count: ` + strconv.Itoa(m.settings.Mons) + `
allowMultiplePerNode: true
volumeClaimTemplate:
spec:
storageClassName: ` + m.settings.StorageClassName + `
resources:
requests:
storage: 5Gi
storage:
config:
` + crushRoot + `
@@ -185,42 +207,12 @@ spec:
volumeMode: Block
accessModes:
- ReadWriteOnce
disruptionManagement:
managePodBudgets: true
osdMaintenanceTimeout: 30
pgHealthCheckTimeout: 0
manageMachineDisruptionBudgets: false
machineDisruptionBudgetNamespace: openshift-machine-api`
}
return `apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
name: ` + m.settings.ClusterName + `
namespace: ` + m.settings.Namespace + `
spec:
resources: null
cephVersion:
image: ` + m.settings.CephVersion.Image + `
allowUnsupported: ` + strconv.FormatBool(m.settings.CephVersion.AllowUnsupported) + `
dataDirHostPath: ` + m.settings.DataDirHostPath + `
network:
hostNetwork: false
connections:
encryption:
enabled: ` + strconv.FormatBool(m.settings.ConnectionsEncrypted) + `
compression:
enabled: ` + strconv.FormatBool(m.settings.ConnectionsCompressed) + `
crashCollector:
disable: false
` + pruner + `
`
} else {
clusterSpec += `
mon:
count: ` + strconv.Itoa(m.settings.Mons) + `
allowMultiplePerNode: true
dashboard:
enabled: true
skipUpgradeChecks: true
metadataDevice:
storage:
useAllNodes: ` + strconv.FormatBool(!m.settings.SkipOSDCreation) + `
useAllDevices: ` + strconv.FormatBool(!m.settings.SkipOSDCreation) + `
@@ -228,23 +220,25 @@ spec:
config:
databaseSizeMB: "1024"
journalSizeMB: "1024"
mgr:
count: ` + strconv.Itoa(mgrCount) + `
allowMultiplePerNode: true
modules:
- name: pg_autoscaler
enabled: true
- name: rook
enabled: true
healthCheck:
daemonHealth:
mon:
interval: 10s
timeout: 15s
osd:
interval: 10s
status:
interval: 5s`
`
}
return clusterSpec + m.getClusterPriorityClasses()
}
func (m *CephManifestsMaster) getClusterPriorityClasses() string {
priorityClasses := `
priorityClassNames:
`
// Priority classes are only supported on pods outside the kube-system namespace
// in versions of at least v1.17
if utils.VersionAtLeast(m.Settings().KubernetesVersion, "v1.17.0") {
priorityClasses += `
mon: system-node-critical
osd: system-node-critical
mgr: system-cluster-critical
`
}
return priorityClasses
}
func (m *CephManifestsMaster) GetBlockSnapshotClass(snapshotClassName, reclaimPolicy string) string {
@@ -22,6 +22,7 @@ import (
"strings"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/rook/rook/tests/framework/utils"
)
// TestCephSettings struct for handling panic and test suite tear down
@@ -50,6 +51,7 @@ type TestCephSettings struct {
ChangeHostName bool
RookVersion string
CephVersion cephv1.CephVersionSpec
KubernetesVersion string
}
func (s *TestCephSettings) ApplyEnvVars() {
@@ -86,6 +88,11 @@ func (s *TestCephSettings) replaceOperatorSettings(manifest string) string {
manifest = strings.ReplaceAll(manifest, `# CSI_LOG_LEVEL: "0"`, `CSI_LOG_LEVEL: "5"`)
manifest = strings.ReplaceAll(manifest, `ROOK_ENABLE_DISCOVERY_DAEMON: "false"`, fmt.Sprintf(`ROOK_ENABLE_DISCOVERY_DAEMON: "%t"`, s.EnableDiscovery))
manifest = strings.ReplaceAll(manifest, `CSI_ENABLE_VOLUME_REPLICATION: "false"`, fmt.Sprintf(`CSI_ENABLE_VOLUME_REPLICATION: "%t"`, s.EnableVolumeReplication))
if !utils.VersionAtLeast(s.KubernetesVersion, "v1.17.0") {
// Older than K8s 1.17 does not support priority classes
manifest = strings.ReplaceAll(manifest, `CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"`, `CSI_PLUGIN_PRIORITY_CLASSNAME: ""`)
manifest = strings.ReplaceAll(manifest, `CSI_PROVISIONER_PRIORITY_CLASSNAME: "system-cluster-critical"`, `CSI_PROVISIONER_PRIORITY_CLASSNAME: ""`)
}
return manifest
}
+5
View File
@@ -126,6 +126,11 @@ func (k8sh *K8sHelper) GetK8sServerVersion() string {
return versionInfo.GitVersion
}
func VersionAtLeast(actualVersion, minVersion string) bool {
v := version.MustParseSemantic(actualVersion)
return v.AtLeast(version.MustParseSemantic(minVersion))
}
func (k8sh *K8sHelper) VersionAtLeast(minVersion string) bool {
v := version.MustParseSemantic(k8sh.GetK8sServerVersion())
return v.AtLeast(version.MustParseSemantic(minVersion))
+2 -1
View File
@@ -76,7 +76,7 @@ func checkIfRookClusterIsHealthy(s suite.Suite, testClient *clients.TestClient,
func checkIfRookClusterHasHealthyIngress(s suite.Suite, k8sh *utils.K8sHelper, clusterNamespace string) {
logger.Infof("Testing ingress %s health", clusterNamespace)
_, err := k8sh.GetResourceStatus("Ingress", clusterNamespace + "-dashboard", clusterNamespace)
_, err := k8sh.GetResourceStatus("Ingress", clusterNamespace+"-dashboard", clusterNamespace)
assert.NoError(s.T(), err)
}
@@ -93,6 +93,7 @@ func HandlePanics(r interface{}, uninstaller func(), t func() *testing.T) {
func StartTestCluster(t func() *testing.T, settings *installer.TestCephSettings) (*installer.CephInstaller, *utils.K8sHelper) {
k8shelper, err := utils.CreateK8sHelper(t)
require.NoError(t(), err)
settings.KubernetesVersion = k8shelper.GetK8sServerVersion()
// Turn on DEBUG logging
capnslog.SetGlobalLogLevel(capnslog.DEBUG)