Skip to content

Commit

Permalink
Add Mofed termination grace period param
Browse files Browse the repository at this point in the history
Adding to NicClusterPolicy CRD the possibility to specify
the termination grace period for the Mofed container.
The default is 300 seconds.

It is also configurable in Helm values file.

Signed-off-by: Fred Rolland <frolland@nvidia.com>
  • Loading branch information
rollandf committed Jan 3, 2023
1 parent 6f86918 commit db07f6e
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 66 deletions.
6 changes: 6 additions & 0 deletions api/v1alpha1/nicclusterpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ type OFEDDriverSpec struct {
CertConfig *ConfigMapNameReference `json:"certConfig,omitempty"`
// Optional: Custom package repository configuration for OFED container
RepoConfig *ConfigMapNameReference `json:"repoConfig,omitempty"`
// TerminationGracePeriodSeconds specifies the length of time in seconds
// to wait before killing the OFED pod on termination
// +optional
// +kubebuilder:default:=300
// +kubebuilder:validation:Minimum:=0
TerminationGracePeriodSeconds int `json:"terminationGracePeriodSeconds,omitempty"`
}

// NVPeerDriverSpec describes configuration options for NV Peer Memory driver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ metadata:
"initialDelaySeconds": 10,
"periodSeconds": 20
},
"terminationGracePeriodSeconds": 300,
"upgradePolicy": {
"autoUpgrade": false,
"drain": {
Expand Down
9 changes: 1 addition & 8 deletions config/crd/bases/mellanox.com_hostdevicenetworks.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: hostdevicenetworks.mellanox.com
spec:
Expand Down Expand Up @@ -98,9 +97,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
9 changes: 1 addition & 8 deletions config/crd/bases/mellanox.com_ipoibnetworks.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: ipoibnetworks.mellanox.com
spec:
Expand Down Expand Up @@ -78,9 +77,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
9 changes: 1 addition & 8 deletions config/crd/bases/mellanox.com_macvlannetworks.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: macvlannetworks.mellanox.com
spec:
Expand Down Expand Up @@ -92,9 +91,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
22 changes: 14 additions & 8 deletions config/crd/bases/mellanox.com_nicclusterpolicies.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: nicclusterpolicies.mellanox.com
spec:
Expand Down Expand Up @@ -173,6 +172,7 @@ spec:
type: object
type: array
type: object
x-kubernetes-map-type: atomic
weight:
description: Weight associated with matching the corresponding
nodeSelectorTerm, in the range 1-100.
Expand Down Expand Up @@ -268,10 +268,12 @@ spec:
type: object
type: array
type: object
x-kubernetes-map-type: atomic
type: array
required:
- nodeSelectorTerms
type: object
x-kubernetes-map-type: atomic
type: object
nvPeerDriver:
description: NVPeerDriverSpec describes configuration options for
Expand Down Expand Up @@ -353,6 +355,7 @@ spec:
required:
- key
type: object
x-kubernetes-map-type: atomic
fieldRef:
description: 'Selects a field of the pod: supports metadata.name,
metadata.namespace, `metadata.labels[''<KEY>'']`,
Expand All @@ -371,6 +374,7 @@ spec:
required:
- fieldPath
type: object
x-kubernetes-map-type: atomic
resourceFieldRef:
description: 'Selects a resource of the container: only
resources limits and requests (limits.cpu, limits.memory,
Expand All @@ -395,6 +399,7 @@ spec:
required:
- resource
type: object
x-kubernetes-map-type: atomic
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
Expand All @@ -415,6 +420,7 @@ spec:
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
required:
- name
Expand Down Expand Up @@ -470,6 +476,12 @@ spec:
- initialDelaySeconds
- periodSeconds
type: object
terminationGracePeriodSeconds:
default: 300
description: TerminationGracePeriodSeconds specifies the length
of time in seconds to wait before killing the OFED pod on termination
minimum: 0
type: integer
upgradePolicy:
description: Ofed auto-upgrade settings
properties:
Expand Down Expand Up @@ -727,9 +739,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
1 change: 1 addition & 0 deletions config/samples/mellanox.com_v1alpha1_nicclusterpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
image: mofed
repository: mellanox
version: 5.5-1.0.3.2
terminationGracePeriodSeconds: 300
startupProbe:
initialDelaySeconds: 10
periodSeconds: 20
Expand Down
1 change: 1 addition & 0 deletions deployment/network-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ imagePullSecrets:
| `ofedDriver.env` | list | `[]` | An optional list of [environment variables](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#envvar-v1-core) passed to the Mellanox OFED driver image |
| `ofedDriver.repoConfig.name` | string | `` | Private mirror repository configuration configMap name |
| `ofedDriver.certConfig.name` | string | `` | Custom TLS key/certificate configuration configMap name |
| `ofedDriver.terminationGracePeriodSeconds` | int | 300 | Mellanox OFED termination grace periods in seconds|
| `ofedDriver.startupProbe.initialDelaySeconds` | int | 10 | Mellanox OFED startup probe initial delay |
| `ofedDriver.startupProbe.periodSeconds` | int | 20 | Mellanox OFED startup probe interval |
| `ofedDriver.livenessProbe.initialDelaySeconds` | int | 30 | Mellanox OFED liveness probe initial delay |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: hostdevicenetworks.mellanox.com
spec:
Expand Down Expand Up @@ -98,9 +97,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: ipoibnetworks.mellanox.com
spec:
Expand Down Expand Up @@ -78,9 +77,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: macvlannetworks.mellanox.com
spec:
Expand Down Expand Up @@ -92,9 +91,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: nicclusterpolicies.mellanox.com
spec:
Expand Down Expand Up @@ -173,6 +172,7 @@ spec:
type: object
type: array
type: object
x-kubernetes-map-type: atomic
weight:
description: Weight associated with matching the corresponding
nodeSelectorTerm, in the range 1-100.
Expand Down Expand Up @@ -268,10 +268,12 @@ spec:
type: object
type: array
type: object
x-kubernetes-map-type: atomic
type: array
required:
- nodeSelectorTerms
type: object
x-kubernetes-map-type: atomic
type: object
nvPeerDriver:
description: NVPeerDriverSpec describes configuration options for
Expand Down Expand Up @@ -353,6 +355,7 @@ spec:
required:
- key
type: object
x-kubernetes-map-type: atomic
fieldRef:
description: 'Selects a field of the pod: supports metadata.name,
metadata.namespace, `metadata.labels[''<KEY>'']`,
Expand All @@ -371,6 +374,7 @@ spec:
required:
- fieldPath
type: object
x-kubernetes-map-type: atomic
resourceFieldRef:
description: 'Selects a resource of the container: only
resources limits and requests (limits.cpu, limits.memory,
Expand All @@ -395,6 +399,7 @@ spec:
required:
- resource
type: object
x-kubernetes-map-type: atomic
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
Expand All @@ -415,6 +420,7 @@ spec:
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
required:
- name
Expand Down Expand Up @@ -470,6 +476,12 @@ spec:
- initialDelaySeconds
- periodSeconds
type: object
terminationGracePeriodSeconds:
default: 300
description: TerminationGracePeriodSeconds specifies the length
of time in seconds to wait before killing the OFED pod on termination
minimum: 0
type: integer
upgradePolicy:
description: Ofed auto-upgrade settings
properties:
Expand Down Expand Up @@ -727,9 +739,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ spec:
name: {{ .Values.ofedDriver.repoConfig.name }}
{{- end }}
imagePullSecrets: {{ include "network-operator.ofed.imagePullSecrets" . | nindent 4 }}
terminationGracePeriodSeconds: {{ .Values.ofedDriver.terminationGracePeriodSeconds }}
startupProbe:
initialDelaySeconds: {{ .Values.ofedDriver.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.ofedDriver.startupProbe.periodSeconds }}
Expand Down
1 change: 1 addition & 0 deletions deployment/network-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ ofedDriver:
# env:
# - name: EXAMPLE_ENV_VAR
# value: example_env_var_value
terminationGracePeriodSeconds: 300
# Private mirror repository configuration
repoConfig:
name: ""
Expand Down
2 changes: 1 addition & 1 deletion manifests/stage-ofed-driver/0050_ofed-driver-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ spec:
failureThreshold: 1
periodSeconds: {{ .CrSpec.ReadinessProbe.PeriodSeconds }}
# unloading OFED modules can take more time than default terminationGracePeriod (30 sec)
terminationGracePeriodSeconds: 120
terminationGracePeriodSeconds: {{ .CrSpec.TerminationGracePeriodSeconds }}
volumes:
- name: run-mlnx-ofed
hostPath:
Expand Down

0 comments on commit db07f6e

Please sign in to comment.