Skip to content

Commit f094d65

Browse files
committed
drain: adding 'USE_EXTERNAL_DRAINER' provoding an option to enable/disable SRIOV OP drain controller, in favor of using maintenance OP to drive node drain aspects
Signed-off-by: Ido Heyvi <iheyvi@nvidia.com>
1 parent a4152b5 commit f094d65

File tree

5 files changed

+7
-24
lines changed

5 files changed

+7
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ nodes in parallel from the pool the operator can drain in parallel. maxUnavailab
468468

469469
> **NOTE**: If a node is not part of any pool it will have a default configuration of maxUnavailable 1
470470

471-
> **NOTE**: Node draining can be delegated to an external drain-controller by setting `USE_EXTERNAL_DRAINER=true` (e.g. using [NVIDIA maintenance-operator](https://github.com/Mellanox/maintenance-operator)) (PR #952). This means that internal drain-controller continues to work on nodeState objects which were not annotated with `sriovnetwork.openshift.io/use-external-drainer`. In addition, `SriovNetworkPoolConfig` will not take any effect during drain procedure, since the maintenance operator will be in charge of [parallel node operations](https://github.com/Mellanox/maintenance-operator/blob/main/api/v1alpha1/maintenanceoperatorconfig_types.go#L38-L46).
471+
> **NOTE**: Internal drain controller can be disabled by exposing the following `USE_EXTERNAL_DRAINER` env variable. This means that drain operations will be done externally, for example by utilizing [NVIDIA maintenance OP](https://github.com/Mellanox/maintenance-operator). In addition, `SriovNetworkPoolConfig` will not take any effect during drain procedure, since the maintenance operator will be in charge of [parallel node operations](https://github.com/Mellanox/maintenance-operator/blob/main/api/v1alpha1/maintenanceoperatorconfig_types.go#L38-L46).
472472

473473
#### RDMA Mode Configuration
474474

deployment/sriov-network-operator-chart/templates/operator.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ spec:
8787
value: {{ .Values.operator.metricsExporter.certificates.secretName }}
8888
- name: METRICS_EXPORTER_KUBE_RBAC_PROXY_IMAGE
8989
value: {{ .Values.images.metricsExporterKubeRbacProxy }}
90-
{{- if .Values.operator.externalDrainer.enabled }}
9190
- name: USE_EXTERNAL_DRAINER
9291
value: {{ .Values.operator.externalDrainer.enabled | quote }}
93-
{{- end }}
9492
{{- if .Values.operator.metricsExporter.prometheusOperator.enabled }}
9593
- name: METRICS_EXPORTER_PROMETHEUS_OPERATOR_ENABLED
9694
value: {{ .Values.operator.metricsExporter.prometheusOperator.enabled | quote}}

doc/design/parallel-node-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Node annotation, `sriovnetwork.openshift.io/state` and SriovNetworkNodeState ann
6060

6161
*NOTE:* In the future we are going to drop the node annotation and only use the SriovNetworkNodeState
6262

63-
*NOTE:* Node draining can be delegated to an external drain-controller by setting `USE_EXTERNAL_DRAINER=true` (e.g. using [NVIDIA maintenance-operator](https://github.com/Mellanox/maintenance-operator)) (PR #952). In addition, `SriovNetworkPoolConfig` will not take any effect during drain procedure, since the maintenance operator will be in charge of parallel node operations.
63+
*NOTE:* Internal drain controller can be disabled by exposing the following `USE_EXTERNAL_DRAINER` env variable. This means that drain operations will be done externally, for example by utilizing [NVIDIA maintenance OP](https://github.com/Mellanox/maintenance-operator). In addition, `SriovNetworkPoolConfig` will not take any effect during drain procedure, since the maintenance operator will be in charge of parallel node operations.
6464

6565
Draining procedure:
6666

main.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,10 @@ func main() {
272272
}
273273

274274
func setupDrainController(mgr ctrl.Manager, restConfig *rest.Config,
275-
orch orchestrator.Interface, scheme *runtime.Scheme) error {
275+
platformsHelper platforms.Interface, scheme *runtime.Scheme) error {
276276
if vars.UseExternalDrainer {
277-
// even though UseExternalDrainer is set, we are keeping internal drain controller for handling
278-
// use-cases when there are existing nodes under drain_required state, which won't be handled
279-
// externally, since UseExternalDrainer was set only after they were scheduled for draining.
280-
setupLog.Info("'UseExternalDrainer' is set, draining will be done externally")
277+
setupLog.Info("internal drain controller is disabled, draining will be done externally by the maintenance operator")
278+
return nil
281279
}
282280

283281
// we need a client that doesn't use the local cache for the objects
@@ -296,11 +294,10 @@ func setupDrainController(mgr ctrl.Manager, restConfig *rest.Config,
296294
return err
297295
}
298296

299-
drainController, err := controllers.NewDrainReconcileController(
300-
drainKClient,
297+
drainController, err := controllers.NewDrainReconcileController(drainKClient,
301298
mgr.GetScheme(),
302299
mgr.GetEventRecorderFor("SR-IOV operator"),
303-
orch)
300+
platformsHelper)
304301
if err != nil {
305302
setupLog.Error(err, "unable to create controller", "controller", "DrainReconcile")
306303
return err

pkg/vars/vars.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ var (
9999
// FeatureGates interface to interact with feature gates
100100
FeatureGate featuregate.FeatureGate
101101

102-
// ErrOperationNotSupportedByPlatform is returned when a platform operation is not supported by the platform implementation.
103-
ErrOperationNotSupportedByPlatform = errors.New("operation not supported by the platform")
104-
105102
// UseExternalDrainer controls if SRIOV operator will use an external drainer
106103
// for draining nodes or its internal drain controller (default)
107104
UseExternalDrainer bool
@@ -130,12 +127,3 @@ func init() {
130127

131128
UseExternalDrainer = os.Getenv("USE_EXTERNAL_DRAINER") == "true"
132129
}
133-
134-
func GetPlatformType(providerID string) consts.PlatformTypes {
135-
for key, pType := range PlatformsMap {
136-
if strings.Contains(strings.ToLower(providerID), strings.ToLower(key)) {
137-
return pType
138-
}
139-
}
140-
return consts.Baremetal
141-
}

0 commit comments

Comments
 (0)