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

Fixed adding additional RBAC rules. #42

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

toran414
Copy link
Contributor

⚙️ Issue

When adding additional role rules or logging role rules, the manifest it renders ends up missing a newline and always returning an error.

Error: YAML parse error on container-agent/templates/role.yaml: error converting YAML to JSON: yaml: line 15: did not find expected key helm.go:84: [debug] error converting YAML to JSON: yaml: line 15: did not find expected key

⚙️ Change

Altered the toYaml section for the extra rules to use 'nindent' instead of 'indent' to introduce a newline in order to fix the formatting.

AC:

Fix

When providing additional rules, the manifest now renders as valid YAML.

Tests

Ran helm template command locally and before the change it rendered and errored:

rules:
  - apiGroups: [""]
    resources: ["pods", "pods/exec", "pods/log"]
    verbs: ["get", "watch", "list", "create", "delete"]
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get", "list", "create", "delete"]
  - apiGroups: ["", "events.k8s.io/v1"]
    resources: ["events"]
    verbs: ["watch"] # if .Values.agent.ssh.enabled  - apiGroups:
    - ""
    resources:
    - configmaps
    verbs:
    - get
    - list
    - create
    - update
    - delete # if $role.rules

After the change it rendered and ran correctly:

 rules:
  - apiGroups: [""]
    resources: ["pods", "pods/exec", "pods/log"]
    verbs: ["get", "watch", "list", "create", "delete"]
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get", "list", "create", "delete"]
  - apiGroups: ["", "events.k8s.io/v1"]
    resources: ["events"]
    verbs: ["watch"] # if .Values.agent.ssh.enabled  
  - apiGroups:
    - ""
    resources:
    - configmaps
    verbs:
    - get
    - list
    - create
    - update
    - delete # if $role.rules

🗒️ Documentation

N/A -- Just a bug fix

@toran414 toran414 requested a review from a team as a code owner March 12, 2024 20:35
@jrahme-cci
Copy link
Contributor

jrahme-cci commented Mar 21, 2024

I've pushed a couple additions to your changes @toran414 , mostly boiler plate stuff that should be in a contributors section of our README but isn't. Chart version updating, changelog entry, and some quick unit tests for the fix.

@jrahme-cci jrahme-cci merged commit 33b22b6 into CircleCI-Public:main Mar 21, 2024
@jrahme-cci
Copy link
Contributor

@toran414 Thanks for the contribution :D

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.

4 participants