Skip to content

Commit

Permalink
Deprecate gRPC API
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Co-authored-by: Markus Lehtonen <markus.lehtonen@intel.com>
  • Loading branch information
ArangoGutierrez and marquiz committed Sep 6, 2023
1 parent 50dd128 commit a1172f6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 16 deletions.
5 changes: 4 additions & 1 deletion cmd/nfd-master/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func main() {
args.Overrides.ResyncPeriod = overrides.ResyncPeriod
case "nfd-api-parallelism":
args.Overrides.NfdApiParallelism = overrides.NfdApiParallelism
case "enable-nodefeature-api":
klog.InfoS("-enable-nodefeature-api is deprecated, will be removed in a future release along with the deprecated gRPC API")
}
})

Expand Down Expand Up @@ -117,7 +119,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
"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.")
"Enable the NodeFeature CRD API for receiving node features. This will automatically disable the gRPC communication."+
"DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
"Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead")
flagset.BoolVar(&args.CrdController, "crd-controller", true,
Expand Down
8 changes: 7 additions & 1 deletion cmd/nfd-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func main() {
klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.")
}

// Deprecation warning
if !args.EnableNodeFeatureApi {
klog.InfoS("-enable-nodefeature-api is deprecated, will be removed in a future release along with the deprecated gRPC API")
}

Check warning on line 57 in cmd/nfd-worker/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/nfd-worker/main.go#L55-L57

Added lines #L55 - L57 were not covered by tests

// Plug klog into grpc logging infrastructure
utils.ConfigureGrpcKlog()

Expand Down Expand Up @@ -104,7 +109,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
flagset.StringVar(&args.KeyFile, "key-file", "",
"Private key matching -cert-file")
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.")
"Enable the NodeFeature CRD API for communicating with nfd-master. This will automatically disable the gRPC communication."+
"DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
flagset.StringVar(&args.Kubeconfig, "kubeconfig", "",
"Kubeconfig to use")
flagset.BoolVar(&args.Oneshot, "oneshot", false,
Expand Down
23 changes: 15 additions & 8 deletions docs/developer-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ make e2e-test KUBECONFIG=$HOME/.kube/config

## Running locally

> ****DEPRECATED**: Running NFD locally is deprecated and will be removed in a
> future release. It depends on the gRPC API which is deprecated and will be
> removed in a future release. To run NFD locally, use the
> `-enable-nodefeature-api=false` flag.
You can run NFD locally, either directly on your host OS or in containers for
testing and development purposes. This may be useful e.g. for checking
features-detection.
Expand All @@ -174,22 +179,23 @@ features-detection.

When running as a standalone container labeling is expected to fail because
Kubernetes API is not available. Thus, it is recommended to use `-no-publish`
command line flag. E.g.
Also specify `-crd-controller=false` and `-enable-nodefeature-api=false`
command line flags to disable CRD controller and enable gRPC. E.g.

```bash
$ export NFD_CONTAINER_IMAGE={{ site.container_image }}
$ docker run --rm --name=nfd-test ${NFD_CONTAINER_IMAGE} nfd-master -no-publish
$ docker run --rm --name=nfd-test ${NFD_CONTAINER_IMAGE} nfd-master -no-publish -crd-controller=false -enable-nodefeature-api=false
2019/02/01 14:48:21 Node Feature Discovery Master <NFD_VERSION>
2019/02/01 14:48:21 gRPC server serving on port: 8080
```

### NFD-Worker

In order to run nfd-worker as a "stand-alone" container against your
standalone nfd-master you need to run them in the same network namespace:
In order to run nfd-worker as a "stand-alone" container
you need to run it in the same network namespace as the nfd-master container:

```bash
$ docker run --rm --network=container:nfd-test ${NFD_CONTAINER_IMAGE} nfd-worker
$ docker run --rm --network=container:nfd-test ${NFD_CONTAINER_IMAGE} nfd-worker -enable-nodefeature-api=false
2019/02/01 14:48:56 Node Feature Discovery Worker <NFD_VERSION>
...
```
Expand All @@ -206,11 +212,12 @@ pass the `-no-publish` flag to nfd-worker.
### NFD-Topology-Updater

In order to run nfd-topology-updater as a "stand-alone" container against your
standalone nfd-master you need to run them in the same network namespace:
In order to run nfd-topology-updater as a "stand-alone" container
you need to run it in with the `-no-publish` flag to disable communication to
the Kubernetes apiserver.

```bash
$ docker run --rm --network=container:nfd-test ${NFD_CONTAINER_IMAGE} nfd-topology-updater
$ docker run --rm ${NFD_CONTAINER_IMAGE} nfd-topology-updater -no-publish
2019/02/01 14:48:56 Node Feature Discovery Topology Updater <NFD_VERSION>
...
```
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/master-commandline-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ nfd-master -verify-node-name -ca-file=/opt/nfd/ca.crt \

### -enable-nodefeature-api

> **NOTE** the gRPC API is deprecated and will be removed in a future release.
> and this flag will be removed as well.
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
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/worker-commandline-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ nfd-worker -label-sources=kernel,system,local

### -enable-nodefeature-api

> **NOTE** the gRPC API is deprecated and will be removed in a future release.
> and this flag will be removed as well.
The `-enable-nodefeature-api` flag enables/disables the
[NodeFeature](../usage/custom-resources.md#nodefeature) CRD API
for communicating with nfd-master. When enabled nfd-worker creates per-node
Expand Down
3 changes: 2 additions & 1 deletion docs/usage/customization-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ create and manipulate NodeFeature objects in their namespace.
The NodeFeature CRD API can be disabled with the
`-enable-nodefeature-api=false` command line flag. This flag must be specified
for both nfd-master and nfd-worker as it will enable the gRPC communication
between them.
between them. Note that the gRPC API is **DEPRECATED** and will be removed in a
future release, at which point the NodeFeature API cannot be disabled.

### A NodeFeature example

Expand Down
11 changes: 6 additions & 5 deletions docs/usage/nfd-master.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ and creates node labels accordingly. The feature data used as the input is
received from nfd-worker instances through
[NodeFeature](custom-resources.md#nodefeature-custom-resource) objects.

> **NOTE:** when gRPC is used for communicating the features (by setting the
> flag `-enable-nodefeature-api=false` on both nfd-master and nfd-worker, or
> via Helm values.enableNodeFeatureApi=false),(re-)labelling only happens
> when a request is received from nfd-worker. That is, in practice rules are
> evaluated and labels for each node are created on intervals specified by the
> **NOTE**: when gRPC (**DEPRECATED**) when gRPC is used for communicating
> the features (by setting the flag `-enable-nodefeature-api=false` on both
> nfd-master and nfd-worker, or via Helm values.enableNodeFeatureApi=false),
> (re-)labelling only happens when a request is received from nfd-worker.
> That is, in practice rules are evaluated and labels for each node are created
> on intervals specified by the
> [`core.sleepInterval`](../reference/worker-configuration-reference.md#coresleepinterval)
> configuration option of nfd-worker instances. This means that modification or
> creation of NodeFeatureRule objects does not instantly cause the node
Expand Down

0 comments on commit a1172f6

Please sign in to comment.