Robot CRD¶
A Robot custom resource manages Harbor robot accounts using the
/api/v2.0/robots API. It supports both system- and project-level robots.
Quick Start¶
apiVersion: harbor.harbor-operator.io/v1alpha1
kind: Robot
metadata:
name: ci
spec:
harborConnectionRef:
name: my-harbor
kind: HarborConnection
allowTakeover: false
level: project
permissions:
- kind: project
namespace: "library"
access:
- resource: repository
action: pull
effect: allow
- resource: repository
action: push
effect: allow
secretRef:
name: harbor-robot-ci
key: secret
Key Fields¶
-
spec.harborConnectionRef (object, required) Reference to the Harbor connection object to use. Set
nameand optionalkind(HarborConnectionby default orClusterHarborConnection). -
spec.level (string, required) Robot scope. Must be
systemorproject. -
spec.permissions (array, required) Permissions granted to the robot. Each permission includes a
kind, optionalnamespace, and one or more access rules. Thenamespaceis the Harbor project name forkind: project. -
spec.duration (int, optional) Duration in days. Use
-1for never expires. If omitted, it defaults to-1. -
spec.secretRef (object, optional) Reference to the operator-managed secret where the generated robot secret is written. If omitted, the operator creates
<metadata.name>-secretwith keysecret. If the Secret already exists, it must already be managed by the sameRobot. -
spec.allowTakeover (bool, optional) If
true, the operator will adopt an existing Harbor robot with the same name.
Robot secrets are rotated automatically once Harbor reports that the robot
credential has expired (based on expires_at). The operator then refreshes the
secret and stores it in the referenced Secret.
Common Fields¶
Robot embeds HarborSpecBase. See Common Spec Fields
for the shared connection, deletion, and reconciliation controls, or jump to the
generated HarborSpecBase reference.
Behavior¶
-
Create
-
Creates the robot account with the requested permissions.
- Uses
spec.nameor defaults tometadata.name. -
If
allowTakeoveristrueand a robot already exists, it is adopted. -
Update
-
Updates description, permissions, disabled state, and duration.
- Rotates the Harbor credential when Harbor reports the current secret as expired.
-
Writes the rotated value back to the operator-managed Secret.
-
Delete
-
Deletes the robot account in Harbor.
Notes¶
spec.secretRefis a destination for operator-managed output, not an input source.- The controller does not adopt or overwrite unrelated existing Secrets.