diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index a51309b4a..bfc781a8f 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -33,8 +33,7 @@ import ( const ( // ProgramName is the canonical name of this program - ProgramName = "nfd-master" - GrpcHealthPort = 8082 + ProgramName = "nfd-master" ) func main() { @@ -110,7 +109,6 @@ func main() { utils.ConfigureGrpcKlog() // Get new NfdMaster instance - args.GrpcHealthPort = GrpcHealthPort instance, err := master.NewNfdMaster(master.WithArgs(args)) if err != nil { klog.ErrorS(err, "failed to initialize NfdMaster instance") @@ -154,6 +152,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs) " DEPRECATED: will be removed in a future release along with the deprecated gRPC API.") flagset.IntVar(&args.MetricsPort, "metrics", 8081, "Port on which to expose metrics.") + flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082, + "Port on which to expose the grpc health endpoint.") flagset.BoolVar(&args.Prune, "prune", false, "Prune all NFD related attributes from all nodes of the cluster and exit.") flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false, diff --git a/cmd/nfd-topology-updater/main.go b/cmd/nfd-topology-updater/main.go index ee03415e2..dc6bee50d 100644 --- a/cmd/nfd-topology-updater/main.go +++ b/cmd/nfd-topology-updater/main.go @@ -38,7 +38,6 @@ const ( // ProgramName is the canonical name of this program ProgramName = "nfd-topology-updater" kubeletSecurePort = 10250 - GrpcHealthPort = 8082 ) var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet") @@ -57,7 +56,6 @@ func main() { utils.ConfigureGrpcKlog() // Get new TopologyUpdater instance - args.GrpcHealthPort = GrpcHealthPort instance, err := topology.NewTopologyUpdater(*args, *resourcemonitorArgs) if err != nil { klog.ErrorS(err, "failed to initialize topology updater instance") @@ -115,6 +113,8 @@ func initFlags(flagset *flag.FlagSet) (*topology.Args, *resourcemonitor.Args) { "Kube config file.") flagset.IntVar(&args.MetricsPort, "metrics", 8081, "Port on which to expose metrics.") + flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082, + "Port on which to expose the grpc health endpoint.") flagset.DurationVar(&resourcemonitorArgs.SleepInterval, "sleep-interval", time.Duration(60)*time.Second, "Time to sleep between CR updates. zero means no CR updates on interval basis. [Default: 60s]") flagset.StringVar(&resourcemonitorArgs.Namespace, "watch-namespace", "*", diff --git a/cmd/nfd-worker/main.go b/cmd/nfd-worker/main.go index 20a259381..83ff12445 100644 --- a/cmd/nfd-worker/main.go +++ b/cmd/nfd-worker/main.go @@ -32,8 +32,7 @@ import ( const ( // ProgramName is the canonical name of this program - ProgramName = "nfd-worker" - GrpcHealthPort = 8082 + ProgramName = "nfd-worker" ) func main() { @@ -82,7 +81,6 @@ func main() { utils.ConfigureGrpcKlog() // Get new NfdWorker instance - args.GrpcHealthPort = GrpcHealthPort instance, err := worker.NewNfdWorker(worker.WithArgs(args)) if err != nil { klog.ErrorS(err, "failed to initialize NfdWorker instance") @@ -143,6 +141,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs) "Do not publish feature labels") flagset.IntVar(&args.MetricsPort, "metrics", 8081, "Port on which to expose metrics.") + flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082, + "Port on which to expose the grpc health endpoint.") flagset.StringVar(&args.Options, "options", "", "Specify config options from command line. Config options are specified "+ "in the same format as in the config file (i.e. json or yaml). These options") diff --git a/deployment/helm/node-feature-discovery/templates/master.yaml b/deployment/helm/node-feature-discovery/templates/master.yaml index 162f64f49..bb93e503c 100644 --- a/deployment/helm/node-feature-discovery/templates/master.yaml +++ b/deployment/helm/node-feature-discovery/templates/master.yaml @@ -109,6 +109,7 @@ spec: - "-feature-gates={{ $key }}={{ $value }}" {{- end }} - "-metrics={{ .Values.master.metricsPort | default "8081" }}" + - "-grpc-health={{ .Values.master.healthPort | default "8082" }}" volumeMounts: {{- if .Values.tls.enable }} - name: nfd-master-cert diff --git a/deployment/helm/node-feature-discovery/templates/topologyupdater.yaml b/deployment/helm/node-feature-discovery/templates/topologyupdater.yaml index b0b36265d..d76c427d6 100644 --- a/deployment/helm/node-feature-discovery/templates/topologyupdater.yaml +++ b/deployment/helm/node-feature-discovery/templates/topologyupdater.yaml @@ -85,6 +85,7 @@ spec: - "-kubelet-state-dir=" {{- end }} - -metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}} + - "-grpc-health={{ .Values.topologyUpdater.healthPort | default "8082" }}" ports: - name: metrics containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}} diff --git a/deployment/helm/node-feature-discovery/templates/worker.yaml b/deployment/helm/node-feature-discovery/templates/worker.yaml index fb19270d6..009cced9d 100644 --- a/deployment/helm/node-feature-discovery/templates/worker.yaml +++ b/deployment/helm/node-feature-discovery/templates/worker.yaml @@ -79,6 +79,7 @@ spec: - "-feature-gates={{ $key }}={{ $value }}" {{- end }} - "-metrics={{ .Values.worker.metricsPort | default "8081"}}" + - "-grpc-health={{ .Values.worker.healthPort | default "8082" }}" ports: - name: metrics containerPort: {{ .Values.worker.metricsPort | default "8081"}} diff --git a/deployment/helm/node-feature-discovery/values.yaml b/deployment/helm/node-feature-discovery/values.yaml index 2a4106c89..50ba5123f 100644 --- a/deployment/helm/node-feature-discovery/values.yaml +++ b/deployment/helm/node-feature-discovery/values.yaml @@ -57,6 +57,7 @@ master: # be removed with it in a future release port: 8080 metricsPort: 8081 + healthPort: 8082 instance: featureApi: resyncPeriod: @@ -402,6 +403,7 @@ worker: ### metricsPort: 8081 + healthPort: 8082 daemonsetAnnotations: {} podSecurityContext: {} # fsGroup: 2000 @@ -490,6 +492,7 @@ topologyUpdater: create: true metricsPort: 8081 + healthPort: 8082 kubeletConfigPath: kubeletPodResourcesSockPath: updateInterval: 60s diff --git a/docs/deployment/helm.md b/docs/deployment/helm.md index 1aa2347c4..279114aba 100644 --- a/docs/deployment/helm.md +++ b/docs/deployment/helm.md @@ -180,6 +180,7 @@ API's you need to install the prometheus operator in your cluster. | `master.enable` | bool | true | Specifies whether nfd-master should be deployed | | `master.port` | integer | | Specifies the TCP port that nfd-master listens for incoming requests. **NOTE**: this parameter is related to the deprecated gRPC API and will be removed with it in a future release | | `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator | +| `master.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint | | `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments | | `master.resyncPeriod` | string | | NFD API controller resync period. | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | @@ -215,6 +216,7 @@ API's you need to install the prometheus operator in your cluster. | `worker.*` | dict | | NFD worker daemonset configuration | | `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed | | `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator | +| `worker.healthPort` | int | 8082 | Port on which to expose the grpc health endpoint | | `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) | | `worker.podSecurityContext` | dict | {} | [PodSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) holds pod-level security attributes and common container settings | | `worker.securityContext` | dict | {} | Container [security settings](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | @@ -246,6 +248,7 @@ API's you need to install the prometheus operator in your cluster. | `topologyUpdater.serviceAccount.name` | string | | The name of the service account for topology updater to use. If not set and create is true, a name is generated using the fullname template and `-topology-updater` suffix | | `topologyUpdater.rbac.create` | bool | true | Specifies whether to create [RBAC][rbac] configuration for topology updater | | `topologyUpdater.metricsPort` | integer | 8081 | Port on which to expose prometheus metrics | +| `topologyUpdater.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint | | `topologyUpdater.kubeletConfigPath` | string | "" | Specifies the kubelet config host path | | `topologyUpdater.kubeletPodResourcesSockPath` | string | "" | Specifies the kubelet sock path to read pod resources | | `topologyUpdater.updateInterval` | string | 60s | Time to sleep between CR updates. Non-positive value implies no CR update. |