-
Notifications
You must be signed in to change notification settings - Fork 13
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
ROX-19735: PR suggestions #1287
ROX-19735: PR suggestions #1287
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ludydoo The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
baseURL: https://raw.githubusercontent.com/stackrox/stackrox/{{ .GitRef }}/operator/bundle/manifests/ | ||
gitRef: 4.1.1 |
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.
Do we really need a template here? Why not just specify the url directly
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.
Most of the times it will only be necessary to adjust the GitRef instead of the whole URL. I've used a template in this case because %s
seemed not obvious enough if a new engineer not familiar with the config looks at the file.
Example: https://raw.githubusercontent.com/stackrox/stackrox/%s/operator/bundle/manifests/
gitRef: 4.1.1 | ||
operators: | ||
- gitRef: 4.1.1 | ||
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1" |
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.
I would favor adding the centralLabelSelector
here.
Otherwise the engineers will need to know that the Central label (present in patches below) rhacs.redhat.com/version-selector
corresponds to the gitRef
that is specified in the operators.
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.
What would you prefer, centralVersionSelector
or naming the label?
operators:
- gitRef: 4.1.1
centralVersionSelector: 4.1.1
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1"
vs naming the label explicitly as a key, it makes it very explicit how the correspond to each other:
operators:
- gitRef: 4.1.1
rhacs.redhat.com/version-selector: 4.1.1
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1"
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.
Perhaps the simplest would be to align with the helm values structure?
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.
Seems like the current helm template uses labelSelector
as a key
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.
What is the simplest for the user? I think this is the most idiomatic rhacs.redhat.com/version-selector: 4.1.1
value.
@@ -17,25 +16,12 @@ func parseConfig(content []byte) (OperatorConfigs, error) { | |||
return out, nil | |||
} | |||
|
|||
// GetConfig returns the rhacs operator configurations |
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.
Unused
return field.ErrorList{ | ||
field.Forbidden(path, fmt.Sprintf("could not render operator helm charts, got invalid configuration: %s", err.Error())), | ||
} | ||
} else if len(manifests) == 0 { |
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.
no operators in list is .. undesirable but not "invalid"
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.
It's both, I've intended to catch templating errors. When an empty config is provided it is valid, when config contains operators it is invalid.
} else if len(configs.OperatorConfigs) > 0&& len(manifests) == 0 {
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.
Done and added tests
return r.applyLabelSelector(remoteCentral, central) | ||
} | ||
|
||
func (r *CentralReconciler) applyLabelSelector(remoteCentral *private.ManagedCentral, central *v1alpha1.Central) error { |
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.
label is applied using the gitops configMap
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.
How is the default case handled? Does the default Central add the label to all instances outside of a group?
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.
Currently not, but we could either
- Specify a path with
instanceIds: ["*"]
where the label selector is set - Change the default central template.
- Other?
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.
Thanks for providing these fixes @ludydoo!
baseURL: https://raw.githubusercontent.com/stackrox/stackrox/{{ .GitRef }}/operator/bundle/manifests/ | ||
gitRef: 4.1.1 |
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.
Most of the times it will only be necessary to adjust the GitRef instead of the whole URL. I've used a template in this case because %s
seemed not obvious enough if a new engineer not familiar with the config looks at the file.
Example: https://raw.githubusercontent.com/stackrox/stackrox/%s/operator/bundle/manifests/
gitRef: 4.1.1 | ||
operators: | ||
- gitRef: 4.1.1 | ||
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1" |
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.
What would you prefer, centralVersionSelector
or naming the label?
operators:
- gitRef: 4.1.1
centralVersionSelector: 4.1.1
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1"
vs naming the label explicitly as a key, it makes it very explicit how the correspond to each other:
operators:
- gitRef: 4.1.1
rhacs.redhat.com/version-selector: 4.1.1
image: "quay.io/rhacs-eng/stackrox-operator:4.1.1"
return field.ErrorList{ | ||
field.Forbidden(path, fmt.Sprintf("could not render operator helm charts, got invalid configuration: %s", err.Error())), | ||
} | ||
} else if len(manifests) == 0 { |
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.
It's both, I've intended to catch templating errors. When an empty config is provided it is valid, when config contains operators it is invalid.
} else if len(configs.OperatorConfigs) > 0&& len(manifests) == 0 {
return r.applyLabelSelector(remoteCentral, central) | ||
} | ||
|
||
func (r *CentralReconciler) applyLabelSelector(remoteCentral *private.ManagedCentral, central *v1alpha1.Central) error { |
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.
How is the default case handled? Does the default Central add the label to all instances outside of a group?
No description provided.