Repository navigation
Skip image tag lookup when operator deployment is disabled #367
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 |
|---|---|---|
|
|
@@ -236,6 +236,34 @@ this flag can be used to tell roxie how to pre-load images for the current clust | |
| return cmd | ||
| } | ||
|
|
||
| // canSkipMainImageTagLookup reports whether no requested deployment behavior needs the main tag. | ||
| func canSkipMainImageTagLookup(components component.Component, config deployer.Config) bool { | ||
| if !config.Operator.SkipDeploymentEnabled() { | ||
| return false | ||
| } | ||
| if components.IncludesCentral() && !config.Central.EarlyReadinessEnabled() && config.CentralVersion() == "" { | ||
| return false | ||
| } | ||
| if components.IncludesSensor() && !config.SecuredCluster.EarlyReadinessEnabled() && config.SecuredClusterVersion() == "" { | ||
| return false | ||
| } | ||
| if config.Roxie.ClusterType.IsLocal() && !config.Roxie.KonfluxImagesEnabled() && | ||
| (config.CentralVersion() == "" || config.SecuredClusterVersion() == "") { | ||
| return false | ||
| } | ||
|
Contributor
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. We perform a bunch of handcrafted checks here which are based on how the code elsewhere works at this moment. I am afraid that as the code evolves, this part will get out of date and bugs will emerge. I wonder if we could use this opportunity to try a different approach. Namely, change |
||
| return true | ||
| } | ||
|
|
||
| func ensureClusterType(config *deployer.Config, detect func() types.ClusterType) { | ||
| if config.Roxie.ClusterType != "" { | ||
| return | ||
| } | ||
|
|
||
| clusterType := detect() | ||
| log.Dimf("Detected cluster type: %v", clusterType) | ||
| config.Roxie.ClusterType = clusterType | ||
| } | ||
|
|
||
| func runDeploy(cmd *cobra.Command, args []string) error { | ||
| if !dryRun { | ||
| if err := env.Initialize(); err != nil { | ||
|
|
@@ -265,12 +293,15 @@ func runDeploy(cmd *cobra.Command, args []string) error { | |
| if err != nil { | ||
| return err | ||
| } | ||
| ensureClusterType(&deploySettings, env.GetAutoDetectedClusterType) | ||
|
|
||
| ctx, cancel := context.WithTimeout(context.Background(), computeDeployContextTimeout(components, deploySettings)) | ||
| defer cancel() | ||
|
|
||
| if deploySettings.Roxie.Version != "" { | ||
| log.Dimf("Using main image tag %s", deploySettings.Roxie.Version) | ||
| } else if canSkipMainImageTagLookup(components, deploySettings) { | ||
| log.Dim("Skipping main image tag lookup because operator deployment is disabled") | ||
| } else { | ||
| mainImageTag, err := helpers.LookupMainImageTag(ctx, deploySettings.Roxie.ImageRegistry) | ||
| if err != nil { | ||
|
|
@@ -465,11 +496,7 @@ func retrieveClusterConfigForComponents( | |
| } | ||
|
|
||
| func configureConfig(components component.Component, deploySettings *deployer.Config) error { | ||
| if deploySettings.Roxie.ClusterType == "" { | ||
| clusterType := env.GetAutoDetectedClusterType() | ||
| log.Dimf("Detected cluster type: %v", clusterType) | ||
| deploySettings.Roxie.ClusterType = clusterType | ||
| } | ||
| ensureClusterType(deploySettings, env.GetAutoDetectedClusterType) | ||
|
Contributor
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. Do we need this if a call was added at https://github.com/stackrox/roxie/pull/367/changes#diff-e61f952a089e5960dd93ef2a48a83b1187c9700efabc40974fb9f2d9b50b4a7eR296? |
||
| clusterType := deploySettings.Roxie.ClusterType | ||
| centralDeployLocally := components.IncludesCentral() && clusterType.IsLocal() | ||
| sensorDeployLocally := components.IncludesSensor() && clusterType.IsLocal() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.