Skip to content

Commit 220ac10

Browse files
committed
metrics: Maintain legacy TLS profile in HyperShift
To be fixed after the hosted control plane components propagate the TLS profile to the CVO. To be done. In the meantime, maintain the previous logic.
1 parent 6286e45 commit 220ac10

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

pkg/cvo/metrics.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ type MetricsOptions struct {
341341

342342
DisableAuthentication bool
343343
DisableAuthorization bool
344+
345+
RespectCentralTLSProfile bool
344346
}
345347

346348
// RunMetrics launches an HTTPS server bound to listenAddress serving
@@ -481,12 +483,14 @@ func RunMetrics(runContext context.Context, shutdownContext context.Context, res
481483
return nil, err
482484
}
483485

484-
profile, err := getAPIServerTLSProfile(apiServerLister, lastValidProfile)
485-
if err != nil {
486-
return nil, fmt.Errorf("failed to get TLS profile for metrics server: %w", err)
486+
if options.RespectCentralTLSProfile {
487+
profile, err := getAPIServerTLSProfile(apiServerLister, lastValidProfile)
488+
if err != nil {
489+
return nil, fmt.Errorf("failed to get TLS profile for metrics server: %w", err)
490+
}
491+
lastValidProfile = profile
492+
profile.apply(config)
487493
}
488-
lastValidProfile = profile
489-
profile.apply(config)
490494

491495
return config, nil
492496
},

pkg/start/start.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ func (o *Options) ValidateAndComplete() error {
162162
o.MetricsOptions.DisableAuthorization = o.HyperShift
163163
o.MetricsOptions.DisableAuthentication = o.HyperShift
164164

165+
// Continue functioning the same way in HyperShift, as the CVO is in the management cluster
166+
o.MetricsOptions.RespectCentralTLSProfile = !o.HyperShift
167+
165168
if err := validateCapabilities(o.AlwaysEnableCapabilities); err != nil {
166169
return fmt.Errorf("--always-enable-capabilities: %w", err)
167170
}

0 commit comments

Comments
 (0)