Skip to content
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-20450: Configure operator resources in chart #1417

Merged

Conversation

kurlov
Copy link
Member

@kurlov kurlov commented Oct 25, 2023

Description

Allow configure operator resource via chart values.
Overrides can be passed via gitops config. If not presented the default values from values.yaml will be used

Also fail fast in case broken CRD URL provided

Checklist (Definition of Done)

- [ ] Unit and integration tests added

  • Added test description under Test manual
    - [ ] Documentation added if necessary (i.e. changes to dev setup, test execution, ...)
  • CI and all relevant tests are passing
  • Add the ticket number to the PR title if available, i.e. ROX-12345: ...
    - [ ] Discussed security and business related topics privately. Will move any security and business related topics that arise to private communication channel.
    - [ ] Add secret to app-interface Vault or Secrets Manager if necessary
    - [ ] RDS changes were e2e tested manually
    - [ ] Check AWS limits are reasonable for changes provisioning new resources

Test manual

# build and run locally
make deploy/dev

@kurlov kurlov temporarily deployed to development October 25, 2023 23:07 — with GitHub Actions Inactive
@kurlov kurlov temporarily deployed to development October 25, 2023 23:07 — with GitHub Actions Inactive
@kurlov kurlov temporarily deployed to development October 25, 2023 23:07 — with GitHub Actions Inactive
defaultValues := resourcesChart.Values["operator"].(map[string]interface{})
defaultResources := defaultValues["resources"].(map[string]interface{})
defaultRbacResources := defaultValues["rbac"].(map[string]interface{})

chartVals := chartutil.Values{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an obvious room for improvement in how to chart values constructed but I would prefer a separate PR for this

@@ -49,11 +49,11 @@ spec:
protocol: TCP
resources:
limits:
cpu: 2
memory: 1Gi
cpu: {{ ((((.rbac).resources).limits).cpu) | default $.Values.operator.rbac.resources.limits.cpu }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis is an additional nil handlers in case not correct resource structure is passed to the helm chart render from gitops config

@SimonBaeumer
Copy link
Member

/retest e2e

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 30, 2023

@SimonBaeumer: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test e2e
  • /test image-push
  • /test images

Use /test all to run all jobs.

In response to this:

/retest e2e

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@SimonBaeumer
Copy link
Member

/test e2e

@@ -45,7 +45,7 @@ func validateCRDUrls(path *field.Path, urls []string) field.ErrorList {

func validateCRDURL(path *field.Path, urlStr string) field.ErrorList {
var errs field.ErrorList
if _, err := url.Parse(urlStr); err != nil {
if _, err := url.ParseRequestURI(urlStr); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse doesn't complain about broken url string

@@ -54,13 +54,18 @@ func RenderChart(operators OperatorConfigs) ([]*unstructured.Unstructured, error
for _, operator := range operators.Configs {
valuesArr = append(valuesArr, chartutil.Values(operator))
}

resourcesChart, err := charts.GetChart("rhacs-operator", operators.CRDURLs)
operatorValues := resourcesChart.Values["operator"].(map[string]interface{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to safe-cast here,
e.g

operatorValues, ok := resourcesChart.Values["operator"].(map[string]interface{})
if !ok { return fmt.Errorf("...") }
defaultValues, ok  := ...

Copy link
Collaborator

@ludydoo ludydoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor adjustment for safe casting

Copy link
Contributor

openshift-ci bot commented Nov 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kurlov, ludydoo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kurlov kurlov merged commit 19cb853 into main Nov 7, 2023
5 checks passed
@kurlov kurlov deleted the akurlov/ROX-20450_configure_operator_resources_in_chart branch November 7, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants