-
Notifications
You must be signed in to change notification settings - Fork 204
OTA-1404: Add Support for a Configuration File: Creation of a Periodic Check #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,6 +183,9 @@ type Operator struct { | |
// always be implicitly enabled. | ||
alwaysEnableCapabilities []configv1.ClusterVersionCapability | ||
|
||
// configFile is a path to a ClusterVersionOperator configuration file | ||
configFile string | ||
|
||
// configuration, if enabled, reconciles the ClusterVersionOperator configuration. | ||
configuration *configuration.ClusterVersionOperatorConfiguration | ||
} | ||
|
@@ -209,6 +212,7 @@ func New( | |
promqlTarget clusterconditions.PromQLTarget, | ||
injectClusterIdIntoPromQL bool, | ||
updateService string, | ||
configFile string, | ||
alwaysEnableCapabilities []configv1.ClusterVersionCapability, | ||
) (*Operator, error) { | ||
eventBroadcaster := record.NewBroadcaster() | ||
|
@@ -237,6 +241,7 @@ func New( | |
availableUpdatesQueue: workqueue.NewTypedRateLimitingQueueWithConfig[any](workqueue.DefaultTypedControllerRateLimiter[any](), workqueue.TypedRateLimitingQueueConfig[any]{Name: "availableupdates"}), | ||
upgradeableQueue: workqueue.NewTypedRateLimitingQueueWithConfig[any](workqueue.DefaultTypedControllerRateLimiter[any](), workqueue.TypedRateLimitingQueueConfig[any]{Name: "upgradeable"}), | ||
|
||
configFile: configFile, | ||
hypershift: hypershift, | ||
exclude: exclude, | ||
clusterProfile: clusterProfile, | ||
|
@@ -463,7 +468,7 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co | |
resultChannel <- asyncResult{name: "available updates"} | ||
}() | ||
|
||
if optr.shouldReconcileCVOConfiguration() { | ||
if optr.shouldReconcileCVOConfiguration() && optr.configFile == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the config file presence check should be in |
||
resultChannelCount++ | ||
go func() { | ||
defer utilruntime.HandleCrash() | ||
|
@@ -477,7 +482,20 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co | |
resultChannel <- asyncResult{name: "cvo configuration"} | ||
}() | ||
} else { | ||
klog.Infof("The ClusterVersionOperatorConfiguration feature gate is disabled or HyperShift is detected; the configuration sync routine will not run.") | ||
klog.Infof("The ClusterVersionOperatorConfiguration feature gate is disabled, HyperShift is detected or --config-file flag is used; the configuration sync routine will not run.") | ||
} | ||
|
||
if optr.enabledFeatureGates.CVOConfiguration() && optr.configFile != "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...and we should have something like |
||
resultChannelCount++ | ||
go func() { | ||
defer utilruntime.HandleCrash() | ||
wait.UntilWithContext(runContext, func(_ context.Context) { | ||
klog.V(4).Infof("Syncing configuration file") | ||
}, time.Second*15) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe 15 seconds is too little; however, the logic won't be that extensive. |
||
resultChannel <- asyncResult{name: "cvo configuration file"} | ||
}() | ||
} else { | ||
klog.Infof("The ClusterVersionOperatorConfiguration feature gate is disabled or --config-file flag is not used; the configuration file sync routine will not run.") | ||
} | ||
|
||
resultChannelCount++ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we validate this when passed (it is a path to a file that exists and can be opened)?