Skip to main content

CRD Reference

Reference for the ZenLock custom resource, plus a note on the two resources zen-lock manages internally.

Overview​

zen-lock manages three CRDs:

CRDKindPurpose
zenlocks.security.zen-mesh.ioZenLockEncrypted secret storage
zenlockcustodies.security.zen-mesh.ioZenLockCustodySigning key custody (Zen Trust)
noncebuckets.security.zen-mesh.ioNonceBucketReplay attack prevention

API Version: security.zen-mesh.io/v1beta1

Short names: zenlock, zl


ZenLock​

The primary CRD for storing encrypted secrets. Contains only ciphertext — the API server and etcd never see plaintext.

Schema​

apiVersion: security.zen-mesh.io/v1beta1
kind: ZenLock
metadata:
name: <string> # Required; unique in namespace
namespace: <string> # Required
labels: <map>
annotations: <map>
spec:
algorithm: age # Required; currently only "age" supported
encryptedData: # Required; map of key -> base64 ciphertext
<key>: <value>
allowedSubjects: # Optional; ServiceAccounts allowed to receive this secret
- kind: ServiceAccount # Required; only ServiceAccount in v1beta1
name: <string> # Required
namespace: <string> # Optional; defaults to ZenLock namespace
status:
phase: Ready|Error # Current state
lastRotation: <time> # Last key rotation timestamp
conditions: # Detailed conditions
- type: <string>
status: True|False|Unknown
reason: <string>
message: <string>
lastTransitionTime: <time>
rotation: # Key rotation state
phase: idle|rotating|deprecated
activeKeyId: <string>
previousKeyId: <string>
rotatedAt: <time>
deprecatedAt: <time>
graceHits: <integer>
reencrypted: <integer>
pending: <integer>
safeToDeprecate: <boolean>

Fields Reference​

spec​

FieldTypeRequiredDescription
spec.algorithmstringYesEncryption algorithm. Currently only age is supported.
spec.encryptedDatamap[string]stringYesMap of secret keys to base64-encoded age ciphertext.
spec.allowedSubjects[]SubjectReferenceNoList of ServiceAccounts authorized to receive this secret. Empty = deny all.

spec.allowedSubjects[]​

FieldTypeRequiredDescription
kindstringYesMust be ServiceAccount.
namestringYesName of the ServiceAccount.
namespacestringNoNamespace of the ServiceAccount. Defaults to the ZenLock's namespace.

status​

FieldTypeDescription
status.phasestringReady or Error.
status.lastRotationtimeLast key rotation timestamp.
status.conditions[][]ZenLockConditionDetailed state conditions.
status.rotationRotationStatusCurrent rotation state (see Key Rotation).

Example​

apiVersion: security.zen-mesh.io/v1beta1
kind: ZenLock
metadata:
name: db-credentials
namespace: production
spec:
algorithm: age
encryptedData:
username: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM=
password: cGFzc3dvcmQxMjM0NTY3ODkwYWJjZGVmZ2g=
allowedSubjects:
- kind: ServiceAccount
name: my-app
namespace: production
status:
phase: Ready

Short Names​

kubectl get zenlock <name>
kubectl get zl <name>

Internal Resources​

ZenLockCustody and NonceBucket are created and managed by zen-lock itself — for signing-key custody and for replay protection. They are listed here so that operators recognize them in a cluster. They are not part of the public interface: do not create, edit or delete them by hand, and do not build on their fields.


Short Names​

# Get all ZenLocks
kubectl get zenlocks
kubectl get zl

API Discovery​

# List all zen-lock CRDs
kubectl get crd | grep security.zen-mesh.io

# Describe a CRD
kubectl describe crd zenlocks.security.zen-mesh.io