Skip to content

Adding stringData to a secret with a secretGenerator #1444

Closed
@jrab89

Description

@jrab89

It it possible to add stringData values to a secret using a secretGenerator with behavior: merge?

For example:

$ cat my_secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: my-secret
stringData:
  FIRST_SECRET: foo
$ cat kustomization.yaml
resources:
  - my_secret.yaml
secretGenerator:
  - name: my-secret
    behavior: merge
    literals:
      - SECOND_SECRET=bar
$ kustomize build .
apiVersion: v1
data:
  SECOND_SECRET: YmFy
kind: Secret
metadata:
  annotations: {}
  labels: {}
  name: my-secret
type: Opaque

Is there a way for the resulting my-secret to have both FIRST_SECRET: foo and SECOND_SECRET: bar as stringData? In this example I could use a JSON patch to accomplish this, but I think it'd be cleaner to use a secretGenerator to do this.

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions