Documentation
¶
Overview ¶
Package agentidentity keeps a host-side record of ERC-8004 AgentIdentity CRs. The CR (and in particular status.registrations — the per-chain agentId) lives only in etcd; losing it on cluster recreation means the next registration mints a NEW on-chain identity instead of updating the existing one. The record at $OBOL_CONFIG_DIR/identity/<ns>__<name>.json is the single source of truth across recreation: the CLI writes it on every AgentIdentity write, `obol stack export` refreshes it from the cluster (picking up controller-side registrations) and ships it inside the config tree, and record replay (internal/replay) re-applies it.
Index ¶
- Variables
- func ApplySpec(k Kube, rec *Record) error
- func MirrorAll(cfg *config.Config, k Kube) (int, error)
- func PatchStatus(k Kube, rec *Record) error
- func Path(cfg *config.Config, ns, name string) string
- func Save(cfg *config.Config, rec *Record) error
- type Kube
- type Metadata
- type Outcome
- type Record
Constants ¶
This section is empty.
Variables ¶
var NewKube = func(cfg *config.Config) Kube { bin, kc := kubectl.Paths(cfg) return kubectlKube{bin: bin, kubeconfig: kc} }
NewKube returns the kubectl-backed client for cfg's cluster.
Functions ¶
func ApplySpec ¶
ApplySpec creates/updates the CR from rec's spec (status is a subresource and is never persisted by apply). Stamps the obol managed-by label.
func MirrorAll ¶
MirrorAll records every AgentIdentity in the cluster. Used by `obol stack export` so the archive's config tree carries registrations the serviceoffer-controller wrote since the last CLI write. CRD absent or no CRs => nothing recorded, no error.
func PatchStatus ¶
PatchStatus merge-patches status.registrations. An empty slice is sent explicitly so a patch can clear the field.
Types ¶
type Kube ¶
type Kube interface {
Output(args ...string) (string, error)
Run(args ...string) error
// Apply applies a JSON/YAML manifest.
Apply(data []byte) error
}
Kube is the slice of kubectl this package needs; swapped in tests.
type Metadata ¶
type Metadata struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Labels map[string]string `json:"labels,omitempty"`
}
Metadata is the subset of ObjectMeta the CLI reads and writes.
type Outcome ¶
type Outcome string
Outcome describes what Reconcile did for one record.
const ( OutcomeCreated Outcome = "created" // CR was missing; spec applied + status seeded OutcomeSeeded Outcome = "seeded" // CR existed without registrations; status seeded OutcomeRefreshed Outcome = "refreshed" // cluster had newer registrations; record updated OutcomeUnchanged Outcome = "unchanged" )
func ReconcileOne ¶
ReconcileOne converges one record with the cluster:
- CR missing: apply spec, seed status from the record.
- CR present without registrations: seed status from the record.
- CR present with registrations: the cluster wins (the controller may have registered on another chain since the last CLI write) and the record is refreshed from it.
type Record ¶
type Record struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata Metadata `json:"metadata"`
Spec monetizeapi.AgentIdentitySpec `json:"spec"`
Status monetizeapi.AgentIdentityStatus `json:"status,omitempty"`
}
Record is the JSON-shaped view of an AgentIdentity used both for kubectl round-trips and as the on-disk record.