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

redpanda: convert rbac.yaml to go code #1344

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

charlie-haley
Copy link
Contributor

@charlie-haley charlie-haley commented Jun 9, 2024

This PR converts rbac.yaml to Go code using gotohelm.

Fixes #1213

@CLAassistant
Copy link

CLAassistant commented Jun 9, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@RafalKorepta RafalKorepta left a comment

Choose a reason for hiding this comment

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

Thank you for contribution. Let me know if you need more help.

Could you run go test ./charts/redpanda -short -update to update charts/redpanda/testdata/ci files.

Comment on lines 18 to 19
{{- $crs := (get ((include "redpanda.ClusterRoles" (dict "a" (list .))) | fromJson) "r") }}
{{- range $_, $cr := $crs }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the range cover all cases without calling each function separately?

From 6 function calls it could be reduced to 4:

  • ClusterRole
  • ClusterRoleBinding
  • Role
  • RoleBinding

In the go code it would be easier to reason about, than template langue.

@@ -388,6 +388,7 @@ type Statefulset struct {
Repository string `json:"repository" jsonschema:"required,default=docker.redpanda.com/redpandadata/redpanda-operator"`
} `json:"image"`
Enabled bool `json:"enabled"`
CreateRBAC bool `json:"createRbac"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
CreateRBAC bool `json:"createRbac"`
CreateRBAC bool `json:"createRBAC"`

name: {{ include "redpanda.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
{{toYaml $scr}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{toYaml $scr}}
{{toYaml $scrb}}

- get
- list
{{- $crs := (get ((include "redpanda.ClusterRoles" (dict "a" (list .))) | fromJson) "r") }}
{{- range $_, $cr := $crs }}
---
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why, but each usage of --- render incorrectly. It should be in it's own new line, but it is concatenated to the last line of the object.

@RafalKorepta RafalKorepta enabled auto-merge (rebase) June 28, 2024 19:53
@RafalKorepta
Copy link
Contributor

@charlie-haley Thank you for contribution. I adjusted your change.

@RafalKorepta RafalKorepta merged commit 6c33dd5 into redpanda-data:main Jun 28, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redpanda: Convert rbac.yaml to go code
3 participants