-
Notifications
You must be signed in to change notification settings - Fork 1
ROX-35434: Add support for overriding image repository #267
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
cdb0bcd
6899bb5
5224ccb
569f1a5
9e24d62
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 |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package deployer | |
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/stackrox/roxie/internal/constants" | ||
|
|
@@ -56,10 +57,38 @@ func (c *Config) DeepCopy() (*Config, error) { | |
| // RoxieConfig holds roxie-level settings such as version and feature flags. | ||
| type RoxieConfig struct { | ||
| Version imagetag.MainTag `yaml:"version,omitempty"` | ||
| ImageRegistry string `yaml:"imageRegistry,omitempty"` | ||
| KonfluxImages *bool `yaml:"konfluxImages,omitempty"` | ||
| FeatureFlags map[string]bool `yaml:"featureFlags,omitempty"` | ||
| ClusterType types.ClusterType `yaml:"clusterType,omitempty"` | ||
| HAProxy HAProxyConfig `yaml:"haProxy,omitempty"` | ||
|
|
||
| // RegistryRequiresAuth is computed internally and is not user-configurable. | ||
| RegistryRequiresAuth bool `yaml:"-"` | ||
| } | ||
|
|
||
| // Registry returns the resolved image registry, defaulting to | ||
| // constants.DefaultRegistry when ImageRegistry is not set. | ||
| func (c *RoxieConfig) Registry() string { | ||
| if c.ImageRegistry == "" { | ||
| return constants.DefaultRegistry | ||
|
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. Given that |
||
| } | ||
| return strings.TrimSuffix(c.ImageRegistry, "/") | ||
| } | ||
|
|
||
| // UsesCustomRegistry returns whether a custom image registry was configured. | ||
| func (c *RoxieConfig) UsesCustomRegistry() bool { | ||
| return c.Registry() != constants.DefaultRegistry | ||
| } | ||
|
|
||
| // NeedsPullSecrets returns whether roxie needs to set up image pull secrets itself. | ||
| // For a custom registry this relies on RegistryRequiresAuth having already been | ||
| // resolved during deploy validation (see cmd/deploy.go's deployValidate). | ||
| func (c *RoxieConfig) NeedsPullSecrets() bool { | ||
|
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. If you agree with my assessment above on the internal state tracking, then this would also be removed, since "Needs pull secrets?" wouldn't be behavior on a config struct any longer. |
||
| if c.UsesCustomRegistry() { | ||
| return c.RegistryRequiresAuth | ||
| } | ||
| return c.ClusterType.NeedsDefaultRegistryPullSecrets() | ||
| } | ||
|
|
||
| func (c *RoxieConfig) KonfluxImagesSet() bool { | ||
|
|
@@ -118,17 +147,16 @@ func (c *OperatorInstanceConfig) ClusterRoleBindingName() string { | |
| } | ||
|
|
||
| // BundleImage returns the operator bundle image for this operator instance. | ||
| func (c *OperatorInstanceConfig) BundleImage() string { | ||
| imageRegistry := constants.DefaultRegistry | ||
| func (c *OperatorInstanceConfig) BundleImage(imageRegistry string) string { | ||
| operatorTag := c.Version.ToOperatorTag() | ||
| if c.KonfluxImagesEnabled() { | ||
| return fmt.Sprintf("%s/release-operator-bundle:v%s", imageRegistry, operatorTag) | ||
| } | ||
| return fmt.Sprintf("%s/stackrox-operator-bundle:v%s", imageRegistry, operatorTag) | ||
| } | ||
|
|
||
| func (c *OperatorInstanceConfig) OperatorImage() string { | ||
| imageRegistry := constants.DefaultRegistry | ||
| // OperatorImage returns the operator image for this operator instance. | ||
| func (c *OperatorInstanceConfig) OperatorImage(imageRegistry string) string { | ||
| operatorTag := c.Version.ToOperatorTag() | ||
| if c.KonfluxImagesEnabled() { | ||
| return fmt.Sprintf("%s/release-operator:%s", imageRegistry, operatorTag) | ||
|
|
||
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.
Why did you decide to put this here?
I don't think this belongs into the config struct.
We should not start treating this is some object for tracking internal application state.
This is the config struct, which is the input for the deployer.
State, if needed, belongs into the deployer IMHO.
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.
tbh I didn't know where to put it, and we already did something similar in
OperatorInstanceConfig.Makes sense to move to the Deployer state.