kubernetes-secret-generator
kubernetes-secret-generator copied to clipboard
Make secret key for basic-auth string customizable
Is your feature request related to a problem? Please describe.
I would like to use the secret generator for generating a basic auth secret, but I am using Traefik as an ingress controller. Traefik requires the secret key for the basic auth string to be users
, so I cannot use a generated secret from the controller.
Describe the solution you'd like
I would like an annotation that allows me to adjust the secret key, so I could have users:
instead of the current default auth:
key. Probably something like secret-generator.v1.mittwald.de/httpwd-secretkey
.
Describe alternatives you've considered Right now I am copying the content of the generated secret manually to another secret.
Additional context
The feature could probably be implemented similar to the optional username other than admin
that can be provided via the annotation.
PRs are always welcome. 🙂
In general, I would prefer phasing out the annotation-driven secret generation in favour of the CR-based approach, which is easier extendable. Maybe the CR could be extended as follows:
apiVersion: "secretgenerator.mittwald.de/v1alpha1"
kind: "BasicAuth"
metadata:
name: "example-auth"
namespace: "default"
spec:
length: "40"
username: "testuser"
encoding: "base64"
forceRegenerate: false
+ authField: "users" # default to "auth" if omitted
+ usernameField: "username" # default to "username" if omitted (alternatively, don't include username at all if omitted)
+ passwordField: "password" # default to "password" if omitted (alternatively, don't include password at all if omitted)
data:
example: "data"
Would love to contribute to the project, but I can't write go code :/