Skip to content

Commit cdf6910

Browse files
author
Lucas de Farias Teixeira
committed
chore: implement diagnostics fields
1 parent 0d08400 commit cdf6910

9 files changed

+188
-0
lines changed

api/v1alpha2/controllermanagerconfig_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,20 @@ type ControllerMetrics struct {
104104
// BindAddress is the TCP address that the controller should bind to
105105
// for serving prometheus metrics.
106106
// It can be set to "0" to disable the metrics serving.
107+
// NOTE: This field is deprecated, please use DiagnosticsAddress field
107108
// +optional
108109
BindAddress string `json:"bindAddress,omitempty"`
110+
111+
// DiagnosticsAddress is the TCP address that the controller should bind to
112+
// for serving prometheus metric.
113+
// It can be set to "0" to disable the metrics serving.
114+
// +optional
115+
DiagnosticsAddress string `json:"diagnosticsAddress,omitempty"`
116+
117+
// InsecureDiagnostics indicates if insecure metrics serving should be enabled.
118+
// If false, or not set, the diagnostics address will expose pprof endpoints too.
119+
// +optional
120+
InsecureDiagnostics bool `json:"insecureDiagnostics,omitempty"`
109121
}
110122

111123
// ControllerHealth defines the health configs.

config/crd/bases/operator.cluster.x-k8s.io_addonproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,19 @@ spec:
14401440
BindAddress is the TCP address that the controller should bind to
14411441
for serving prometheus metrics.
14421442
It can be set to "0" to disable the metrics serving.
1443+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14431444
type: string
1445+
diagnosticsAddress:
1446+
description: |-
1447+
DiagnosticsAddress is the TCP address that the controller should bind to
1448+
for serving prometheus metric.
1449+
It can be set to "0" to disable the metrics serving.
1450+
type: string
1451+
insecureDiagnostics:
1452+
description: |-
1453+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1454+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1455+
type: boolean
14441456
type: object
14451457
profilerAddress:
14461458
description: |-
@@ -2977,7 +2989,19 @@ spec:
29772989
BindAddress is the TCP address that the controller should bind to
29782990
for serving prometheus metrics.
29792991
It can be set to "0" to disable the metrics serving.
2992+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29802993
type: string
2994+
diagnosticsAddress:
2995+
description: |-
2996+
DiagnosticsAddress is the TCP address that the controller should bind to
2997+
for serving prometheus metric.
2998+
It can be set to "0" to disable the metrics serving.
2999+
type: string
3000+
insecureDiagnostics:
3001+
description: |-
3002+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3003+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3004+
type: boolean
29813005
type: object
29823006
profilerAddress:
29833007
description: |-

config/crd/bases/operator.cluster.x-k8s.io_bootstrapproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,19 @@ spec:
14401440
BindAddress is the TCP address that the controller should bind to
14411441
for serving prometheus metrics.
14421442
It can be set to "0" to disable the metrics serving.
1443+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14431444
type: string
1445+
diagnosticsAddress:
1446+
description: |-
1447+
DiagnosticsAddress is the TCP address that the controller should bind to
1448+
for serving prometheus metric.
1449+
It can be set to "0" to disable the metrics serving.
1450+
type: string
1451+
insecureDiagnostics:
1452+
description: |-
1453+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1454+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1455+
type: boolean
14441456
type: object
14451457
profilerAddress:
14461458
description: |-
@@ -2977,7 +2989,19 @@ spec:
29772989
BindAddress is the TCP address that the controller should bind to
29782990
for serving prometheus metrics.
29792991
It can be set to "0" to disable the metrics serving.
2992+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29802993
type: string
2994+
diagnosticsAddress:
2995+
description: |-
2996+
DiagnosticsAddress is the TCP address that the controller should bind to
2997+
for serving prometheus metric.
2998+
It can be set to "0" to disable the metrics serving.
2999+
type: string
3000+
insecureDiagnostics:
3001+
description: |-
3002+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3003+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3004+
type: boolean
29813005
type: object
29823006
profilerAddress:
29833007
description: |-

config/crd/bases/operator.cluster.x-k8s.io_controlplaneproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,19 @@ spec:
14411441
BindAddress is the TCP address that the controller should bind to
14421442
for serving prometheus metrics.
14431443
It can be set to "0" to disable the metrics serving.
1444+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14441445
type: string
1446+
diagnosticsAddress:
1447+
description: |-
1448+
DiagnosticsAddress is the TCP address that the controller should bind to
1449+
for serving prometheus metric.
1450+
It can be set to "0" to disable the metrics serving.
1451+
type: string
1452+
insecureDiagnostics:
1453+
description: |-
1454+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1455+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1456+
type: boolean
14451457
type: object
14461458
profilerAddress:
14471459
description: |-
@@ -2978,7 +2990,19 @@ spec:
29782990
BindAddress is the TCP address that the controller should bind to
29792991
for serving prometheus metrics.
29802992
It can be set to "0" to disable the metrics serving.
2993+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29812994
type: string
2995+
diagnosticsAddress:
2996+
description: |-
2997+
DiagnosticsAddress is the TCP address that the controller should bind to
2998+
for serving prometheus metric.
2999+
It can be set to "0" to disable the metrics serving.
3000+
type: string
3001+
insecureDiagnostics:
3002+
description: |-
3003+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3004+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3005+
type: boolean
29823006
type: object
29833007
profilerAddress:
29843008
description: |-

config/crd/bases/operator.cluster.x-k8s.io_coreproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,19 @@ spec:
14401440
BindAddress is the TCP address that the controller should bind to
14411441
for serving prometheus metrics.
14421442
It can be set to "0" to disable the metrics serving.
1443+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14431444
type: string
1445+
diagnosticsAddress:
1446+
description: |-
1447+
DiagnosticsAddress is the TCP address that the controller should bind to
1448+
for serving prometheus metric.
1449+
It can be set to "0" to disable the metrics serving.
1450+
type: string
1451+
insecureDiagnostics:
1452+
description: |-
1453+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1454+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1455+
type: boolean
14441456
type: object
14451457
profilerAddress:
14461458
description: |-
@@ -2977,7 +2989,19 @@ spec:
29772989
BindAddress is the TCP address that the controller should bind to
29782990
for serving prometheus metrics.
29792991
It can be set to "0" to disable the metrics serving.
2992+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29802993
type: string
2994+
diagnosticsAddress:
2995+
description: |-
2996+
DiagnosticsAddress is the TCP address that the controller should bind to
2997+
for serving prometheus metric.
2998+
It can be set to "0" to disable the metrics serving.
2999+
type: string
3000+
insecureDiagnostics:
3001+
description: |-
3002+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3003+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3004+
type: boolean
29813005
type: object
29823006
profilerAddress:
29833007
description: |-

config/crd/bases/operator.cluster.x-k8s.io_infrastructureproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,19 @@ spec:
14411441
BindAddress is the TCP address that the controller should bind to
14421442
for serving prometheus metrics.
14431443
It can be set to "0" to disable the metrics serving.
1444+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14441445
type: string
1446+
diagnosticsAddress:
1447+
description: |-
1448+
DiagnosticsAddress is the TCP address that the controller should bind to
1449+
for serving prometheus metric.
1450+
It can be set to "0" to disable the metrics serving.
1451+
type: string
1452+
insecureDiagnostics:
1453+
description: |-
1454+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1455+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1456+
type: boolean
14451457
type: object
14461458
profilerAddress:
14471459
description: |-
@@ -2978,7 +2990,19 @@ spec:
29782990
BindAddress is the TCP address that the controller should bind to
29792991
for serving prometheus metrics.
29802992
It can be set to "0" to disable the metrics serving.
2993+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29812994
type: string
2995+
diagnosticsAddress:
2996+
description: |-
2997+
DiagnosticsAddress is the TCP address that the controller should bind to
2998+
for serving prometheus metric.
2999+
It can be set to "0" to disable the metrics serving.
3000+
type: string
3001+
insecureDiagnostics:
3002+
description: |-
3003+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3004+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3005+
type: boolean
29823006
type: object
29833007
profilerAddress:
29843008
description: |-

config/crd/bases/operator.cluster.x-k8s.io_ipamproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,19 @@ spec:
14401440
BindAddress is the TCP address that the controller should bind to
14411441
for serving prometheus metrics.
14421442
It can be set to "0" to disable the metrics serving.
1443+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14431444
type: string
1445+
diagnosticsAddress:
1446+
description: |-
1447+
DiagnosticsAddress is the TCP address that the controller should bind to
1448+
for serving prometheus metric.
1449+
It can be set to "0" to disable the metrics serving.
1450+
type: string
1451+
insecureDiagnostics:
1452+
description: |-
1453+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1454+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1455+
type: boolean
14441456
type: object
14451457
profilerAddress:
14461458
description: |-
@@ -2977,7 +2989,19 @@ spec:
29772989
BindAddress is the TCP address that the controller should bind to
29782990
for serving prometheus metrics.
29792991
It can be set to "0" to disable the metrics serving.
2992+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29802993
type: string
2994+
diagnosticsAddress:
2995+
description: |-
2996+
DiagnosticsAddress is the TCP address that the controller should bind to
2997+
for serving prometheus metric.
2998+
It can be set to "0" to disable the metrics serving.
2999+
type: string
3000+
insecureDiagnostics:
3001+
description: |-
3002+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3003+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3004+
type: boolean
29813005
type: object
29823006
profilerAddress:
29833007
description: |-

config/crd/bases/operator.cluster.x-k8s.io_runtimeextensionproviders.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,19 @@ spec:
14421442
BindAddress is the TCP address that the controller should bind to
14431443
for serving prometheus metrics.
14441444
It can be set to "0" to disable the metrics serving.
1445+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14451446
type: string
1447+
diagnosticsAddress:
1448+
description: |-
1449+
DiagnosticsAddress is the TCP address that the controller should bind to
1450+
for serving prometheus metric.
1451+
It can be set to "0" to disable the metrics serving.
1452+
type: string
1453+
insecureDiagnostics:
1454+
description: |-
1455+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1456+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1457+
type: boolean
14461458
type: object
14471459
profilerAddress:
14481460
description: |-
@@ -2979,7 +2991,19 @@ spec:
29792991
BindAddress is the TCP address that the controller should bind to
29802992
for serving prometheus metrics.
29812993
It can be set to "0" to disable the metrics serving.
2994+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29822995
type: string
2996+
diagnosticsAddress:
2997+
description: |-
2998+
DiagnosticsAddress is the TCP address that the controller should bind to
2999+
for serving prometheus metric.
3000+
It can be set to "0" to disable the metrics serving.
3001+
type: string
3002+
insecureDiagnostics:
3003+
description: |-
3004+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
3005+
If false, or not set, the diagnostics address will expose pprof endpoints too.
3006+
type: boolean
29833007
type: object
29843008
profilerAddress:
29853009
description: |-

internal/controller/component_customizer.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controller
1919
import (
2020
"fmt"
2121
"sort"
22+
"strconv"
2223
"strings"
2324
"time"
2425

@@ -232,10 +233,17 @@ func customizeManagerContainer(mSpec *operatorv1.ManagerSpec, c *corev1.Containe
232233
c.Args = leaderElectionArgs(mSpec.LeaderElection, c.Args)
233234
}
234235

236+
// metrics
235237
if mSpec.Metrics.BindAddress != "" {
236238
c.Args = setArgs(c.Args, "--metrics-bind-addr", mSpec.Metrics.BindAddress)
237239
}
238240

241+
if mSpec.Metrics.DiagnosticsAddress != "" {
242+
c.Args = setArgs(c.Args, "--diagnostics-address", mSpec.Metrics.DiagnosticsAddress)
243+
}
244+
245+
c.Args = setArgs(c.Args, "--insecure-diagnostics", strconv.FormatBool(mSpec.Metrics.InsecureDiagnostics))
246+
239247
// webhooks
240248
if mSpec.Webhook.Host != "" {
241249
c.Args = setArgs(c.Args, "--webhook-host", mSpec.Webhook.Host)

0 commit comments

Comments
 (0)