Skip to content

Support base64 encoded secret values

Clemens Beck requested to merge cb-support-base64-secret-generation into main

What does this MR do?

Introduce a encoder annotation for the sequence generation, to encode genereated values.

The annotation supports the following encoders: plain (no encoding) and base64.

This is a split-off from !74 (merged).

Usage:

AgentServerSecretGeneratorFunc tasks.GetSecretGeneratorFunc[*v2alpha1.GitLab] = func(g *v2alpha1.GitLab) tasks.Generator[*corev1.Secret] {
	return tasks.SecretGenerator[*v2alpha1.GitLab]{
		Source:    g,
		Reference: AgentServerSecretReference,
		Type:      corev1.SecretTypeOpaque,
		Annotations: map[string]string{
			"length":         "32",
			"character-sets": "lower,upper,digit",
			"keys":           "secret,api_secret",
			"encoder":        "base64", // <-- new
		},
	}
}

Author's Checklist

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Ensure a release milestone is set.
  • MR title and description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline on GitLab.com.
  • When ready for review, MR is labeled workflowready for review per the MR workflow.

Expected

  • Test plan indicating conditions for success has been posted and passes.
  • Documentation is created or updated.
  • Tests are added.

Related issues

Edited by Clemens Beck

Merge request reports

Loading