1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Drop the -enable-nodefeature-api flag

Was marked to be removed in v0.17.
This commit is contained in:
Markus Lehtonen 2024-07-10 14:09:37 +03:00
parent 393af96a88
commit a269bf4d25
14 changed files with 34 additions and 70 deletions

View file

@ -81,8 +81,6 @@ func main() {
args.Overrides.ResyncPeriod = overrides.ResyncPeriod args.Overrides.ResyncPeriod = overrides.ResyncPeriod
case "nfd-api-parallelism": case "nfd-api-parallelism":
args.Overrides.NfdApiParallelism = overrides.NfdApiParallelism args.Overrides.NfdApiParallelism = overrides.NfdApiParallelism
case "enable-nodefeature-api":
klog.InfoS("-enable-nodefeature-api is deprecated and will be removed in the next release, use -feature-gate NodeFeatureAPI instead")
case "ca-file": case "ca-file":
klog.InfoS("-ca-file is deprecated, will be removed in a future release along with the deprecated gRPC API") klog.InfoS("-ca-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
case "cert-file": case "cert-file":
@ -141,9 +139,6 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
"Config file to use.") "Config file to use.")
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "", flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
"Kubeconfig to use") "Kubeconfig to use")
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
"Enable the NodeFeature CRD API for receiving node features. This will automatically disable the gRPC communication."+
" DEPRECATED: will be removed in NFD v0.17. Use -feature-gate NodeFeatureAPI instead.")
flagset.BoolVar(&args.CrdController, "featurerules-controller", true, flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
"Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead") "Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead")
flagset.BoolVar(&args.CrdController, "crd-controller", true, flagset.BoolVar(&args.CrdController, "crd-controller", true,

View file

@ -69,8 +69,6 @@ func main() {
klog.InfoS("-cert-file is deprecated, will be removed in a future release along with the deprecated gRPC API") klog.InfoS("-cert-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
case "key-file": case "key-file":
klog.InfoS("-key-file is deprecated, will be removed in a future release along with the deprecated gRPC API") klog.InfoS("-key-file is deprecated, will be removed in a future release along with the deprecated gRPC API")
case "enable-nodefeature-api":
klog.InfoS("-enable-nodefeature-api is deprecated and will be removed in the next release, use -feature-gate NodeFeatureAPI instead")
case "server": case "server":
klog.InfoS("-server is deprecated, will be removed in a future release along with the deprecated gRPC API") klog.InfoS("-server is deprecated, will be removed in a future release along with the deprecated gRPC API")
case "server-name-override": case "server-name-override":
@ -134,9 +132,6 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
flagset.StringVar(&args.KeyFile, "key-file", "", flagset.StringVar(&args.KeyFile, "key-file", "",
"Private key matching -cert-file."+ "Private key matching -cert-file."+
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.") " DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
"Enable the NodeFeature CRD API for communicating with nfd-master. This will automatically disable the gRPC communication."+
" DEPRECATED: will be removed in NFD v0.17. Use -feature-gate NodeFeatureAPI instead.")
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "", flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
"Kubeconfig to use") "Kubeconfig to use")
flagset.BoolVar(&args.Oneshot, "oneshot", false, flagset.BoolVar(&args.Oneshot, "oneshot", false,

View file

@ -94,7 +94,7 @@ rules:
- update - update
{{- end }} {{- end }}
{{- if and .Values.gc.enable .Values.gc.rbac.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }} {{- if and .Values.gc.enable .Values.gc.rbac.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole

View file

@ -33,7 +33,7 @@ subjects:
namespace: {{ include "node-feature-discovery.namespace" . }} namespace: {{ include "node-feature-discovery.namespace" . }}
{{- end }} {{- end }}
{{- if and .Values.gc.enable .Values.gc.rbac.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }} {{- if and .Values.gc.enable .Values.gc.rbac.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding

View file

@ -73,7 +73,7 @@ spec:
{{- if .Values.master.instance | empty | not }} {{- if .Values.master.instance | empty | not }}
- "-instance={{ .Values.master.instance }}" - "-instance={{ .Values.master.instance }}"
{{- end }} {{- end }}
{{- if not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) }} {{- if not .Values.featureGates.NodeFeatureAPI }}
- "-port={{ .Values.master.port | default "8080" }}" - "-port={{ .Values.master.port | default "8080" }}"
{{- else if gt (int .Values.master.replicaCount) 1 }} {{- else if gt (int .Values.master.replicaCount) 1 }}
- "-enable-leader-election" - "-enable-leader-election"

View file

@ -1,4 +1,4 @@
{{- if and .Values.gc.enable (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) -}} {{- if and .Values.gc.enable (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) -}}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:

View file

@ -1,4 +1,4 @@
{{- if and (not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi)) .Values.master.enable }} {{- if and (not .Values.featureGates.NodeFeatureAPI) .Values.master.enable }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:

View file

@ -27,7 +27,7 @@ metadata:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and .Values.gc.enable .Values.gc.serviceAccount.create (or (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) .Values.topologyUpdater.enable) }} {{- if and .Values.gc.enable .Values.gc.serviceAccount.create (or .Values.featureGates.NodeFeatureAPI .Values.topologyUpdater.enable) }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount

View file

@ -72,7 +72,7 @@ spec:
command: command:
- "nfd-worker" - "nfd-worker"
args: args:
{{- if not (and .Values.featureGates.NodeFeatureAPI .Values.enableNodeFeatureApi) }} {{- if not .Values.featureGates.NodeFeatureAPI }}
- "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}" - "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}"
{{- end }} {{- end }}
{{- if .Values.tls.enable }} {{- if .Values.tls.enable }}

View file

@ -10,8 +10,6 @@ nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
namespaceOverride: "" namespaceOverride: ""
enableNodeFeatureApi: true
featureGates: featureGates:
NodeFeatureAPI: true NodeFeatureAPI: true
NodeFeatureGroupAPI: false NodeFeatureGroupAPI: false

View file

@ -101,7 +101,6 @@ Chart parameters are available.
| `featureGates.NodeFeatureAPI` | bool | true | Enable the [NodeFeature](../usage/custom-resources.md#nodefeature) CRD API for communicating node features. This will automatically disable the gRPC communication. | | `featureGates.NodeFeatureAPI` | bool | true | Enable the [NodeFeature](../usage/custom-resources.md#nodefeature) CRD API for communicating node features. This will automatically disable the gRPC communication. |
| `featureGates.NodeFeatureGroupAPI` | bool | false | Enable the [NodeFeatureGroup](../usage/custom-resources.md#nodefeaturegroup) CRD API. | | `featureGates.NodeFeatureGroupAPI` | bool | false | Enable the [NodeFeatureGroup](../usage/custom-resources.md#nodefeaturegroup) CRD API. |
| `featureGates.DisableAutoPrefix` | bool | false | Enable [DisableAutoPrefix](../reference/feature-gates.md#disableautoprefix) feature gate. Disables automatic prefixing of unprefixed labels, annotations and extended resources. | | `featureGates.DisableAutoPrefix` | bool | false | Enable [DisableAutoPrefix](../reference/feature-gates.md#disableautoprefix) feature gate. Disables automatic prefixing of unprefixed labels, annotations and extended resources. |
| `enableNodeFeatureApi`| bool | true | Enable the [NodeFeature](../usage/custom-resources.md#nodefeature) CRD API for communicating node features. This will automatically disable the gRPC communication. **DEPRECATED**: will be removed in NFD v0.17, use `featureGates.NodeFeatureAPI` instead. |
| `prometheus.enable` | bool | false | Specifies whether to expose metrics using prometheus operator | | `prometheus.enable` | bool | false | Specifies whether to expose metrics using prometheus operator |
| `prometheus.labels` | dict | {} | Specifies labels for use with the prometheus operator to control how it is selected | | `prometheus.labels` | dict | {} | Specifies labels for use with the prometheus operator to control how it is selected |
| `prometheus.scrapeInterval` | string | 10s | Specifies the interval by which metrics are scraped | | `prometheus.scrapeInterval` | string | 10s | Specifies the interval by which metrics are scraped |

View file

@ -175,27 +175,6 @@ nfd-master -verify-node-name -ca-file=/opt/nfd/ca.crt \
-cert-file=/opt/nfd/master.crt -key-file=/opt/nfd/master.key -cert-file=/opt/nfd/master.crt -key-file=/opt/nfd/master.key
``` ```
### -enable-nodefeature-api
**DEPRECATED**: will be removed in NFD v0.17. Use'
[`-feature-gates`](#-feature-gates)
[NodeFeatureAPI](feature-gates.md#nodefeatureapi) instead.
> **NOTE** the gRPC API is deprecated and will be removed in a future release.
The `-enable-nodefeature-api` flag enables/disables the
[NodeFeature](../usage/custom-resources.md#nodefeature) CRD API for receiving
feature requests. This will also automatically disable/enable the gRPC
interface.
Default: true
Example:
```bash
nfd-master -enable-nodefeature-api=false
```
### -enable-leader-election ### -enable-leader-election
The `-enable-leader-election` flag enables leader election for NFD-Master. The `-enable-leader-election` flag enables leader election for NFD-Master.

View file

@ -111,16 +111,15 @@ type ConfigOverrideArgs struct {
// Args holds command line arguments // Args holds command line arguments
type Args struct { type Args struct {
CaFile string CaFile string
CertFile string CertFile string
ConfigFile string ConfigFile string
Instance string Instance string
KeyFile string KeyFile string
Klog map[string]*utils.KlogFlagVal Klog map[string]*utils.KlogFlagVal
Kubeconfig string Kubeconfig string
CrdController bool CrdController bool
EnableNodeFeatureApi bool Port int
Port int
// GrpcHealthPort is only needed to avoid races between tests (by skipping the health server). // GrpcHealthPort is only needed to avoid races between tests (by skipping the health server).
// Could be removed when gRPC labler service is dropped (when nfd-worker tests stop running nfd-master). // Could be removed when gRPC labler service is dropped (when nfd-worker tests stop running nfd-master).
GrpcHealthPort int GrpcHealthPort int
@ -337,7 +336,7 @@ func (m *nfdMaster) Run() error {
grpcErr := make(chan error) grpcErr := make(chan error)
// If the NodeFeature API is enabled, don'tregister the labeler API // If the NodeFeature API is enabled, don'tregister the labeler API
// server. Otherwise, register the labeler server. // server. Otherwise, register the labeler server.
if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) || !m.args.EnableNodeFeatureApi { if !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) {
go m.runGrpcServer(grpcErr) go m.runGrpcServer(grpcErr)
} }
@ -392,7 +391,7 @@ func (m *nfdMaster) Run() error {
m.updaterPool.start(m.config.NfdApiParallelism) m.updaterPool.start(m.config.NfdApiParallelism)
// Update all nodes when the configuration changes // Update all nodes when the configuration changes
if m.nfdController != nil && nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) && m.args.EnableNodeFeatureApi { if m.nfdController != nil && nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) {
m.nfdController.updateAllNodesChan <- struct{}{} m.nfdController.updateAllNodesChan <- struct{}{}
} }
@ -490,7 +489,7 @@ func (m *nfdMaster) runGrpcServer(errChan chan<- error) {
func (m *nfdMaster) nfdAPIUpdateHandler() { func (m *nfdMaster) nfdAPIUpdateHandler() {
// We want to unconditionally update all nodes at startup if gRPC is // We want to unconditionally update all nodes at startup if gRPC is
// disabled (i.e. NodeFeature API is enabled) // disabled (i.e. NodeFeature API is enabled)
updateAll := nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) && m.args.EnableNodeFeatureApi updateAll := nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI)
updateNodes := make(map[string]struct{}) updateNodes := make(map[string]struct{})
nodeFeatureGroup := make(map[string]struct{}) nodeFeatureGroup := make(map[string]struct{})
updateAllNodeFeatureGroups := false updateAllNodeFeatureGroups := false
@ -1512,7 +1511,7 @@ func (m *nfdMaster) startNfdApiController() error {
} }
klog.InfoS("starting the nfd api controller") klog.InfoS("starting the nfd api controller")
m.nfdController, err = newNfdController(kubeconfig, nfdApiControllerOptions{ m.nfdController, err = newNfdController(kubeconfig, nfdApiControllerOptions{
DisableNodeFeature: !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) || !m.args.EnableNodeFeatureApi, DisableNodeFeature: !nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI),
ResyncPeriod: m.config.ResyncPeriod.Duration, ResyncPeriod: m.config.ResyncPeriod.Duration,
}) })
if err != nil { if err != nil {

View file

@ -97,19 +97,18 @@ type Labels map[string]string
// Args are the command line arguments of NfdWorker. // Args are the command line arguments of NfdWorker.
type Args struct { type Args struct {
CaFile string CaFile string
CertFile string CertFile string
ConfigFile string ConfigFile string
EnableNodeFeatureApi bool KeyFile string
KeyFile string Klog map[string]*utils.KlogFlagVal
Klog map[string]*utils.KlogFlagVal Kubeconfig string
Kubeconfig string Oneshot bool
Oneshot bool Options string
Options string Server string
Server string ServerNameOverride string
ServerNameOverride string MetricsPort int
MetricsPort int GrpcHealthPort int
GrpcHealthPort int
Overrides ConfigOverrideArgs Overrides ConfigOverrideArgs
} }
@ -391,7 +390,7 @@ func (w *nfdWorker) Run() error {
return err return err
} }
// Manage connection to master // Manage connection to master
if w.config.Core.NoPublish || !features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) || !w.args.EnableNodeFeatureApi { if w.config.Core.NoPublish || !features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) {
w.grpcDisconnect() w.grpcDisconnect()
} }
@ -735,7 +734,7 @@ func getFeatureLabels(source source.LabelSource, labelWhiteList regexp.Regexp) (
// advertiseFeatures advertises the features of a Kubernetes node // advertiseFeatures advertises the features of a Kubernetes node
func (w *nfdWorker) advertiseFeatures(labels Labels) error { func (w *nfdWorker) advertiseFeatures(labels Labels) error {
if features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) && w.args.EnableNodeFeatureApi { if features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) {
// Create/update NodeFeature CR object // Create/update NodeFeature CR object
if err := w.updateNodeFeatureObject(labels); err != nil { if err := w.updateNodeFeatureObject(labels); err != nil {
return fmt.Errorf("failed to advertise features (via CRD API): %w", err) return fmt.Errorf("failed to advertise features (via CRD API): %w", err)