Skip to content

Commit 61760b2

Browse files
tobiasgiesemarquiz
authored andcommitted
Add parameter to configure health endpoint port
Signed-off-by: Tobias Giese <[email protected]> (cherry picked from commit 53ddf08)
1 parent b3b3059 commit 61760b2

File tree

8 files changed

+17
-8
lines changed

8 files changed

+17
-8
lines changed

cmd/nfd-master/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ import (
3333

3434
const (
3535
// ProgramName is the canonical name of this program
36-
ProgramName = "nfd-master"
37-
GrpcHealthPort = 8082
36+
ProgramName = "nfd-master"
3837
)
3938

4039
func main() {
@@ -110,7 +109,6 @@ func main() {
110109
utils.ConfigureGrpcKlog()
111110

112111
// Get new NfdMaster instance
113-
args.GrpcHealthPort = GrpcHealthPort
114112
instance, err := master.NewNfdMaster(master.WithArgs(args))
115113
if err != nil {
116114
klog.ErrorS(err, "failed to initialize NfdMaster instance")
@@ -154,6 +152,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
154152
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
155153
flagset.IntVar(&args.MetricsPort, "metrics", 8081,
156154
"Port on which to expose metrics.")
155+
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
156+
"Port on which to expose the grpc health endpoint.")
157157
flagset.BoolVar(&args.Prune, "prune", false,
158158
"Prune all NFD related attributes from all nodes of the cluster and exit.")
159159
flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false,

cmd/nfd-topology-updater/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const (
3838
// ProgramName is the canonical name of this program
3939
ProgramName = "nfd-topology-updater"
4040
kubeletSecurePort = 10250
41-
GrpcHealthPort = 8082
4241
)
4342

4443
var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet")
@@ -57,7 +56,6 @@ func main() {
5756
utils.ConfigureGrpcKlog()
5857

5958
// Get new TopologyUpdater instance
60-
args.GrpcHealthPort = GrpcHealthPort
6159
instance, err := topology.NewTopologyUpdater(*args, *resourcemonitorArgs)
6260
if err != nil {
6361
klog.ErrorS(err, "failed to initialize topology updater instance")
@@ -115,6 +113,8 @@ func initFlags(flagset *flag.FlagSet) (*topology.Args, *resourcemonitor.Args) {
115113
"Kube config file.")
116114
flagset.IntVar(&args.MetricsPort, "metrics", 8081,
117115
"Port on which to expose metrics.")
116+
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
117+
"Port on which to expose the grpc health endpoint.")
118118
flagset.DurationVar(&resourcemonitorArgs.SleepInterval, "sleep-interval", time.Duration(60)*time.Second,
119119
"Time to sleep between CR updates. zero means no CR updates on interval basis. [Default: 60s]")
120120
flagset.StringVar(&resourcemonitorArgs.Namespace, "watch-namespace", "*",

cmd/nfd-worker/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ import (
3232

3333
const (
3434
// ProgramName is the canonical name of this program
35-
ProgramName = "nfd-worker"
36-
GrpcHealthPort = 8082
35+
ProgramName = "nfd-worker"
3736
)
3837

3938
func main() {
@@ -82,7 +81,6 @@ func main() {
8281
utils.ConfigureGrpcKlog()
8382

8483
// Get new NfdWorker instance
85-
args.GrpcHealthPort = GrpcHealthPort
8684
instance, err := worker.NewNfdWorker(worker.WithArgs(args))
8785
if err != nil {
8886
klog.ErrorS(err, "failed to initialize NfdWorker instance")
@@ -143,6 +141,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
143141
"Do not publish feature labels")
144142
flagset.IntVar(&args.MetricsPort, "metrics", 8081,
145143
"Port on which to expose metrics.")
144+
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
145+
"Port on which to expose the grpc health endpoint.")
146146
flagset.StringVar(&args.Options, "options", "",
147147
"Specify config options from command line. Config options are specified "+
148148
"in the same format as in the config file (i.e. json or yaml). These options")

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ spec:
109109
- "-feature-gates={{ $key }}={{ $value }}"
110110
{{- end }}
111111
- "-metrics={{ .Values.master.metricsPort | default "8081" }}"
112+
- "-grpc-health={{ .Values.master.healthPort | default "8082" }}"
112113
volumeMounts:
113114
{{- if .Values.tls.enable }}
114115
- name: nfd-master-cert

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ spec:
8585
- "-kubelet-state-dir="
8686
{{- end }}
8787
- -metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}}
88+
- "-grpc-health={{ .Values.topologyUpdater.healthPort | default "8082" }}"
8889
ports:
8990
- name: metrics
9091
containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ spec:
7979
- "-feature-gates={{ $key }}={{ $value }}"
8080
{{- end }}
8181
- "-metrics={{ .Values.worker.metricsPort | default "8081"}}"
82+
- "-grpc-health={{ .Values.worker.healthPort | default "8082" }}"
8283
ports:
8384
- name: metrics
8485
containerPort: {{ .Values.worker.metricsPort | default "8081"}}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ master:
5757
# be removed with it in a future release
5858
port: 8080
5959
metricsPort: 8081
60+
healthPort: 8082
6061
instance:
6162
featureApi:
6263
resyncPeriod:
@@ -402,6 +403,7 @@ worker:
402403
### <NFD-WORKER-CONF-END-DO-NOT-REMOVE>
403404

404405
metricsPort: 8081
406+
healthPort: 8082
405407
daemonsetAnnotations: {}
406408
podSecurityContext: {}
407409
# fsGroup: 2000
@@ -490,6 +492,7 @@ topologyUpdater:
490492
create: true
491493

492494
metricsPort: 8081
495+
healthPort: 8082
493496
kubeletConfigPath:
494497
kubeletPodResourcesSockPath:
495498
updateInterval: 60s

docs/deployment/helm.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ API's you need to install the prometheus operator in your cluster.
180180
| `master.enable` | bool | true | Specifies whether nfd-master should be deployed |
181181
| `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 |
182182
| `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator |
183+
| `master.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
183184
| `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments |
184185
| `master.resyncPeriod` | string | | NFD API controller resync period. |
185186
| `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.
215216
| `worker.*` | dict | | NFD worker daemonset configuration |
216217
| `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed |
217218
| `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
219+
| `worker.healthPort` | int | 8082 | Port on which to expose the grpc health endpoint |
218220
| `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) |
219221
| `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 |
220222
| `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.
246248
| `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 |
247249
| `topologyUpdater.rbac.create` | bool | true | Specifies whether to create [RBAC][rbac] configuration for topology updater |
248250
| `topologyUpdater.metricsPort` | integer | 8081 | Port on which to expose prometheus metrics |
251+
| `topologyUpdater.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
249252
| `topologyUpdater.kubeletConfigPath` | string | "" | Specifies the kubelet config host path |
250253
| `topologyUpdater.kubeletPodResourcesSockPath` | string | "" | Specifies the kubelet sock path to read pod resources |
251254
| `topologyUpdater.updateInterval` | string | 60s | Time to sleep between CR updates. Non-positive value implies no CR update. |

0 commit comments

Comments
 (0)