-
Notifications
You must be signed in to change notification settings - Fork 1
ROX-35435: Support differing versions of Central and SecuredCluster #246
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
Open
vladbologa
wants to merge
22
commits into
main
Choose a base branch
from
vb/differing-central-sc-versions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ca9ea6b
ROX-35435: Support differing versions of Central and SecuredCluster
vladbologa 563b361
Derive the single operator from the effective component version
vladbologa 3c1e9b6
Use 'mixed' instead of 'split' versions
vladbologa 9cfb545
Replace 'unwanted' with 'stale'
vladbologa 3be5d41
reject invalid configuration
vladbologa e0951ee
Restructure version overrides to use central.operator/securedCluster.…
vladbologa 690f227
Simplify Konflux handling
vladbologa b51e01d
Make OperatorConfig non-pointer + remove merging
vladbologa 52cb864
Drop Effective version naming
vladbologa cdd2a71
Remove dead code
vladbologa 0b4f021
Simplify imagesForConfig & uniqueMainVersions
vladbologa e722b1d
Apply suggestions from code review
vladbologa 596519f
Apply suggestions from code review
vladbologa 6476db3
Move code from runDeploy to deployValidate
vladbologa 0db0eab
Simplify error messages
vladbologa e6bebed
Clarify operator tags / main tags mixup
vladbologa dc168d9
Address CodeRabbit comment
vladbologa 8f09943
Extract OperatorInstanceConfig out of OperatorConfig
vladbologa cde6154
Remove OperatorInstance type
vladbologa 55de33a
Require main tags in <component>.operator.version
vladbologa 879ae62
Apply code review suggestions
vladbologa 780994c
Do checkEarlyReadinessSupport per component
vladbologa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,20 @@ this flag can be used to tell roxie how to pre-load images for the current clust | |
| }), | ||
| ) | ||
|
|
||
| registerFlag(cmd, settings, "central-tag", "Image tag for Central (overrides --tag for Central)", | ||
| withApplyFn("version", func(config *deployer.Config, tag string) error { | ||
| config.Central.Operator.Version = tag | ||
| return nil | ||
| }), | ||
| ) | ||
|
|
||
| registerFlag(cmd, settings, "secured-cluster-tag", "Image tag for SecuredCluster (overrides --tag for SecuredCluster)", | ||
| withApplyFn("version", func(config *deployer.Config, tag string) error { | ||
| config.SecuredCluster.Operator.Version = tag | ||
| return nil | ||
| }), | ||
| ) | ||
|
|
||
| registerFlag(cmd, settings, "operator-env", "Operator environment variables (e.g., RELATED_IMAGE_MAIN=quay.io/...)", | ||
| withApplyFn("env-var", func(config *deployer.Config, envExpr string) error { | ||
| key, value, err := deployer.ParseOperatorEnvVar(envExpr) | ||
|
|
@@ -253,25 +267,6 @@ func runDeploy(cmd *cobra.Command, args []string) error { | |
| return err | ||
| } | ||
|
|
||
| if !deploySettings.Central.EarlyReadinessEnabled() || !deploySettings.SecuredCluster.EarlyReadinessEnabled() { | ||
| // Explanation on the versions involved here: | ||
| // Deploying StackRox begins with picking a "main image tag" -- this is a version identifier, which cannot be reliably parsed as a semver. | ||
| // But there is a derived version from that -- the operator version -- which can be parsed as a semver. | ||
| // | ||
| // The invocation of deploySettings.Operator.Configure() above in this function prepares the operator deployment config in the sense | ||
| // that top-level roxie configuration options are propagated to the concrete operator deployment configuration. This includes also | ||
| // storing of the derived operator version within the operator configuration. | ||
| // | ||
| // This is why we use the operator version here when checking version constraints. | ||
| hasSupport, err := stackroxversions.SupportsAdditionalPrinterColumns(deploySettings.Operator.Version) | ||
| if err != nil { | ||
| return fmt.Errorf("checking version constraint on main image tag %s: %w", deploySettings.Roxie.Version, err) | ||
| } | ||
| if !hasSupport { | ||
| return fmt.Errorf("--early-readiness=false can only be used for StackRox versions satisfying %s", stackroxversions.SupportsAdditionalPrinterColumnsConstraint.String()) | ||
| } | ||
| } | ||
|
|
||
| d, err := deployer.New(log) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to create deployer: %w", err) | ||
|
|
@@ -427,10 +422,6 @@ func configureConfig(log *logger.Logger, components component.Component, deployS | |
| return fmt.Errorf("configuring operator configuration: %w", err) | ||
| } | ||
|
|
||
| if deploySettings.Roxie.KonfluxImagesEnabled() { | ||
| deployer.PopulateKonfluxEnvVars(deploySettings) | ||
| } | ||
|
|
||
| if components.IncludesCentral() { | ||
| if err := deploySettings.Central.ConfigureSpec(&deploySettings.Roxie); err != nil { | ||
| return fmt.Errorf("configuring Central spec: %w", err) | ||
|
|
@@ -495,6 +486,42 @@ func deployValidate(components component.Component, deploySettings *deployer.Con | |
| } | ||
| } | ||
|
|
||
| if deploySettings.HasMixedVersions() { | ||
| globalLogger.Dimf("Mixed versions detected (configured via --central-tag / --secured-cluster-tag or central.operator / securedCluster.operator)") | ||
|
Collaborator
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. nit, I'd suggest to propagate the logger from here for consistency -- I think currently we are nowhere using the globalLogger directly. |
||
| if components.IncludesOperatorExplicitly() { | ||
| return errors.New("mixed versions are not supported with operator-only deploy") | ||
| } | ||
| if deploySettings.Operator.DeployViaOlmEnabled() { | ||
| return errors.New("mixed versions are not supported with OLM deployment mode") | ||
| } | ||
| } | ||
|
|
||
| if !deploySettings.Central.EarlyReadinessEnabled() { | ||
| if err := checkEarlyReadinessSupport("Central", deploySettings.CentralVersion()); err != nil { | ||
| return err | ||
| } | ||
| } | ||
| if !deploySettings.SecuredCluster.EarlyReadinessEnabled() { | ||
| if err := checkEarlyReadinessSupport("SecuredCluster", deploySettings.SecuredClusterVersion()); err != nil { | ||
| return err | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func checkEarlyReadinessSupport(componentName, mainTag string) error { | ||
| // The main image tag is not reliably parsible as semver, so we derive the operator | ||
| // tag (via ConvertToOperatorTag) for the constraint check. | ||
| version := helpers.ConvertToOperatorTag(mainTag) | ||
| hasSupport, err := stackroxversions.SupportsAdditionalPrinterColumns(version) | ||
| if err != nil { | ||
| return fmt.Errorf("checking version constraint on %s operator version %s: %w", componentName, version, err) | ||
| } | ||
| if !hasSupport { | ||
| return fmt.Errorf("--early-readiness=false can only be used for StackRox versions satisfying %s (%s version %s does not)", | ||
| stackroxversions.SupportsAdditionalPrinterColumnsConstraint.String(), componentName, version) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
mclasmeier marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.