Skip to content

Commit 13fd095

Browse files
committed
pkg: Add ClusterVersionOperatorConfiguration feature gate
Make the CVO aware of a new feature gate called ClusterVersionOperatorConfiguration, which was introduced in [1]. [1]: openshift/api#2044
1 parent c0e2ed3 commit 13fd095

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

pkg/cvo/status_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ type fakeRiFlags struct {
202202
unknownVersion bool
203203
reconciliationIssuesCondition bool
204204
statusReleaseArchitecture bool
205+
cvoConfiguration bool
205206
}
206207

207208
func (f fakeRiFlags) UnknownVersion() bool {
@@ -216,6 +217,10 @@ func (f fakeRiFlags) StatusReleaseArchitecture() bool {
216217
return f.statusReleaseArchitecture
217218
}
218219

220+
func (f fakeRiFlags) CVOConfiguration() bool {
221+
return f.cvoConfiguration
222+
}
223+
219224
func TestUpdateClusterVersionStatus_UnknownVersionAndReconciliationIssues(t *testing.T) {
220225
ignoreLastTransitionTime := cmpopts.IgnoreFields(configv1.ClusterOperatorStatusCondition{}, "LastTransitionTime")
221226

pkg/featuregates/featuregates.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ type CvoGateChecker interface {
2929
// StatusReleaseArchitecture controls whether CVO populates
3030
// Release.Architecture in status properties like status.desired and status.history[].
3131
StatusReleaseArchitecture() bool
32+
33+
// CVOConfiguration controls whether the CVO reconciles the ClusterVersionOperator resource that corresponds
34+
// to its configuration.
35+
CVOConfiguration() bool
3236
}
3337

3438
type panicOnUsageBeforeInitializationFunc func()
@@ -56,6 +60,11 @@ func (p panicOnUsageBeforeInitializationFunc) UnknownVersion() bool {
5660
return false
5761
}
5862

63+
func (p panicOnUsageBeforeInitializationFunc) CVOConfiguration() bool {
64+
p()
65+
return false
66+
}
67+
5968
// CvoGates contains flags that control CVO functionality gated by product feature gates. The
6069
// names do not correspond to product feature gates, the booleans here are "smaller" (product-level
6170
// gate will enable multiple CVO behaviors).
@@ -68,6 +77,7 @@ type CvoGates struct {
6877
unknownVersion bool
6978
reconciliationIssuesCondition bool
7079
statusReleaseArchitecture bool
80+
cvoConfiguration bool
7181
}
7282

7383
func (c CvoGates) ReconciliationIssuesCondition() bool {
@@ -82,13 +92,18 @@ func (c CvoGates) UnknownVersion() bool {
8292
return c.unknownVersion
8393
}
8494

95+
func (c CvoGates) CVOConfiguration() bool {
96+
return c.cvoConfiguration
97+
}
98+
8599
// DefaultCvoGates apply when actual features for given version are unknown
86100
func DefaultCvoGates(version string) CvoGates {
87101
return CvoGates{
88102
desiredVersion: version,
89103
unknownVersion: true,
90104
reconciliationIssuesCondition: false,
91105
statusReleaseArchitecture: false,
106+
cvoConfiguration: false,
92107
}
93108
}
94109

@@ -110,6 +125,8 @@ func CvoGatesFromFeatureGate(gate *configv1.FeatureGate, version string) CvoGate
110125
enabledGates.reconciliationIssuesCondition = true
111126
case features.FeatureGateImageStreamImportMode:
112127
enabledGates.statusReleaseArchitecture = true
128+
case features.FeatureGateCVOConfiguration:
129+
enabledGates.cvoConfiguration = true
113130
}
114131
}
115132
for _, disabled := range g.Disabled {
@@ -118,6 +135,8 @@ func CvoGatesFromFeatureGate(gate *configv1.FeatureGate, version string) CvoGate
118135
enabledGates.reconciliationIssuesCondition = false
119136
case features.FeatureGateImageStreamImportMode:
120137
enabledGates.statusReleaseArchitecture = false
138+
case features.FeatureGateCVOConfiguration:
139+
enabledGates.cvoConfiguration = false
121140
}
122141
}
123142
}

0 commit comments

Comments
 (0)