A Kubernetes operator that materializes RandomSecret custom resources into
regular Secret objects with randomly generated values, so that applications
can declare "these secrets need to exist" without anyone ever handling the
values manually.
apiVersion: noa.re/v1alpha1
kind: RandomSecret
metadata:
name: my-secrets
spec:
secrets:
- name: MY_SECRET_NAME
length: 40
- name: A_SECRET_WITH_DEFAULT_LENGTHReconciling the above creates a Secret named my-secrets in the same
namespace with the keys MY_SECRET_NAME (40 characters) and
A_SECRET_WITH_DEFAULT_LENGTH (45 characters, the default).
Secrets are made up uppercase and lowercase characters and numbers, with the quirk
that the first character is never a digit. When length is omitted, the value
is 45 characters: the smallest length that carries at least 256 bits (32
bytes) of entropy given that the first character is drawn from only the 52
letters (44), rounded up to the next multiple of 3 so that Kubernetes'
base64 encoding of the value needs no padding.
- The
Secretgets the same name and namespace as theRandomSecretand an owner reference, so deleting theRandomSecretgarbage-collects theSecret. - Existing values are never rotated: reconciliation only generates values for
keys missing from the
Secret, and removes keys no longer in the spec.
A helm chart installing the CRD, the operator Deployment and its RBAC is
published to Amazon ECR Public at
oci://public.ecr.aws/portswigger-platform/charts/randomsecret:
helm install randomsecret \
oci://public.ecr.aws/portswigger-platform/charts/randomsecret \
--namespace randomsecret --create-namespaceMIT