Skip to content

Immutable field prevents secret from being re-created if it is deleted externally #3920

@tculp

Description

@tculp

Describe the bug
An ExternalSecret with target.immutable set to true will not recreate the secret if it is deleted manually, even if the refresh interval is nonzero.

To Reproduce
Steps to reproduce the behavior:

apiVersion: generators.external-secrets.io/v1alpha1
kind: Password
metadata:
  name: example-password-generator
spec:
  length: 42
  digits: 5
  symbols: 5
  symbolCharacters: "-_$@"
  noUpper: false
  allowRepeat: true
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: example-password-secret
spec:
  refreshInterval: "10s"
  target:
    name: example-secret
    immutable: true
  dataFrom:
  - sourceRef:
      generatorRef:
        apiVersion: generators.external-secrets.io/v1alpha1
        kind: Password
        name: "example-password-generator"
  1. Apply ExternalSecret with target.immutable field set to true
  2. If it does not exist, the Secret is created
  3. Delete the Secret (such as with kubectl delete)
  4. The Secret is not recreated

Expected behavior
I would expect a missing secret with a nonzero refresh interval to be processed the same as on first ExternalSecret creation, even with immutable: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions