Skip to content

Commit d21153e

Browse files
authored
Merge pull request #871 from fariaass/chore/implement-diagnostics-fields
✨ Implement diagnostics fields in Providers CRD
2 parents ce47db5 + c9d5d72 commit d21153e

10 files changed

+356
-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
@@ -1432,7 +1432,19 @@ spec:
14321432
BindAddress is the TCP address that the controller should bind to
14331433
for serving prometheus metrics.
14341434
It can be set to "0" to disable the metrics serving.
1435+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14351436
type: string
1437+
diagnosticsAddress:
1438+
description: |-
1439+
DiagnosticsAddress is the TCP address that the controller should bind to
1440+
for serving prometheus metric.
1441+
It can be set to "0" to disable the metrics serving.
1442+
type: string
1443+
insecureDiagnostics:
1444+
description: |-
1445+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1446+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1447+
type: boolean
14361448
type: object
14371449
profilerAddress:
14381450
description: |-
@@ -2961,7 +2973,19 @@ spec:
29612973
BindAddress is the TCP address that the controller should bind to
29622974
for serving prometheus metrics.
29632975
It can be set to "0" to disable the metrics serving.
2976+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29642977
type: string
2978+
diagnosticsAddress:
2979+
description: |-
2980+
DiagnosticsAddress is the TCP address that the controller should bind to
2981+
for serving prometheus metric.
2982+
It can be set to "0" to disable the metrics serving.
2983+
type: string
2984+
insecureDiagnostics:
2985+
description: |-
2986+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2987+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2988+
type: boolean
29652989
type: object
29662990
profilerAddress:
29672991
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
@@ -1432,7 +1432,19 @@ spec:
14321432
BindAddress is the TCP address that the controller should bind to
14331433
for serving prometheus metrics.
14341434
It can be set to "0" to disable the metrics serving.
1435+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14351436
type: string
1437+
diagnosticsAddress:
1438+
description: |-
1439+
DiagnosticsAddress is the TCP address that the controller should bind to
1440+
for serving prometheus metric.
1441+
It can be set to "0" to disable the metrics serving.
1442+
type: string
1443+
insecureDiagnostics:
1444+
description: |-
1445+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1446+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1447+
type: boolean
14361448
type: object
14371449
profilerAddress:
14381450
description: |-
@@ -2961,7 +2973,19 @@ spec:
29612973
BindAddress is the TCP address that the controller should bind to
29622974
for serving prometheus metrics.
29632975
It can be set to "0" to disable the metrics serving.
2976+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29642977
type: string
2978+
diagnosticsAddress:
2979+
description: |-
2980+
DiagnosticsAddress is the TCP address that the controller should bind to
2981+
for serving prometheus metric.
2982+
It can be set to "0" to disable the metrics serving.
2983+
type: string
2984+
insecureDiagnostics:
2985+
description: |-
2986+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2987+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2988+
type: boolean
29652989
type: object
29662990
profilerAddress:
29672991
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
@@ -1433,7 +1433,19 @@ spec:
14331433
BindAddress is the TCP address that the controller should bind to
14341434
for serving prometheus metrics.
14351435
It can be set to "0" to disable the metrics serving.
1436+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14361437
type: string
1438+
diagnosticsAddress:
1439+
description: |-
1440+
DiagnosticsAddress is the TCP address that the controller should bind to
1441+
for serving prometheus metric.
1442+
It can be set to "0" to disable the metrics serving.
1443+
type: string
1444+
insecureDiagnostics:
1445+
description: |-
1446+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1447+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1448+
type: boolean
14371449
type: object
14381450
profilerAddress:
14391451
description: |-
@@ -2962,7 +2974,19 @@ spec:
29622974
BindAddress is the TCP address that the controller should bind to
29632975
for serving prometheus metrics.
29642976
It can be set to "0" to disable the metrics serving.
2977+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29652978
type: string
2979+
diagnosticsAddress:
2980+
description: |-
2981+
DiagnosticsAddress is the TCP address that the controller should bind to
2982+
for serving prometheus metric.
2983+
It can be set to "0" to disable the metrics serving.
2984+
type: string
2985+
insecureDiagnostics:
2986+
description: |-
2987+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2988+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2989+
type: boolean
29662990
type: object
29672991
profilerAddress:
29682992
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
@@ -1432,7 +1432,19 @@ spec:
14321432
BindAddress is the TCP address that the controller should bind to
14331433
for serving prometheus metrics.
14341434
It can be set to "0" to disable the metrics serving.
1435+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14351436
type: string
1437+
diagnosticsAddress:
1438+
description: |-
1439+
DiagnosticsAddress is the TCP address that the controller should bind to
1440+
for serving prometheus metric.
1441+
It can be set to "0" to disable the metrics serving.
1442+
type: string
1443+
insecureDiagnostics:
1444+
description: |-
1445+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1446+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1447+
type: boolean
14361448
type: object
14371449
profilerAddress:
14381450
description: |-
@@ -2961,7 +2973,19 @@ spec:
29612973
BindAddress is the TCP address that the controller should bind to
29622974
for serving prometheus metrics.
29632975
It can be set to "0" to disable the metrics serving.
2976+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29642977
type: string
2978+
diagnosticsAddress:
2979+
description: |-
2980+
DiagnosticsAddress is the TCP address that the controller should bind to
2981+
for serving prometheus metric.
2982+
It can be set to "0" to disable the metrics serving.
2983+
type: string
2984+
insecureDiagnostics:
2985+
description: |-
2986+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2987+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2988+
type: boolean
29652989
type: object
29662990
profilerAddress:
29672991
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
@@ -1433,7 +1433,19 @@ spec:
14331433
BindAddress is the TCP address that the controller should bind to
14341434
for serving prometheus metrics.
14351435
It can be set to "0" to disable the metrics serving.
1436+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14361437
type: string
1438+
diagnosticsAddress:
1439+
description: |-
1440+
DiagnosticsAddress is the TCP address that the controller should bind to
1441+
for serving prometheus metric.
1442+
It can be set to "0" to disable the metrics serving.
1443+
type: string
1444+
insecureDiagnostics:
1445+
description: |-
1446+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1447+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1448+
type: boolean
14371449
type: object
14381450
profilerAddress:
14391451
description: |-
@@ -2962,7 +2974,19 @@ spec:
29622974
BindAddress is the TCP address that the controller should bind to
29632975
for serving prometheus metrics.
29642976
It can be set to "0" to disable the metrics serving.
2977+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29652978
type: string
2979+
diagnosticsAddress:
2980+
description: |-
2981+
DiagnosticsAddress is the TCP address that the controller should bind to
2982+
for serving prometheus metric.
2983+
It can be set to "0" to disable the metrics serving.
2984+
type: string
2985+
insecureDiagnostics:
2986+
description: |-
2987+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2988+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2989+
type: boolean
29662990
type: object
29672991
profilerAddress:
29682992
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
@@ -1432,7 +1432,19 @@ spec:
14321432
BindAddress is the TCP address that the controller should bind to
14331433
for serving prometheus metrics.
14341434
It can be set to "0" to disable the metrics serving.
1435+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14351436
type: string
1437+
diagnosticsAddress:
1438+
description: |-
1439+
DiagnosticsAddress is the TCP address that the controller should bind to
1440+
for serving prometheus metric.
1441+
It can be set to "0" to disable the metrics serving.
1442+
type: string
1443+
insecureDiagnostics:
1444+
description: |-
1445+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1446+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1447+
type: boolean
14361448
type: object
14371449
profilerAddress:
14381450
description: |-
@@ -2961,7 +2973,19 @@ spec:
29612973
BindAddress is the TCP address that the controller should bind to
29622974
for serving prometheus metrics.
29632975
It can be set to "0" to disable the metrics serving.
2976+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29642977
type: string
2978+
diagnosticsAddress:
2979+
description: |-
2980+
DiagnosticsAddress is the TCP address that the controller should bind to
2981+
for serving prometheus metric.
2982+
It can be set to "0" to disable the metrics serving.
2983+
type: string
2984+
insecureDiagnostics:
2985+
description: |-
2986+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2987+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2988+
type: boolean
29652989
type: object
29662990
profilerAddress:
29672991
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
@@ -1434,7 +1434,19 @@ spec:
14341434
BindAddress is the TCP address that the controller should bind to
14351435
for serving prometheus metrics.
14361436
It can be set to "0" to disable the metrics serving.
1437+
NOTE: This field is deprecated, please use DiagnosticsAddress field
14371438
type: string
1439+
diagnosticsAddress:
1440+
description: |-
1441+
DiagnosticsAddress is the TCP address that the controller should bind to
1442+
for serving prometheus metric.
1443+
It can be set to "0" to disable the metrics serving.
1444+
type: string
1445+
insecureDiagnostics:
1446+
description: |-
1447+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
1448+
If false, or not set, the diagnostics address will expose pprof endpoints too.
1449+
type: boolean
14381450
type: object
14391451
profilerAddress:
14401452
description: |-
@@ -2963,7 +2975,19 @@ spec:
29632975
BindAddress is the TCP address that the controller should bind to
29642976
for serving prometheus metrics.
29652977
It can be set to "0" to disable the metrics serving.
2978+
NOTE: This field is deprecated, please use DiagnosticsAddress field
29662979
type: string
2980+
diagnosticsAddress:
2981+
description: |-
2982+
DiagnosticsAddress is the TCP address that the controller should bind to
2983+
for serving prometheus metric.
2984+
It can be set to "0" to disable the metrics serving.
2985+
type: string
2986+
insecureDiagnostics:
2987+
description: |-
2988+
InsecureDiagnostics indicates if insecure metrics serving should be enabled.
2989+
If false, or not set, the diagnostics address will expose pprof endpoints too.
2990+
type: boolean
29672991
type: object
29682992
profilerAddress:
29692993
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)