Skip to content

Concept

Git and GitOps

You write what must be true, and the operator writes what it finds. That split makes git a good place for your part. This page says where the line is, for a person who uses kubectl apply and for a GitOps tool such as Flux or Argo CD.

Kind In git Reason
Asset Yes Your record of a machine.
EndpointProfile, BiosProfile, FirmwareProfile Yes Your configuration for sets of machines.
MaintenanceWindow Yes Your schedule.
TalosCluster, TalosNode Yes The cluster that you want.
HostClaim Yes, with care It gives a machine to a node. To delete it is to release the machine. See What a deletion does.
EtcdBackupPolicy Yes Your backup schedule.
BootAsset Only the ones that you write The operator makes the others.
The site overlay of the operator Yes The image, the flags, the ledger. See Install the operator.
Secrets that you make: BMC credentials, the Talos secrets bundle, backup credentials Only encrypted They are keys.

metal/config/samples/kustomization.yaml shows a directory with these kinds in the order of their dependencies.

Kind Who writes it Why not in git
ManagementEndpoint, Host The operator They are what the operator found.
BiosSchema, BiosSettings The operator The same.
HostOperation The operator, or a command One proposal for one moment. Its name and its plan are new each time.
TalosRollout The operator, or a person for a reboot A proposal. spec.proposedBy must be the user who creates it.
EtcdSnapshot The operator, or pk-metal backup A record of one snapshot.
Secrets that the operator makes: <cluster>-kubeconfig, <cluster>-talosconfig, node configs, endpoint-creds-<endpoint> The operator It renews them.

Tell your GitOps tool to ignore these kinds. Do not let it prune them.

A merge is not an approval. The approval is a field that a person writes on a HostOperation or a TalosRollout, with that person's own name. The API server compares the name with the login. It refuses a person who approves a proposal of their own if the site sets selfApproval: Forbidden. See Approval.

  1. You merge a change, for example a new Talos release on the TalosCluster.
  2. The tool applies it. Nothing changes on a machine.
  3. The operator proposes an operation or a rollout, with a plan.
  4. A person reads the plan and approves it with pk-metal approve or pk-metal rollout.
  • Do not give the GitOps tool the role pk-metal-approver. Its approval would not be the decision of a person. selfApproval does not change this. See Set up approval permissions.
  • A merge can be enough only where the kind says so: an EndpointProfile needs no approval, and a claim with provisioning.approval: Automatic installs without one.

The admission policy requested-by asks each request that makes the operator propose work to name its user in the annotation metal.platform-kit.org/requested-by. The kinds are TalosCluster, TalosNode, HostClaim, BiosProfile, FirmwareProfile, and ConfigMaps with the label os.platform-kit.org/patch. See Set up approval permissions › Who asked for a change.

  • Put the annotation in each manifest of these kinds, with the username of the service account of the tool:

    metadata:
    annotations:
    metal.platform-kit.org/requested-by: system:serviceaccount:flux-system:kustomize-controller
  • The API server refuses a create, a change of spec, or a delete by the tool without it. A prune is a delete, so the object must have the annotation already.

  • spec.requestedBy of the proposal then names the service account, not the person who wrote the commit. Under selfApproval: Forbidden, the author of the commit can approve the result. The review of the commit must be the second person.

The admission policy hostclaim-provisioning asks for the admin group in three cases:

  • A claim names a TalosNode (spec.os).
  • A claim sets provisioning.approval: Automatic.
  • A claim moves to a different machine.

A GitOps tool applies with a service account. That account is not in the admin group, so the API server refuses these claims. The project has not yet decided which setup it recommends. The policies let you use these options today:

Option Effect Cost
Keep claims with spec.os out of the tool. An admin applies them by hand from git. The tool manages all other kinds. One manual step for each new machine.
Let the tool act as a user in the admin group, for example with impersonation. The tool applies all kinds. Each person who can merge decides which OS a machine gets. The approver of the install is then the only other check.
Set adminGroup in the ConfigMap hostoperation-approval to a group that contains the service account. The same The same. A member of the admin group can also make operations that need no approval. Do not do this without a review of Threat model.

For a claim with Automatic approval, the second and the third option let a merge install a machine with no further person.

A GitOps tool with prune deletes an object when its file goes from git. For some kinds, a deletion changes a machine.

Kind What the deletion does Finalizer or owner Prune
HostClaim The operator releases the machine. A machine that runs its node gets a release operation: drain, leave etcd, reset the disk, power off. The operation waits for approval. Finalizer metal.platform-kit.org/release holds the claim until the machine is free. Off, or with a review of each deletion
TalosNode The finalizer holds the object until no claim, no operation and no etcd member uses the node. Finalizer os.platform-kit.org/member Off, or with a review
TalosCluster The object goes at once. Kubernetes deletes the Secrets that the cluster owns: the kubeconfig, the talosconfig and the record of the applied secrets bundle. The machines continue to run. Owner of its credential Secrets Off
Asset Kubernetes deletes its ManagementEndpoint. The operator keeps the endpoint and the Host while a claim holds the machine. Owner of the endpoint. Finalizer metal.platform-kit.org/claim-protection on the endpoint. With a review
EndpointProfile, BiosProfile, FirmwareProfile The operator stops the work for the profile. It does not undo a setting on a machine. None Safe
MaintenanceWindow The window does not limit operations any more. An approved operation can start at once. None With a review
EtcdBackupPolicy No new snapshots. The snapshots that exist stay. None With a review

The release of an installed machine still waits for an approval. That approval is the last protection, so read the plan of each release.

Some commands change the spec of an object that you keep in git. With a GitOps tool, the tool writes the old value back.

Command What it writes With GitOps
pk-metal upgrade spec.talosVersion or spec.kubernetesVersion of the TalosCluster Change the field in git. Use the command only to read the plan.
pk-metal scale Creates and deletes HostClaims Add or remove the claim files in git. Run the command without --apply to see which claims it would change.
pk-metal replace spec.assetRef of a HostClaim Change the field in git.
pk-metal hold, pk-metal unhold, pk-metal reinstall An annotation on a HostClaim The command is enough if your tool does not remove annotations that are not in git.
pk-metal approve, pk-metal rollout, pk-metal abort, pk-metal retry Objects of the operator No conflict. These objects are not in git.

A tool that waits for health needs a condition for each kind. Wait for a kind has the list. Only the Asset has status.observedGeneration. For the other kinds, a tool cannot see that the status is as new as the spec.