@@ -18,7 +18,6 @@ import (
18
18
"context"
19
19
"crypto/x509/pkix"
20
20
"fmt"
21
- "os"
22
21
"strings"
23
22
"time"
24
23
@@ -220,7 +219,7 @@ func New(
220
219
return nil , err
221
220
}
222
221
223
- c , err := client .NewForConfig (config , version , namespace , namespaceUserWorkload , client .KubernetesClient (kclient ), client .EventRecorder (eventRecorder ))
222
+ c , err := client .NewForConfig (config , version , namespace , namespaceUserWorkload , client .KubernetesClient (kclient ), client .OpenshiftConfigClient ( configClient ), client . EventRecorder (eventRecorder ))
224
223
if err != nil {
225
224
return nil , err
226
225
}
@@ -414,14 +413,12 @@ func New(
414
413
415
414
configInformers := configv1informers .NewSharedInformerFactory (configClient , 10 * time .Minute )
416
415
missingVersion := "0.0.1-snapshot"
417
- desiredVersion := missingVersion
418
- if envVersion , exists := os .LookupEnv ("RELEASE_VERSION" ); exists {
419
- desiredVersion = envVersion
420
- }
421
416
422
- // By default, this will exit(0) if the featuregates change
417
+ // By default when the enabled/disabled list of featuregates changes,
418
+ // os.Exit is called which will trigger a restart of the container and
419
+ // the new container will get the updated value.
423
420
featureGateAccessor := featuregates .NewFeatureGateAccess (
424
- desiredVersion , missingVersion ,
421
+ version , missingVersion ,
425
422
configInformers .Config ().V1 ().ClusterVersions (),
426
423
configInformers .Config ().V1 ().FeatureGates (),
427
424
eventRecorder ,
@@ -431,19 +428,18 @@ func New(
431
428
432
429
select {
433
430
case <- featureGateAccessor .InitialFeatureGatesObserved ():
434
- featureGates , _ := featureGateAccessor .CurrentFeatureGates ()
435
- klog .Infof ("FeatureGates initialized: %v" , featureGates .KnownFeatures ())
431
+ featureGates , err := featureGateAccessor .CurrentFeatureGates ()
432
+ if err != nil {
433
+ return nil , err
434
+ }
435
+ o .metricsServerEnabled = featureGates .Enabled (configv1 .FeatureGateMetricsServer )
436
436
case <- time .After (1 * time .Minute ):
437
- klog .Errorf ("timed out waiting for FeatureGate detection" )
438
437
return nil , fmt .Errorf ("timed out waiting for FeatureGate detection" )
439
438
}
440
439
441
- featureGates , err := featureGateAccessor .CurrentFeatureGates ()
442
- if err != nil {
443
- return nil , err
440
+ if o .metricsServerEnabled {
441
+ klog .Info ("Metrics Server enabled" )
444
442
}
445
- // read featuregate read and usage to set a variable to pass to a controller
446
- o .metricsServerEnabled = featureGates .Enabled (configv1 .FeatureGateMetricsServer )
447
443
448
444
// csrController runs a controller that requests a client TLS certificate
449
445
// for Prometheus k8s. This certificate is used to authenticate against the
0 commit comments