Documentation
¶
Overview ¶
Package rollback defines the rollback ConfigMap contract shared between the controller and the recover CLI.
Index ¶
Constants ¶
const MetaKey = "_meta"
MetaKey is the ConfigMap data key that holds transaction-level metadata.
Variables ¶
This section is empty.
Functions ¶
func CleanForRestore ¶
func CleanForRestore(obj *unstructured.Unstructured, targetNS string)
CleanForRestore strips server-managed fields from an Unstructured object so it can be used for a restore (Update or Create). If targetNS is non-empty, the object's namespace is overridden.
Types ¶
type Envelope ¶
type Envelope struct {
// ResourceVersion of the resource at the time it was captured.
ResourceVersion string `json:"resourceVersion,omitempty"`
// ChangeType that produced this envelope (Create, Patch, Delete, Update).
ChangeType string `json:"changeType"`
// PriorState is the raw JSON of the resource before the change.
// Nil for Create when the resource did not exist (rollback = delete).
// Present for Create when the resource existed (rollback = restore via SSA).
PriorState json.RawMessage `json:"priorState,omitempty"`
}
Envelope wraps a single resource's rollback state in the ConfigMap.
type Meta ¶
type Meta struct {
// Version of the rollback format. Currently 2.
Version int `json:"version"`
// TransactionName is the name of the owning Transaction.
TransactionName string `json:"transactionName"`
// TransactionNamespace is the namespace of the owning Transaction.
TransactionNamespace string `json:"transactionNamespace"`
// Changes lists each item in the transaction with its rollback key.
Changes []MetaChange `json:"changes"`
}
Meta is stored under MetaKey and describes the transaction as a whole.
type MetaChange ¶
type MetaChange struct {
// Name of the ResourceChange CR.
Name string `json:"name"`
// Target identifies the resource being changed.
Target MetaTarget `json:"target"`
// ChangeType that was applied (Create, Patch, Delete, Update).
ChangeType string `json:"changeType"`
// RollbackKey is the ConfigMap data key holding this item's Envelope.
RollbackKey string `json:"rollbackKey"`
}
MetaChange records one transaction item's rollback location.
type MetaTarget ¶
type MetaTarget struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
}
MetaTarget identifies a Kubernetes resource. It mirrors api/v1alpha1.ResourceRef without importing it, so that the rollback package stays free of API dependencies.