Skip to content

Option to disable auto base64 encoding for templateFrom.target = Data #4850

@towasz

Description

@towasz

Is your feature request related to a problem? Please describe.

When using externalsecret.spec.target.template.templateFrom.literal with templateFrom.target set to Annotations, values are not automatically base64 encoded.

But when templateFrom.target is set to Data, values are automatically base64 encoded.

I’d like to have an option to disable automatic base64 encoding for Data targets on demand, so users can choose whether to encode values or not.

The rationale is that when extracting values from JSON containing binary data, automatic base64 encoding makes it impossible to use the original binary content as intended. In particular, the binary data in the JSON is already base64 encoded, so encoding it again is unnecessary and causes errors.

Example:

templateFrom:
- literal: |-
    {{- range $key, $val := . }}
      {{ $jsoncontent := $val | fromJson }}
      {{- if hasKey $jsoncontent "binaryFile" }}
      {{ $key }}: {{ $jsoncontent.binaryFile }}
      {{- end }}
    {{- end }}
  target: Data

Describe the solution you'd like
Add a boolean flag autoB64Enc on the templateFrom level to enable or disable automatic base64 encoding. Default behavior stays the same (true), but users can set autoB64Enc: false to prevent encoding.

templateFrom:
  target: Data
  autoB64Enc: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions