Skip to content

Commit 530bedd

Browse files
authored
Merge pull request #1885 from tobiasgiese/health-port-arg
Add parameter to configure health endpoint port
2 parents d858501 + 53ddf08 commit 530bedd

File tree

8 files changed

+31
-22
lines changed

8 files changed

+31
-22
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() {
@@ -108,7 +107,6 @@ func main() {
108107
utils.ConfigureGrpcKlog()
109108

110109
// Get new NfdMaster instance
111-
args.GrpcHealthPort = GrpcHealthPort
112110
instance, err := master.NewNfdMaster(master.WithArgs(args))
113111
if err != nil {
114112
klog.ErrorS(err, "failed to initialize NfdMaster instance")
@@ -149,6 +147,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
149147
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
150148
flagset.IntVar(&args.MetricsPort, "metrics", 8081,
151149
"Port on which to expose metrics.")
150+
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
151+
"Port on which to expose the grpc health endpoint.")
152152
flagset.BoolVar(&args.Prune, "prune", false,
153153
"Prune all NFD related attributes from all nodes of the cluster and exit.")
154154
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() {
@@ -80,7 +79,6 @@ func main() {
8079
utils.ConfigureGrpcKlog()
8180

8281
// Get new NfdWorker instance
83-
args.GrpcHealthPort = GrpcHealthPort
8482
instance, err := worker.NewNfdWorker(worker.WithArgs(args))
8583
if err != nil {
8684
klog.ErrorS(err, "failed to initialize NfdWorker instance")
@@ -138,6 +136,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
138136
"Do not publish feature labels")
139137
flagset.IntVar(&args.MetricsPort, "metrics", 8081,
140138
"Port on which to expose metrics.")
139+
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
140+
"Port on which to expose the grpc health endpoint.")
141141
flagset.StringVar(&args.Options, "options", "",
142142
"Specify config options from command line. Config options are specified "+
143143
"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
@@ -116,6 +116,7 @@ spec:
116116
- "-feature-gates={{ $key }}={{ $value }}"
117117
{{- end }}
118118
- "-metrics={{ .Values.master.metricsPort | default "8081" }}"
119+
- "-grpc-health={{ .Values.master.healthPort | default "8082" }}"
119120
{{- with .Values.master.extraArgs }}
120121
{{- toYaml . | nindent 12 }}
121122
{{- end }}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ spec:
8989
# Disable kubelet state tracking by giving an empty path
9090
- "-kubelet-state-dir="
9191
{{- end }}
92-
- -metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}}
92+
- "-metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}}"
93+
- "-grpc-health={{ .Values.topologyUpdater.healthPort | default "8082" }}"
9394
{{- with .Values.topologyUpdater.extraArgs }}
9495
{{- toYaml . | nindent 10 }}
9596
{{- end }}

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,20 @@ spec:
7171
command:
7272
- "nfd-worker"
7373
args:
74-
{{- if not .Values.featureGates.NodeFeatureAPI }}
74+
{{- if not .Values.featureGates.NodeFeatureAPI }}
7575
- "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}"
76-
{{- end }}
77-
{{- if .Values.tls.enable }}
76+
{{- end }}
77+
{{- if .Values.tls.enable }}
7878
- "-ca-file=/etc/kubernetes/node-feature-discovery/certs/ca.crt"
7979
- "-key-file=/etc/kubernetes/node-feature-discovery/certs/tls.key"
8080
- "-cert-file=/etc/kubernetes/node-feature-discovery/certs/tls.crt"
81-
{{- end }}
82-
# Go over featureGate and add the feature-gate flag
83-
{{- range $key, $value := .Values.featureGates }}
81+
{{- end }}
82+
# Go over featureGate and add the feature-gate flag
83+
{{- range $key, $value := .Values.featureGates }}
8484
- "-feature-gates={{ $key }}={{ $value }}"
85-
{{- end }}
85+
{{- end }}
8686
- "-metrics={{ .Values.worker.metricsPort | default "8081"}}"
87+
- "-grpc-health={{ .Values.worker.healthPort | default "8082" }}"
8788
{{- with .Values.gc.extraArgs }}
8889
{{- toYaml . | nindent 8 }}
8990
{{- end }}
@@ -125,11 +126,11 @@ spec:
125126
- name: nfd-worker-conf
126127
mountPath: "/etc/kubernetes/node-feature-discovery"
127128
readOnly: true
128-
{{- if .Values.tls.enable }}
129+
{{- if .Values.tls.enable }}
129130
- name: nfd-worker-cert
130131
mountPath: "/etc/kubernetes/node-feature-discovery/certs"
131132
readOnly: true
132-
{{- end }}
133+
{{- end }}
133134
volumes:
134135
- name: host-boot
135136
hostPath:
@@ -166,12 +167,12 @@ spec:
166167
items:
167168
- key: nfd-worker.conf
168169
path: nfd-worker.conf
169-
{{- if .Values.tls.enable }}
170+
{{- if .Values.tls.enable }}
170171
- name: nfd-worker-cert
171172
secret:
172173
secretName: nfd-worker-cert
173-
{{- end }}
174-
{{- with .Values.worker.nodeSelector }}
174+
{{- end }}
175+
{{- with .Values.worker.nodeSelector }}
175176
nodeSelector:
176177
{{- toYaml . | nindent 8 }}
177178
{{- end }}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ master:
5858
# be removed with it in a future release
5959
port: 8080
6060
metricsPort: 8081
61+
healthPort: 8082
6162
instance:
6263
featureApi:
6364
resyncPeriod:
@@ -406,6 +407,7 @@ worker:
406407
### <NFD-WORKER-CONF-END-DO-NOT-REMOVE>
407408

408409
metricsPort: 8081
410+
healthPort: 8082
409411
daemonsetAnnotations: {}
410412
podSecurityContext: {}
411413
# fsGroup: 2000
@@ -497,6 +499,7 @@ topologyUpdater:
497499
create: true
498500

499501
metricsPort: 8081
502+
healthPort: 8082
500503
kubeletConfigPath:
501504
kubeletPodResourcesSockPath:
502505
updateInterval: 60s

docs/deployment/helm.md

Lines changed: 4 additions & 1 deletion
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.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
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 |
@@ -217,7 +218,8 @@ API's you need to install the prometheus operator in your cluster.
217218
| `worker.*` | dict | | NFD worker daemonset configuration |
218219
| `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed |
219220
| `worker.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
220-
| `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
221+
| `worker.metricsPort` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
222+
| `worker.healthPort` | int | 8082 | Port on which to expose the grpc health endpoint |
221223
| `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) |
222224
| `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 settins |
223225
| `worker.securityContext` | dict | {} | Container [security settings](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
@@ -252,6 +254,7 @@ API's you need to install the prometheus operator in your cluster.
252254
| `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 |
253255
| `topologyUpdater.rbac.create` | bool | true | Specifies whether to create [RBAC][rbac] configuration for topology updater |
254256
| `topologyUpdater.metricsPort` | integer | 8081 | Port on which to expose prometheus metrics |
257+
| `topologyUpdater.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
255258
| `topologyUpdater.kubeletConfigPath` | string | "" | Specifies the kubelet config host path |
256259
| `topologyUpdater.kubeletPodResourcesSockPath` | string | "" | Specifies the kubelet sock path to read pod resources |
257260
| `topologyUpdater.updateInterval` | string | 60s | Time to sleep between CR updates. Non-positive value implies no CR update. |

0 commit comments

Comments
 (0)