Skip to content

Commit 7cbd210

Browse files
committed
default the job to match latest featuregates
1 parent 2791ec7 commit 7cbd210

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

manifests/03-clusterrole.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,22 @@ rules:
5858
- clusteroperators
5959
- clusteroperators/status
6060
- insightsdatagathers
61-
- featuregates
6261
verbs:
6362
- create
6463
- get
6564
- update
6665
- patch
6766
- list
6867
- watch
68+
- apiGroups:
69+
- "config.openshift.io"
70+
resources:
71+
- clusterversions
72+
- featuregates
73+
verbs:
74+
- get
75+
- list
76+
- watch
6977
# allow the operator to retrieve prometheus metrics
7078
- apiGroups:
7179
- ""

pkg/cmd/start/start.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package start
33
import (
44
"context"
55
"fmt"
6-
"github.com/openshift/library-go/pkg/operator/events"
76
"math/rand"
87
"os"
98
"time"
@@ -13,6 +12,7 @@ import (
1312
configv1informers "github.com/openshift/client-go/config/informers/externalversions"
1413
"github.com/openshift/library-go/pkg/controller/controllercmd"
1514
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
15+
"github.com/openshift/library-go/pkg/operator/events"
1616
"github.com/openshift/library-go/pkg/serviceability"
1717

1818
"github.com/spf13/cobra"
@@ -127,8 +127,11 @@ func runGather(operator *controller.GatherJob, cfg *controllercmd.ControllerComm
127127
}
128128
configInformers := configv1informers.NewSharedInformerFactory(configClient, 10*time.Minute)
129129

130-
desiredVersion := os.Getenv("RELEASE_VERSION")
131130
missingVersion := "0.0.1-snapshot"
131+
desiredVersion := missingVersion
132+
if envVersion, exists := os.LookupEnv("RELEASE_VERSION"); exists {
133+
desiredVersion = envVersion
134+
}
132135

133136
// By default, this will exit(0) the process if the featuregates ever change to a different set of values.
134137
featureGateAccessor := featuregates.NewFeatureGateAccess(

0 commit comments

Comments
 (0)