Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the tx v1alpha1 API group. +kubebuilder:object:generate=true +groupName=tx.janus.io
Index ¶
- Constants
- Variables
- func SetupResourceChangeWebhookWithManager(mgr ctrl.Manager) error
- func SetupWebhookWithManager(mgr ctrl.Manager) error
- type ChangeType
- type ItemStatus
- type ResourceChange
- type ResourceChangeCustomValidator
- func (in *ResourceChangeCustomValidator) DeepCopy() *ResourceChangeCustomValidator
- func (in *ResourceChangeCustomValidator) DeepCopyInto(out *ResourceChangeCustomValidator)
- func (v *ResourceChangeCustomValidator) ValidateCreate(_ context.Context, obj *ResourceChange) (admission.Warnings, error)
- func (v *ResourceChangeCustomValidator) ValidateDelete(_ context.Context, _ *ResourceChange) (admission.Warnings, error)
- func (v *ResourceChangeCustomValidator) ValidateUpdate(_ context.Context, _, _ *ResourceChange) (admission.Warnings, error)
- type ResourceChangeList
- type ResourceChangeSpec
- type ResourceRef
- type Transaction
- type TransactionCustomValidator
- func (in *TransactionCustomValidator) DeepCopy() *TransactionCustomValidator
- func (in *TransactionCustomValidator) DeepCopyInto(out *TransactionCustomValidator)
- func (v *TransactionCustomValidator) ValidateCreate(_ context.Context, txn *Transaction) (admission.Warnings, error)
- func (v *TransactionCustomValidator) ValidateDelete(_ context.Context, _ *Transaction) (admission.Warnings, error)
- func (v *TransactionCustomValidator) ValidateUpdate(_ context.Context, oldTxn, newTxn *Transaction) (admission.Warnings, error)
- type TransactionList
- type TransactionPhase
- type TransactionSpec
- type TransactionStatus
Constants ¶
const ( // AnnotationAutoRollback controls automatic rollback retry on deletion. // Present by default (added at seal time). Remove to stop retrying. AnnotationAutoRollback = "tx.janus.io/automatic-rollback" // AnnotationRetryRollback is a one-shot trigger for manual rollback retry. // User adds it; controller removes it after the attempt. AnnotationRetryRollback = "tx.janus.io/retry-rollback" )
Annotation keys for Transaction deletion behavior.
Variables ¶
var ( // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "tx.janus.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
func SetupResourceChangeWebhookWithManager ¶
SetupResourceChangeWebhookWithManager registers the ResourceChange validating webhook.
func SetupWebhookWithManager ¶
SetupWebhookWithManager registers the validating webhook with the manager.
Types ¶
type ChangeType ¶
type ChangeType string
ChangeType defines the type of mutation to apply. +kubebuilder:validation:Enum=Create;Update;Patch;Delete
const ( ChangeTypeCreate ChangeType = "Create" ChangeTypeUpdate ChangeType = "Update" ChangeTypePatch ChangeType = "Patch" ChangeTypeDelete ChangeType = "Delete" )
type ItemStatus ¶
type ItemStatus struct {
// Name is the name of the ResourceChange CR this status tracks.
Name string `json:"name"`
// LockLease is the name of the Lease object used to lock this resource.
// +optional
LockLease string `json:"lockLease,omitempty"`
// LeaseNamespace is the namespace of the Lease object.
// +optional
LeaseNamespace string `json:"leaseNamespace,omitempty"`
// ResourceVersion is the target resource's version at prepare time.
// Used to detect external modifications before commit.
// +optional
ResourceVersion string `json:"resourceVersion,omitempty"`
// Prepared indicates whether the resource's prior state has been captured.
Prepared bool `json:"prepared"`
// Committed indicates whether the mutation has been applied.
Committed bool `json:"committed"`
// RolledBack indicates whether a committed change has been reverted.
RolledBack bool `json:"rolledBack"`
// Error records any error encountered during processing of this item.
// +optional
Error string `json:"error,omitempty"`
}
ItemStatus tracks the state of a single resource change within the transaction.
func (*ItemStatus) DeepCopy ¶
func (in *ItemStatus) DeepCopy() *ItemStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ItemStatus.
func (*ItemStatus) DeepCopyInto ¶
func (in *ItemStatus) DeepCopyInto(out *ItemStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceChange ¶
type ResourceChange struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ResourceChangeSpec `json:"spec,omitempty"`
}
ResourceChange represents a single resource mutation belonging to a Transaction.
func (*ResourceChange) DeepCopy ¶
func (in *ResourceChange) DeepCopy() *ResourceChange
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceChange.
func (*ResourceChange) DeepCopyInto ¶
func (in *ResourceChange) DeepCopyInto(out *ResourceChange)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceChange) DeepCopyObject ¶
func (in *ResourceChange) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ResourceChangeCustomValidator ¶
type ResourceChangeCustomValidator struct{}
ResourceChangeCustomValidator implements admission validation for ResourceChange.
func (*ResourceChangeCustomValidator) DeepCopy ¶
func (in *ResourceChangeCustomValidator) DeepCopy() *ResourceChangeCustomValidator
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceChangeCustomValidator.
func (*ResourceChangeCustomValidator) DeepCopyInto ¶
func (in *ResourceChangeCustomValidator) DeepCopyInto(out *ResourceChangeCustomValidator)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceChangeCustomValidator) ValidateCreate ¶
func (v *ResourceChangeCustomValidator) ValidateCreate(_ context.Context, obj *ResourceChange) (admission.Warnings, error)
func (*ResourceChangeCustomValidator) ValidateDelete ¶
func (v *ResourceChangeCustomValidator) ValidateDelete(_ context.Context, _ *ResourceChange) (admission.Warnings, error)
func (*ResourceChangeCustomValidator) ValidateUpdate ¶
func (v *ResourceChangeCustomValidator) ValidateUpdate(_ context.Context, _, _ *ResourceChange) (admission.Warnings, error)
type ResourceChangeList ¶
type ResourceChangeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResourceChange `json:"items"`
}
ResourceChangeList contains a list of ResourceChanges.
func (*ResourceChangeList) DeepCopy ¶
func (in *ResourceChangeList) DeepCopy() *ResourceChangeList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceChangeList.
func (*ResourceChangeList) DeepCopyInto ¶
func (in *ResourceChangeList) DeepCopyInto(out *ResourceChangeList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceChangeList) DeepCopyObject ¶
func (in *ResourceChangeList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ResourceChangeSpec ¶
type ResourceChangeSpec struct {
// Target identifies the resource to mutate.
Target ResourceRef `json:"target"`
// Type is the kind of mutation: Create, Update, Patch, or Delete.
Type ChangeType `json:"type"`
// Content holds the resource manifest or patch data.
// Required for Create, Update, and Patch. Ignored for Delete.
// +optional
Content runtime.RawExtension `json:"content,omitempty"`
// Order controls execution sequence. Changes with the same order value
// are independent and may execute in parallel in future versions.
// Changes with lower order values execute first.
// +kubebuilder:default=0
// +optional
Order int32 `json:"order,omitempty"`
}
ResourceChangeSpec describes a single mutation within a transaction.
func (*ResourceChangeSpec) DeepCopy ¶
func (in *ResourceChangeSpec) DeepCopy() *ResourceChangeSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceChangeSpec.
func (*ResourceChangeSpec) DeepCopyInto ¶
func (in *ResourceChangeSpec) DeepCopyInto(out *ResourceChangeSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceRef ¶
type ResourceRef struct {
// APIVersion is the group/version of the target resource (e.g. "v1", "apps/v1").
APIVersion string `json:"apiVersion"`
// Kind is the resource kind (e.g. "ConfigMap", "Deployment").
Kind string `json:"kind"`
// Name of the target resource.
Name string `json:"name"`
// Namespace of the target resource. Defaults to the Transaction's namespace if empty.
// +optional
Namespace string `json:"namespace,omitempty"`
}
ResourceRef identifies a specific Kubernetes resource.
func (*ResourceRef) DeepCopy ¶
func (in *ResourceRef) DeepCopy() *ResourceRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef.
func (*ResourceRef) DeepCopyInto ¶
func (in *ResourceRef) DeepCopyInto(out *ResourceRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Transaction ¶
type Transaction struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TransactionSpec `json:"spec,omitempty"`
Status TransactionStatus `json:"status,omitempty"`
}
Transaction represents an atomic set of Kubernetes resource mutations executed with 2-phase commit semantics and advisory Lease-based locking.
func (*Transaction) DeepCopy ¶
func (in *Transaction) DeepCopy() *Transaction
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Transaction.
func (*Transaction) DeepCopyInto ¶
func (in *Transaction) DeepCopyInto(out *Transaction)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Transaction) DeepCopyObject ¶
func (in *Transaction) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type TransactionCustomValidator ¶
type TransactionCustomValidator struct{}
TransactionCustomValidator implements admission validation for Transaction.
func (*TransactionCustomValidator) DeepCopy ¶
func (in *TransactionCustomValidator) DeepCopy() *TransactionCustomValidator
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionCustomValidator.
func (*TransactionCustomValidator) DeepCopyInto ¶
func (in *TransactionCustomValidator) DeepCopyInto(out *TransactionCustomValidator)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TransactionCustomValidator) ValidateCreate ¶
func (v *TransactionCustomValidator) ValidateCreate(_ context.Context, txn *Transaction) (admission.Warnings, error)
func (*TransactionCustomValidator) ValidateDelete ¶
func (v *TransactionCustomValidator) ValidateDelete(_ context.Context, _ *Transaction) (admission.Warnings, error)
func (*TransactionCustomValidator) ValidateUpdate ¶
func (v *TransactionCustomValidator) ValidateUpdate(_ context.Context, oldTxn, newTxn *Transaction) (admission.Warnings, error)
type TransactionList ¶
type TransactionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Transaction `json:"items"`
}
TransactionList contains a list of Transactions.
func (*TransactionList) DeepCopy ¶
func (in *TransactionList) DeepCopy() *TransactionList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionList.
func (*TransactionList) DeepCopyInto ¶
func (in *TransactionList) DeepCopyInto(out *TransactionList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TransactionList) DeepCopyObject ¶
func (in *TransactionList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type TransactionPhase ¶
type TransactionPhase string
TransactionPhase represents the current state of a Transaction.
const ( TransactionPhasePending TransactionPhase = "Pending" TransactionPhasePreparing TransactionPhase = "Preparing" TransactionPhasePrepared TransactionPhase = "Prepared" TransactionPhaseCommitting TransactionPhase = "Committing" TransactionPhaseCommitted TransactionPhase = "Committed" TransactionPhaseRollingBack TransactionPhase = "RollingBack" TransactionPhaseRolledBack TransactionPhase = "RolledBack" TransactionPhaseFailed TransactionPhase = "Failed" )
type TransactionSpec ¶
type TransactionSpec struct {
// ServiceAccountName is the SA whose identity is used for resource operations.
// Must exist in the Transaction's namespace.
// +kubebuilder:validation:MinLength=1
ServiceAccountName string `json:"serviceAccountName"`
// Sealed indicates the transaction is ready for processing.
// The controller ignores unsealed transactions.
// Once sealed, this field is immutable.
// +optional
Sealed bool `json:"sealed,omitempty"`
// LockTimeout is how long acquired locks are held before expiring.
// Defaults to 5 minutes.
// +optional
LockTimeout *metav1.Duration `json:"lockTimeout,omitempty"`
// Timeout bounds the overall transaction duration.
// When elapsed, the transaction transitions to RollingBack (if any commits
// exist) or Failed (if none do).
// Defaults to 30 minutes.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`
}
TransactionSpec defines the desired state of a Transaction.
func (*TransactionSpec) DeepCopy ¶
func (in *TransactionSpec) DeepCopy() *TransactionSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionSpec.
func (*TransactionSpec) DeepCopyInto ¶
func (in *TransactionSpec) DeepCopyInto(out *TransactionSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TransactionStatus ¶
type TransactionStatus struct {
// Phase is the current phase of the transaction state machine.
// +optional
Phase TransactionPhase `json:"phase,omitempty"`
// Version is incremented on each status update to detect stale writes.
Version int64 `json:"version"`
// Items tracks the per-resource state for each ResourceChange.
// +optional
// +listType=map
// +listMapKey=name
Items []ItemStatus `json:"items,omitempty"`
// RollbackRef is the name of the ConfigMap storing rollback data.
// +optional
RollbackRef string `json:"rollbackRef,omitempty"`
// StartedAt is when the transaction began processing.
// +optional
StartedAt *metav1.Time `json:"startedAt,omitempty"`
// CompletedAt is when the transaction reached a terminal state.
// +optional
CompletedAt *metav1.Time `json:"completedAt,omitempty"`
// Conditions represent the latest available observations.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
TransactionStatus defines the observed state of a Transaction.
func (*TransactionStatus) DeepCopy ¶
func (in *TransactionStatus) DeepCopy() *TransactionStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionStatus.
func (*TransactionStatus) DeepCopyInto ¶
func (in *TransactionStatus) DeepCopyInto(out *TransactionStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.