Change
A Change turns a request for a Git repository into tasks for an
AgentSet. The planner returns each task’s instructions and
path patterns. The Change controller creates an Assignment
for each builder task and acquires an ordered PathLease
for its paths. The planner starts on an idle planner seat. After a task’s
lease is held, the controller selects an idle builder seat. A seat is idle
when it has no active or queued Assignment and its Session is ready.
When a lease reports MergeReady, the controller checks the live lease,
verifies that the net tree difference stays within the task’s declared write
paths, and fast-forwards the base branch to the task commit. If a task modifies
paths outside its declared writes, the Change fails with OutsideLease. If the
base advances, the same builder rebases and pushes the task branch. Each task
gets one rebase for every other task in its batch, plus three for other writers.
The number of bound builder seats at the start of planning sets the batch
size. The next batch starts after the current batch finishes.
Configure the seats
Section titled “Configure the seats”Create an AgentSet with a planner group and a builder group.
The sample AgentSet
uses one planner and two builder seats.
Use the kagent Harness for the planner. The chart publishes the
planner schema in the kslip-change-plan ConfigMap under plan.json.
When the planner Agent is in another namespace, create a ConfigMap with the
same schema in that namespace.
kubectl --namespace team-a create configmap kslip-change-plan \ --from-file=plan.json=charts/kslip/files/change-plan.jsonReference the schema from the planner Agent’s inline template.
spec: template: inline: outputSchemaFrom: name: kslip-change-plan key: plan.jsonEach task has instructions, one or more writes, and reads as an
array that can be empty. Use the path patterns described in
PathLease.
Give builders a harness that can run Git commands and an EgressPolicy for
the Git remote. Builder credentials need write access to the task branches.
The controller connects directly to the remote and needs read access to task
branches and write access to the base branch. Set spec.gitCredentialsSecretRef
to a Secret in the Change’s namespace holding the HTTP Authorization header, or
configure default credentials in the chart.
Submit a change
Section titled “Submit a change”Create a Change in the AgentSet’s namespace.
Use the sample Change with your repository URL and request.
kubectl --namespace team-a apply -f config/samples/change.yamlkubectl --namespace team-a get change cart-rounding --watchkubectl --namespace team-a get change cart-rounding -o yamlUse an HTTP or HTTPS Git remote. kslip compares leases within a namespace
using a lowercase hostname, any nondefault port, and the repository path
with a trailing slash and terminal .git removed. kslip lowercases the
path on github.com and preserves it on other hosts.
The Change has 45 minutes to start and finish planning and building. Set
spec.timeout to a positive Go duration string up to 2h to change the limit.
When the deadline passes, the controller starts cleanup. Set spec.cancel
to true to request cancellation and keep the outcome on the resource.
By default, kslip stops unfinished assignments before releasing their leases. Set
spec.keepSeatWork to true to let those assignments continue.
If an assignment needs input or authorization, the Change reports a failure.
An assignment kept by spec.keepSeatWork gives its caller up to five minutes
to reply on the Assignment before it stops and releases its seat.
The Change stays in Stopping while the controller confirms stops. If a Git
push has an uncertain outcome, the controller holds the lease through a short
wait, then checks the base branch before releasing it.
status.tasks records task branches and confirmed merged commits in plan
order. Confirmed commits stay on the base branch after cancellation or
failure. Read the Change’s phase, observedGeneration, Ready condition,
reason, and message for its current and final outcome; the controller also
emits Kubernetes Events on phase transitions.