csi: disable liveness sidecar by default

A Liveness sidecar container that is deployed
with the CSI pods will be helpful to check
csi driver is properly responding or not.
and there is no liveness or readiness
kubernetes probe added for this one.
Providing an option to enable this
sidecar deployment and disabling it by default.

fixes #8783

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna committed 2022-07-28 14:01:26 +05:30
1 parent 4cf2af6d1a
commit 187bea6701
11 files changed
+38 -9

No files matched your search

+5
View File
@@ -131,6 +131,11 @@ func (r *ReconcileCSI) setParams(ver *version.Info) error {
return errors.Wrap(err, "error getting CSI RBD liveness metrics port.")
}
CSIParam.EnableLiveness, err = strconv.ParseBool(k8sutil.GetValue(r.opConfig.Parameters, "CSI_ENABLE_LIVENESS", "false"))
if err != nil {
return errors.Wrap(err, "failed to parse value for 'CSI_ENABLE_LIVENESS'")
}
// default value `system-node-critical` is the highest available priority
CSIParam.PluginPriorityClassName = k8sutil.GetValue(r.opConfig.Parameters, "CSI_PLUGIN_PRIORITY_CLASSNAME", "")
+15 -9
View File
@@ -68,6 +68,7 @@ type Param struct {
MountCustomCephConf bool
EnableOIDCTokenProjection bool
EnableCSIEncryption bool
EnableLiveness bool
LogLevel uint8
CephFSGRPCMetricsPort uint16
CephFSLivenessMetricsPort uint16
@@ -320,11 +321,14 @@ func (r *ReconcileCSI) startDrivers(ver *version.Info, ownerInfo *k8sutil.OwnerI
return errors.Wrap(err, "failed to load rbd provisioner deployment template")
}
rbdService, err = templateToService("rbd-service", RBDPluginServiceTemplatePath, tp)
if err != nil {
return errors.Wrap(err, "failed to load rbd plugin service template")
// Create service if either liveness or GRPC metrics are enabled.
if CSIParam.EnableLiveness || EnableCSIGRPCMetrics {
rbdService, err = templateToService("rbd-service", RBDPluginServiceTemplatePath, tp)
if err != nil {
return errors.Wrap(err, "failed to load rbd plugin service template")
}
rbdService.Namespace = r.opConfig.OperatorNamespace
}
rbdService.Namespace = r.opConfig.OperatorNamespace
enabledDrivers = append(enabledDrivers, driverDetails{
name: RBDDriverShortName,
fullName: RBDDriverName,
@@ -344,12 +348,14 @@ func (r *ReconcileCSI) startDrivers(ver *version.Info, ownerInfo *k8sutil.OwnerI
if err != nil {
return errors.Wrap(err, "failed to load rbd provisioner deployment template")
}
cephfsService, err = templateToService("cephfs-service", CephFSPluginServiceTemplatePath, tp)
if err != nil {
return errors.Wrap(err, "failed to load cephfs plugin service template")
// Create service if either liveness or GRPC metrics are enabled.
if CSIParam.EnableLiveness || EnableCSIGRPCMetrics {
cephfsService, err = templateToService("cephfs-service", CephFSPluginServiceTemplatePath, tp)
if err != nil {
return errors.Wrap(err, "failed to load cephfs plugin service template")
}
cephfsService.Namespace = r.opConfig.OperatorNamespace
}
cephfsService.Namespace = r.opConfig.OperatorNamespace
enabledDrivers = append(enabledDrivers, driverDetails{
name: CephFSDriverShortName,
fullName: CephFSDriverName,
@@ -149,6 +149,7 @@ spec:
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
{{ end }}
{{ if .EnableLiveness }}
- name: liveness-prometheus
image: {{ .CSIPluginImage }}
args:
@@ -169,6 +170,7 @@ spec:
- name: socket-dir
mountPath: /csi
imagePullPolicy: "IfNotPresent"
{{ end }}
volumes:
- name: socket-dir
emptyDir: {
@@ -115,6 +115,7 @@ spec:
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
{{ end }}
{{ if .EnableLiveness }}
- name: liveness-prometheus
securityContext:
privileged: true
@@ -137,6 +138,7 @@ spec:
- name: plugin-dir
mountPath: /csi
imagePullPolicy: "IfNotPresent"
{{ end }}
volumes:
- name: plugin-dir
hostPath:
@@ -247,6 +247,7 @@ spec:
- name: rook-ceph-csi-kms-config
mountPath: /etc/ceph-csi-encryption-kms-config/
{{ end }}
{{ if .EnableLiveness }}
- name: liveness-prometheus
image: {{ .CSIPluginImage }}
args:
@@ -267,6 +268,7 @@ spec:
- name: socket-dir
mountPath: /csi
imagePullPolicy: "IfNotPresent"
{{ end }}
volumes:
- name: host-dev
hostPath:
@@ -177,6 +177,7 @@ spec:
- name: plugin-dir
mountPath: /csi
{{ end }}
{{ if .EnableLiveness }}
- name: liveness-prometheus
securityContext:
privileged: true
@@ -199,6 +200,7 @@ spec:
- name: plugin-dir
mountPath: /csi
imagePullPolicy: "IfNotPresent"
{{ end }}
volumes:
- name: plugin-dir
hostPath: