Skip to content

Unable to decrypt a secret via SOPS #1371

@kamialie

Description

@kamialie

With the recent upgrade to kustomize controller to v1.5.0 I'm facing the following issue during reconciliation:

Warning  BuildFailed              2m40s              kustomize-controller  decryption failed for 'foo-token': failed to decrypt and format 'default/foo-token' Secret data: error decrypting sops tree: Error walking tree: Could not decrypt value: Input string glagent-xxx does not match sops' data format

I have a secret resource which is set to empty string in the base layer, and there is a patch that contains actual secret data. Both of them are encrypted using SOPS (and AWS KMS key, but I think that's irrelevant here). To my surprise kustomize controller shows the secret value itself (in the logs!), and that's probably the hint as well why it fails. I suspect kustomize is trying to decrypt the secret twice, so on the second attempt SOPS obviously complains that the passed in value doesn't match the regex it expects.

I confirmed that my GitOps repo sucessfully reconciles with kustomize controller v1.4.0, and does not with v1.5.0. I believe the cullprit is here, but I'm lacking background knowledge and local setup to confirm though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions