Skip to content

Commit

Permalink
Merge pull request #155 from gnufied/add-node-registrar-healthcheck
Browse files Browse the repository at this point in the history
OCPBUGS-26924: Add healthcheck for node-driver-registrar container
  • Loading branch information
openshift-merge-bot[bot] committed Feb 7, 2024
2 parents f9760de + 005e6d4 commit 57812c5
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 0 deletions.
13 changes: 13 additions & 0 deletions assets/common/sidecars/node_driver_registrar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/${DRIVER_NAME}/csi.sock
- --http-endpoint=:${NODE_DRIVER_REGISTRAR_HEALTH_PORT}
- --v=${LOG_LEVEL}
# Empty env. instead of nil for json patch to append new env. vars there
env: []
Expand All @@ -24,6 +25,18 @@ spec:
mountPath: /csi
- name: registration-dir
mountPath: /registration
ports:
- containerPort: ${NODE_DRIVER_REGISTRAR_HEALTH_PORT}
name: rhealthz
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: rhealthz
initialDelaySeconds: 10
timeoutSeconds: 3
periodSeconds: 10
failureThreshold: 5
resources:
requests:
memory: 50Mi
Expand Down
13 changes: 13 additions & 0 deletions assets/overlays/aws-ebs/generated/hypershift/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ spec:
- args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/ebs.csi.aws.com/csi.sock
- --http-endpoint=:10304
- --v=${LOG_LEVEL}
env: []
image: ${NODE_DRIVER_REGISTRAR_IMAGE}
Expand All @@ -86,7 +87,19 @@ spec:
- /bin/sh
- -c
- rm -rf /registration/ebs.csi.aws.com-reg.sock /csi/csi.sock
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: rhealthz
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
name: csi-node-driver-registrar
ports:
- containerPort: 10304
name: rhealthz
protocol: TCP
resources:
requests:
cpu: 10m
Expand Down
13 changes: 13 additions & 0 deletions assets/overlays/aws-ebs/generated/standalone/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ spec:
- args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/ebs.csi.aws.com/csi.sock
- --http-endpoint=:10304
- --v=${LOG_LEVEL}
env: []
image: ${NODE_DRIVER_REGISTRAR_IMAGE}
Expand All @@ -86,7 +87,19 @@ spec:
- /bin/sh
- -c
- rm -rf /registration/ebs.csi.aws.com-reg.sock /csi/csi.sock
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: rhealthz
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
name: csi-node-driver-registrar
ports:
- containerPort: 10304
name: rhealthz
protocol: TCP
resources:
requests:
cpu: 10m
Expand Down
13 changes: 13 additions & 0 deletions assets/overlays/azure-disk/generated/hypershift/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ spec:
- args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/disk.csi.azure.com/csi.sock
- --http-endpoint=:10304
- --v=${LOG_LEVEL}
env: []
image: ${NODE_DRIVER_REGISTRAR_IMAGE}
Expand All @@ -103,7 +104,19 @@ spec:
- /bin/sh
- -c
- rm -rf /registration/disk.csi.azure.com-reg.sock /csi/csi.sock
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: rhealthz
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
name: csi-node-driver-registrar
ports:
- containerPort: 10304
name: rhealthz
protocol: TCP
resources:
requests:
cpu: 10m
Expand Down
13 changes: 13 additions & 0 deletions assets/overlays/azure-disk/generated/standalone/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ spec:
- args:
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/kubelet/plugins/disk.csi.azure.com/csi.sock
- --http-endpoint=:10304
- --v=${LOG_LEVEL}
env: []
image: ${NODE_DRIVER_REGISTRAR_IMAGE}
Expand All @@ -103,7 +104,19 @@ spec:
- /bin/sh
- -c
- rm -rf /registration/disk.csi.azure.com-reg.sock /csi/csi.sock
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: rhealthz
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
name: csi-node-driver-registrar
ports:
- containerPort: 10304
name: rhealthz
protocol: TCP
resources:
requests:
cpu: 10m
Expand Down
2 changes: 2 additions & 0 deletions pkg/driver/aws-ebs/aws_ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func GetAWSEBSGeneratorConfig() *generator.CSIDriverGeneratorConfig {
GuestConfig: &generator.GuestConfig{
DaemonSetTemplateAssetName: "overlays/aws-ebs/patches/node_add_driver.yaml",
LivenessProbePort: 10300,
// 10305 is used for healthcheck of efs-operator
NodeRegistrarHealthCheckPort: 10304,
Sidecars: []generator.SidecarConfig{
commongenerator.DefaultNodeDriverRegistrar,
commongenerator.DefaultLivenessProbe.WithExtraArguments(
Expand Down
2 changes: 2 additions & 0 deletions pkg/driver/azure-disk/azure_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func GetAzureDiskGeneratorConfig() *generator.CSIDriverGeneratorConfig {
GuestConfig: &generator.GuestConfig{
DaemonSetTemplateAssetName: "overlays/azure-disk/patches/node_add_driver.yaml",
LivenessProbePort: 10300,
// 10303 port is taken by azurefile stuff and hence we must use 10304 here
NodeRegistrarHealthCheckPort: 10304,
Sidecars: []generator.SidecarConfig{
commongenerator.DefaultNodeDriverRegistrar,
commongenerator.DefaultLivenessProbe.WithExtraArguments(
Expand Down
4 changes: 4 additions & 0 deletions pkg/generator/asset_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ func (gen *AssetGenerator) generateDaemonSet() error {
extraReplacements = append(extraReplacements, "${LIVENESS_PROBE_PORT}", strconv.Itoa(int(cfg.LivenessProbePort)))
}

if cfg.NodeRegistrarHealthCheckPort > 0 {
extraReplacements = append(extraReplacements, "${NODE_DRIVER_REGISTRAR_HEALTH_PORT}", strconv.Itoa(int(cfg.NodeRegistrarHealthCheckPort)))
}

err = gen.applyAssetPatch(dsYAML, cfg.DaemonSetTemplateAssetName, extraReplacements)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions pkg/generator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ type GuestConfig struct {
// MetricsPorts []MetricsPort
// Liveness probe TCP port number exposed by the driver itself, i.e. by DaemonSetTemplateAssetName.
LivenessProbePort uint16
// port where node-registrar will expose health check endpoint
NodeRegistrarHealthCheckPort uint16
// Configuration of all sidecars to inject into the guest DaemonSet.
Sidecars []SidecarConfig

Expand Down

0 comments on commit 57812c5

Please sign in to comment.