Skip to content

Commit 2dd7e53

Browse files
committed
wip: no change in hypershift
1 parent 18158e8 commit 2dd7e53

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

pkg/cvo/metrics.go

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

340340
DisableAuthentication bool
341341
DisableAuthorization bool
342+
343+
RespectCentralTLSProfile bool
342344
}
343345

344346
// RunMetrics launches an HTTPS server bound to listenAddress serving
@@ -479,15 +481,14 @@ func RunMetrics(runContext context.Context, shutdownContext context.Context, res
479481
return nil, err
480482
}
481483

482-
// Fetch cluster TLS profile from APIServer resource (cached via lister, O(1) lookup)
483-
// and apply it to the config. This allows dynamic updates without CVO restart.
484-
// Fail closed if no valid profile is available (security).
485-
profile, err := getAPIServerTLSProfile(apiServerLister, lastValidProfile)
486-
if err != nil {
487-
return nil, fmt.Errorf("failed to get TLS profile for metrics server: %w", err)
484+
if options.RespectCentralTLSProfile {
485+
profile, err := getAPIServerTLSProfile(apiServerLister, lastValidProfile)
486+
if err != nil {
487+
return nil, fmt.Errorf("failed to get TLS profile for metrics server: %w", err)
488+
}
489+
lastValidProfile = profile
490+
profile.apply(config)
488491
}
489-
lastValidProfile = profile
490-
profile.apply(config)
491492

492493
return config, nil
493494
},

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)