Skip to content

Commit 560bd11

Browse files
committed
Re-add -enable-nodefeature-api cmdline flag
Bring back the -enable-nodefeature-api command line flag and the corresponding enableNodeFeatureApi helm config value that were removed without deprecation when the NodeFeatureAPI feature gate was introduced. The thinking behind this change is to not break existing users (without warning) unless totally unavoidable. Now the -enable-nodefeature-api flag is marked as deprecated and slated for removal in NFD v0.17. The NodeFeatureAPI feature gate and the -enable-nodefeature-api flag work together so that the NodeFeature API is disabled (gRPC is enabled, instead) if either of them is set to false. This patch selectively reverts parts of 06c4733.
1 parent fc38294 commit 560bd11

File tree

14 files changed

+70
-34
lines changed

14 files changed

+70
-34
lines changed

cmd/nfd-master/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func main() {
8181
args.Overrides.ResyncPeriod = overrides.ResyncPeriod
8282
case "nfd-api-parallelism":
8383
args.Overrides.NfdApiParallelism = overrides.NfdApiParallelism
84+
case "enable-nodefeature-api":
85+
klog.InfoS("-enable-nodefeature-api is deprecated and will be removed in the next release, use -feature-gate NodeFeatureAPI instead")
8486
case "ca-file":
8587
klog.InfoS("-ca-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
8688
case "cert-file":
@@ -139,6 +141,9 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
139141
"Config file to use.")
140142
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
141143
"Kubeconfig to use")
144+
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
145+
"Enable the NodeFeature CRD API for receiving node features. This will automatically disable the gRPC communication."+
146+
" DEPRECATED: will be removed in NFD v0.17. Use -feature-gate NodeFeatureAPI instead.")
142147
flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
143148
"Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead")
144149
flagset.BoolVar(&args.CrdController, "crd-controller", true,

cmd/nfd-worker/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func main() {
6969
klog.InfoS("-cert-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
7070
case "key-file":
7171
klog.InfoS("-key-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
72+
case "enable-nodefeature-api":
73+
klog.InfoS("-enable-nodefeature-api is deprecated and will be removed in the next release, use -feature-gate NodeFeatureAPI instead")
7274
case "server":
7375
klog.InfoS("-server is deprecated, will be removed in a future release along with the deprecated gRPC API")
7476
case "server-name-override":
@@ -132,6 +134,9 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
132134
flagset.StringVar(&args.KeyFile, "key-file", "",
133135
"Private key matching -cert-file."+
134136
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
137+
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
138+
"Enable the NodeFeature CRD API for communicating with nfd-master. This will automatically disable the gRPC communication."+
139+
" DEPRECATED: will be removed in NFD v0.17. Use -feature-gate NodeFeatureAPI instead.")
135140
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
136141
"Kubeconfig to use")
137142
flagset.BoolVar(&args.Oneshot, "oneshot", false,

deployment/helm/node-feature-discovery/templates/clusterrole.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ rules:
8686
- update
8787
{{- end }}
8888

89-
{{- if and .Values.gc.enable .Values.gc.rbac.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
89+
{{- if and .Values.gc.enable .Values.gc.rbac.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }}
9090
---
9191
apiVersion: rbac.authorization.k8s.io/v1
9292
kind: ClusterRole

deployment/helm/node-feature-discovery/templates/clusterrolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ subjects:
3333
namespace: {{ include "node-feature-discovery.namespace" . }}
3434
{{- end }}
3535

36-
{{- if and .Values.gc.enable .Values.gc.rbac.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
36+
{{- if and .Values.gc.enable .Values.gc.rbac.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }}
3737
---
3838
apiVersion: rbac.authorization.k8s.io/v1
3939
kind: ClusterRoleBinding

deployment/helm/node-feature-discovery/templates/master.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ spec:
7373
{{- if .Values.master.instance | empty | not }}
7474
- "-instance={{ .Values.master.instance }}"
7575
{{- end }}
76-
{{- if not .Values.featureGates.NodeFeatureAPI }}
76+
{{- if not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) }}
7777
- "-port={{ .Values.master.port | default "8080" }}"
7878
{{- else if gt (int .Values.master.replicaCount) 1 }}
7979
- "-enable-leader-election"

deployment/helm/node-feature-discovery/templates/nfd-gc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.gc.enable (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) -}}
1+
{{- if and .Values.gc.enable (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) -}}
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:

deployment/helm/node-feature-discovery/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and (not .Values.featureGates.NodeFeatureAPI) .Values.master.enable }}
1+
{{- if and (not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi)) .Values.master.enable }}
22
apiVersion: v1
33
kind: Service
44
metadata:

deployment/helm/node-feature-discovery/templates/serviceaccount.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ metadata:
2727
{{- end }}
2828
{{- end }}
2929

30-
{{- if and .Values.gc.enable .Values.gc.serviceAccount.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
30+
{{- if and .Values.gc.enable .Values.gc.serviceAccount.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }}
3131
---
3232
apiVersion: v1
3333
kind: ServiceAccount

deployment/helm/node-feature-discovery/templates/worker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
command:
7373
- "nfd-worker"
7474
args:
75-
{{- if not .Values.featureGates.NodeFeatureAPI }}
75+
{{- if not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) }}
7676
- "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}"
7777
{{- end }}
7878
{{- if .Values.tls.enable }}

deployment/helm/node-feature-discovery/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ nameOverride: ""
1010
fullnameOverride: ""
1111
namespaceOverride: ""
1212

13+
enableNodeFeatureApi: true
14+
1315
featureGates:
1416
NodeFeatureAPI: true
1517

0 commit comments

Comments
 (0)