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

Using files together with secretFrom generates invalid yaml #221

Merged

Conversation

christoffer-eide
Copy link
Contributor

If files are used together with secretFrom, the generated yaml is invalid

apiVersion: viaduct.ai/v1
kind: ksops
metadata:
  name: ksops-multiple-generator
files:
  - ./secret-A.enc.yaml
  - ./secret-B.enc.yaml
  - ./secret-C.enc.yaml
secretFrom:
  - metadata:
      name: mysecret
    type: Opaque
    binaryFiles:
      - ./secret.enc.yaml
$ kustomize build --enable-alpha-plugins
Error: map[string]interface {}(nil): yaml: unmarshal errors:
  line 11: mapping key "apiVersion" already defined at line 1
  line 12: mapping key "data" already defined at line 2
  line 14: mapping key "kind" already defined at line 5
  line 15: mapping key "metadata" already defined at line 6
  line 17: mapping key "type" already defined at line 10

The reason is that a document separator (---) is missing:

kind: Secret
metadata:
    name: mysecret-C
stringData:
    application: kustomize-sops
type: Opaque
apiVersion: v1
data:
  secret.enc.yaml: dXNlcm5hbWU6IGFkbWluCnBhc3N3b3JkOiAxZjJkMWUyZTY3ZGYK
kind: Secret
metadata:
  name: mysecret
type: Opaque

I have worked around this by creating two generator files, one with only files and one with only secretFrom.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. kind:bug Something isn't working labels Nov 28, 2023
@devstein devstein self-requested a review December 22, 2023 20:59
Copy link
Collaborator

@devstein devstein left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks as always for contributing @christoffer-eide! Apologies for the slow review.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 10, 2024
@devstein devstein merged commit a018a93 into viaduct-ai:master Jan 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants