Day 1
Set up approval permissions
Give each person the rights for their work. Choose if a person can approve a change that they proposed.
Before you start
Section titled “Before you start”- You have the site overlay from Install the operator.
- You know the groups of your identity provider, or the
O=fields of your client certificates.
The roles
Section titled “The roles”| Role | What it does | How a person gets it |
|---|---|---|
| Operator | Proposes most operations and rollouts. It never approves. | The service account pk-metal/pk-metal-manager. The base binds it. |
| Proposer | Proposes an operation or a rollout: pk-metal reboot, pk-metal restore plan --propose, or a TalosRollout of kind Reboot. |
create on hostoperations or talosrollouts. The base has no role for this. Write a ClusterRole for it. |
| Approver | Approves with pk-metal approve and pk-metal rollout. Also aborts, pauses, resumes, and lifts guards. | The ClusterRole pk-metal-approver. bindings.yaml binds it to a group. |
| Admin group | Names the TalosNode of a claim. Sets automatic approval. Moves a claim to a different machine. Changes backup recipients and EndpointProfiles. Creates operations that need no approval. | The group in the ConfigMap key adminGroup, default pk-metal:admins. The membership comes from the login, not from a binding. |
| On call | Follows the runbooks: reads each kind, deletes failed operations, holds claims. It cannot approve. | The ClusterRole pk-metal-oncall. Bind it in your overlay. |
| GitOps service account | Applies the kinds that you keep in git. | Its own binding. Never give it pk-metal-approver. See Git and GitOps. |
A person can have more than one role. A person on call usually also has pk-metal-approver.
Choose the selfApproval setting
Section titled “Choose the selfApproval setting”The key selfApproval in the ConfigMap hostoperation-approval tells if a person can approve their own change. It applies to operations and to rollouts. A change is "their own" when one of these names the person:
spec.proposedBy: the person proposed it.spec.requestedBy: the edit of the person made the operator propose it. See Who asked for a change.
| Value | What it prevents | What it does not prevent |
|---|---|---|
Allowed (the default) |
The operator approves nothing. A person approves in their own name only, and only one time. Nobody creates an approved object. | One person with the proposer and the approver role changes a machine alone. The record names that person as requester and as approver. |
Forbidden |
The same, and also: one account alone cannot change a machine. A second person reads each plan before it runs. | The operator and the admin group can still create operations that need no approval. A GitOps service account is the requester of what it applies, not the person who wrote the commit. See Threat model. |
-
Select
Forbiddenif two or more approvers can answer in time. -
Select
Allowedfor a small team. Then examine the approvals that a person gave to their own proposals:Terminal window kubectl get hostoperations,talosrollouts -A -o json | jq -r '.items[]| select(.spec.approval.approvedBy as $a | $a != nulland (.spec.proposedBy == $a or ((.spec.requestedBy // []) | index($a))))| "\(.kind) \(.metadata.name) \(.spec.approval.approvedBy)"' -
The API server reads each other value as
Forbidden, and its message names the value.
-
Bind the approvers. In
bindings.yaml, replaceexample:platform-approverswith your group. -
Bind the persons on call. Add this binding to
bindings.yaml, with your group:---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:name: pk-metal-oncallroleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: pk-metal-oncallsubjects:- apiGroup: rbac.authorization.k8s.iokind: Groupname: example:platform-oncall -
Set
selfApprovalinapproval.yaml.approval.yaml apiVersion: v1kind: ConfigMapmetadata:name: hostoperation-approvalnamespace: pk-metaldata:selfApproval: Forbidden -
Apply the overlay.
Terminal window kubectl apply --server-side -k .After the first install, only a member of the admin group can change or delete the ConfigMap. The
settings-guardpolicy refuses each other person. The operator writes asettings.changedline in the Audit trail for each change. -
Read the setting back.
Terminal window kubectl -n pk-metal get configmap hostoperation-approval -o jsonpath='{.data.selfApproval}{"\n"}'The API server uses the new value after a few seconds.
-
Ask each approver to examine their rights.
Terminal window kubectl auth can-i patch hostoperations -n pk-metalThe output is
yes.
Who asked for a change
Section titled “Who asked for a change”The operator proposes most changes itself, as the result of an edit. For example, a new talosVersion on a TalosCluster becomes a rollout, and a metal.platform-kit.org/wipe mark on a Host becomes a wipe operation. The proposal names the operator as its proposer. So the person who made the edit must also be on the record.
-
Each request that makes the operator propose work sets the annotation
metal.platform-kit.org/requested-byto the username of the request. Therequested-bypolicy refuses the request if not. A delete of such an object needs the annotation before the delete. -
The pk-metal commands set the annotation for you: pk-metal upgrade, pk-metal scale, pk-metal replace, pk-metal wipe, pk-metal reinstall, and
pk-metal rollout pause,resume, andabort. -
If you use
kubectl, set the annotation in the same request:Terminal window me=$(kubectl auth whoami -o jsonpath='{.status.userInfo.username}')kubectl annotate talosnode node-2 --overwrite "metal.platform-kit.org/requested-by=$me" -
You can set the annotation to your own username only. You cannot remove it. To make a change of another person your own, set your own username.
-
The operator copies the names from the objects behind a proposal into
spec.requestedByof the operation or rollout. This field cannot change after the create. -
A rollout that the operator proposed ends with
PlanChangedif a person who is not in itsspec.requestedBychanges what it applies. The operator then proposes it again, with the new names. -
A Talos config patch in a ConfigMap must have the label
os.platform-kit.org/patch: "true". The operator reads no ConfigMap without it. So the policy can find the patches and ask for a name.
Guard-lift annotations
Section titled “Guard-lift annotations”Two annotations on a HostOperation lift a safety rule for that operation:
| Annotation | Rule that it lifts |
|---|---|
metal.platform-kit.org/override-cluster-guard |
A control plane goes down only while etcd is healthy without it. See Cluster guard. |
metal.platform-kit.org/ignore-window |
The operation starts only in a MaintenanceWindow. |
- Each person with
patchon operations can set them, before or after the approval. That is each holder ofpk-metal-approver.selfApprovaldoes not apply to annotations. - The value is
<username>: <reason>, with your own username. Theguard-liftpolicy refuses each other value. So the operation records who lifted the rule and why. - pk-metal approve shows each lifted guard in the plan, with the person and the reason. If an annotation changes after the command showed the plan, the command approves nothing.
- An annotation with an empty value lifts nothing. The plan shows it as
empty: lifts nothing.
To lift the window on an operation:
me=$(kubectl auth whoami -o jsonpath='{.status.userInfo.username}')kubectl -n pk-metal annotate hostoperation reboot-node-1 metal.platform-kit.org/ignore-window="$me: CVE fix"Choose the retention
Section titled “Choose the retention”The key retention in the same ConfigMap tells how long the operator keeps a finished operation or rollout. The default is 30d. Set Forever to keep each record until a person deletes it. See Retention.