Skip to content

serviceAccount annotations and labels are wrongly formatted #1405

Closed

Description

@ldimitrov

🐞 Bug report

Describe the bug

I tried to install the helm chart and needed to configure an annotation for the service account so that it can access an s3 bucket. But I got an error:

Helm upgrade failed: YAML parse error on operator/templates/rbac/serviceaccount.yaml: error converting YAML to JSON: yaml: line 9: mapping values are not allowed in this context

Then I saw this recent commit https://github.com/secureCodeBox/secureCodeBox/pull/1302/files#diff-002a5fbebb62d0b4a0b23564626190ffa44ca38ea7aa083f11aed87560cd8751 and here some auto fixes and linting was applied, which actually cause the bug.

In Version 3.14.3 the operator/templates/rbac/serviceaccount.yaml looked like this:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Values.serviceAccount.name }}
  annotations:
    {{ .Values.serviceAccount.annotations | toYaml | indent 4}}
  labels:
    {{ .Values.serviceAccount.labels | toYaml | indent 4 }}

And with the linting the new lines were removed and now it looks like this:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{.Values.serviceAccount.name}}
  annotations: {{.Values.serviceAccount.annotations | toYaml | indent 4}}
  labels: {{.Values.serviceAccount.labels | toYaml | indent 4}}

Steps To Reproduce

  1. Install secureCodeBox via helm chart version 3.15.0
  2. or check repository and use helm template values.yaml . --debug > test.yaml and see the output and wrongly formatted serviceAccount.annotations

Expected behavior

We should be able to configure annotations and labels for service accounts.

System (please complete the following information):

  • secureCodeBox Version/Release 3.15.0
  • Kubernetes Version [command: kubectl version] - v1.25.2

Screenshots / Logs

Helm upgrade failed: YAML parse error on operator/templates/rbac/serviceaccount.yaml: error converting YAML to JSON: yaml: line 9: mapping values are not allowed in this context

Activity

  1. added a commit that references this issue on Oct 13, 2022
    a09b581
  2. ldimitrov commented on Oct 13, 2022

    @ldimitrov
    ContributorAuthor

    I created a Pull Request here #1406

  3. added a commit that references this issue on Oct 13, 2022
    bbe3cb3
  4. moved this from Backlog to In Progress in secureCodeBoxon Oct 13, 2022
  5. Weltraumschaf commented on Oct 18, 2022

    @Weltraumschaf
    Member

    Hi @ldimitrov,

    thanks for your contribution ❤️

    We just saw that our mega lint action broke more files 😬 So we will push some more PRs on this issue.

  6. added a commit that references this issue on Oct 18, 2022
    eac057a
  7. Repository owner moved this from In Progress to Done in secureCodeBoxon Oct 18, 2022
  8. J12934 commented on Oct 18, 2022

    @J12934
    Member

    There are some more cases i found these but there are likely more:

    hooks/notification/templates/configmap.yaml
    demo-targets/unsafe-https/templates/service.yaml
    demo-targets/swagger-petstore/templates/service.yaml

  9. reopened this on Oct 18, 2022
  10. Repository owner moved this from Done to Backlog in secureCodeBoxon Oct 18, 2022
  11. ldimitrov commented on Oct 18, 2022

    @ldimitrov
    ContributorAuthor

    @Weltraumschaf Yeah I also saw some other potential errors, but wanted to first confirm and keep it simple. Shall I close this issue then? Or you want to keep it around until the rest is being inspected/fixed?

  12. Weltraumschaf commented on Oct 18, 2022

    @Weltraumschaf
    Member

    @ldimitrov Yes, we keep it open until all issues introduced by mega linting everything were fixed.

  13. moved this from Backlog to Todo in secureCodeBoxon Oct 26, 2022
  14. moved this from Todo to In Progress in secureCodeBoxon Nov 2, 2022
  15. Repository owner moved this from In Progress to Done in secureCodeBoxon Nov 2, 2022
  16. added a commit that references this issue on Nov 18, 2022
    1fe6284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions