v1alpha1

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the API group of version v1alpha1 +kubebuilder:object:generate=true +k8s:openapi-gen=true +groupName=control.kubestellar.io

Index

Constants

View Source
const (
	// ExecutingCountKey is the name (AKA key) of an annotation on a workload object.
	// This annotation is written by the KubeStellar implementation to report on
	// the number of executing copies of that object.
	// This annotation is maintained while that number is intended to be 1
	// (see the `WantSingletonReportedState` field above).
	// The value of this annotation is a string representing the number of
	// executing copies.  While this annotation is present with the value "1",
	// the reported state is being returned into this workload object (the design
	// of an API object typically assumes that it is taking effect in just one cluster).
	// For reported state from a general number of executing copies, see the
	// mailboxwatch library and the aspiration for summarization.
	ExecutingCountKey string = "kubestellar.io/executing-count"

	ValidationErrorKeyPrefix string = "validation-error.kubestellar.io/"

	// BindingPolicyConditionSatisfied means BindingPolicy requirements are satisfied.
	// A BindingPolicy is not satisfied only if the set of selected clusters is empty
	BindingPolicyConditionSatisfied string = "BindingPolicySatisfied"

	// BindingPolicyConditionMisconfigured means BindingPolicy configuration is incorrect.
	BindingPolicyConditionMisconfigured string = "BindingPolicyMisconfigured"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "control.kubestellar.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: mygroup.GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func AreConditionSlicesSame

func AreConditionSlicesSame(c1, c2 []BindingPolicyCondition) bool

areConditionSlicesSame compares two slices of BindingPolicyCondition structs and returns true if they are the same (ignoring order and LastTransitionTime and LastUpdateTime), false otherwise.

func AreConditionsEqual

func AreConditionsEqual(c1, c2 BindingPolicyCondition) bool

areConditionsEqual compares two BindingPolicyCondition structs and returns true if they are equal (excluding LastTransitionTime and LastUpdateTime), false otherwise.

func EnsureCondition

func EnsureCondition(cp *BindingPolicy, newCondition BindingPolicyCondition)

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type Binding

type Binding struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// `spec` explicitly describes a desired binding between workloads and Locations.
	// It reflects the resolution of a BindingPolicy's selectors.
	Spec BindingSpec `json:"spec,omitempty"`
}

Binding is mapped 1:1 to a single BindingPolicy object. Binding reflects the resolution of the BindingPolicy's selectors, and explicitly reflects which objects should go to what destinations.

+genclient +genclient:nonNamespaced +kubebuilder:object:root=true +kubebuilder:resource:scope=Cluster,shortName={bdg}

func (*Binding) DeepCopy

func (in *Binding) DeepCopy() *Binding

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Binding.

func (*Binding) DeepCopyInto

func (in *Binding) DeepCopyInto(out *Binding)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Binding) DeepCopyObject

func (in *Binding) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BindingList

type BindingList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Binding `json:"items"`
}

BindingList is the API type for a list of Binding

+kubebuilder:object:root=true

func (*BindingList) DeepCopy

func (in *BindingList) DeepCopy() *BindingList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingList.

func (*BindingList) DeepCopyInto

func (in *BindingList) DeepCopyInto(out *BindingList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BindingList) DeepCopyObject

func (in *BindingList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BindingPolicy

type BindingPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BindingPolicySpec   `json:"spec,omitempty"`
	Status BindingPolicyStatus `json:"status,omitempty"`
}

BindingPolicy defines in which ways the workload objects ('what') and the destinations ('where') are bound together. +genclient +genclient:nonNamespaced +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +kubebuilder:printcolumn:name="TYPE",type="string",JSONPath=".spec.type" +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +kubebuilder:resource:scope=Cluster,shortName={bp}

func (*BindingPolicy) DeepCopy

func (in *BindingPolicy) DeepCopy() *BindingPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPolicy.

func (*BindingPolicy) DeepCopyInto

func (in *BindingPolicy) DeepCopyInto(out *BindingPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BindingPolicy) DeepCopyObject

func (in *BindingPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BindingPolicyCondition

type BindingPolicyCondition struct {
	Type               ConditionType          `json:"type"`
	Status             corev1.ConditionStatus `json:"status"`
	LastUpdateTime     metav1.Time            `json:"lastUpdateTime"`
	LastTransitionTime metav1.Time            `json:"lastTransitionTime"`
	Reason             ConditionReason        `json:"reason"`
	Message            string                 `json:"message"`
}

BindingPolicyCondition describes the state of a bindingpolicy at a certain point.

func ConditionAvailable

func ConditionAvailable() BindingPolicyCondition

Available returns a condition that indicates the resource is currently observed to be available for use.

func ConditionCreating

func ConditionCreating() BindingPolicyCondition

Creating returns a condition that indicates the cp is currently being created.

func ConditionDeleting

func ConditionDeleting() BindingPolicyCondition

Deleting returns a condition that indicates the cp is currently being deleted.

func ConditionReconcileError

func ConditionReconcileError(err error) BindingPolicyCondition

ReconcileError returns a condition indicating that KubeFlex encountered an error while reconciling the resource.

func ConditionReconcileSuccess

func ConditionReconcileSuccess() BindingPolicyCondition

ReconcileSuccess returns a condition indicating that KubeFlex reconciled the resource

func ConditionUnavailable

func ConditionUnavailable() BindingPolicyCondition

Unavailable returns a condition that indicates the resource is not currently available for use.

func SetCondition

func SetCondition(conditions []BindingPolicyCondition, newCondition BindingPolicyCondition) []BindingPolicyCondition

setCondition sets the supplied BindingPolicyCondition in the given slice of conditions, replacing any existing conditions of the same type. Returns the updated slice of conditions.

func (*BindingPolicyCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPolicyCondition.

func (*BindingPolicyCondition) DeepCopyInto

func (in *BindingPolicyCondition) DeepCopyInto(out *BindingPolicyCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BindingPolicyList

type BindingPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BindingPolicy `json:"items"`
}

BindingPolicyList contains a list of BindingPolicies

func (*BindingPolicyList) DeepCopy

func (in *BindingPolicyList) DeepCopy() *BindingPolicyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPolicyList.

func (*BindingPolicyList) DeepCopyInto

func (in *BindingPolicyList) DeepCopyInto(out *BindingPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BindingPolicyList) DeepCopyObject

func (in *BindingPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BindingPolicySpec

type BindingPolicySpec struct {
	// `clusterSelectors` identifies the relevant Cluster objects in terms of their labels.
	// A Cluster is relevant if and only if it passes any of the LabelSelectors in this field.
	ClusterSelectors []metav1.LabelSelector `json:"clusterSelectors,omitempty"`

	// `downsync` selects the objects to bind with the selected Locations for downsync.
	// An object is selected if it matches at least one member of this list.
	// +optional
	Downsync []DownsyncObjectTest `json:"downsync,omitempty"`

	// WantSingletonReportedState indicates that (a) the number of selected locations is intended
	// to be 1 and (b) the reported state of each downsynced object should be returned back to
	// the object in this space.
	// When this field is true, there should be no other BindingPolicy that matches any of the
	// same workload objects.
	//
	// At the moment, it is the user's responsibility to comply to the above.
	// +optional
	WantSingletonReportedState bool `json:"wantSingletonReportedState,omitempty"`
}

BindingPolicySpec defines the desired state of BindingPolicy

func (*BindingPolicySpec) DeepCopy

func (in *BindingPolicySpec) DeepCopy() *BindingPolicySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPolicySpec.

func (*BindingPolicySpec) DeepCopyInto

func (in *BindingPolicySpec) DeepCopyInto(out *BindingPolicySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BindingPolicyStatus

type BindingPolicyStatus struct {
	Conditions         []BindingPolicyCondition `json:"conditions"`
	ObservedGeneration int64                    `json:"observedGeneration"`
}

BindingPolicyStatus defines the observed state of BindingPolicy

func (*BindingPolicyStatus) DeepCopy

func (in *BindingPolicyStatus) DeepCopy() *BindingPolicyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPolicyStatus.

func (*BindingPolicyStatus) DeepCopyInto

func (in *BindingPolicyStatus) DeepCopyInto(out *BindingPolicyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BindingSpec

type BindingSpec struct {
	// `workload` is a collection of namespaced and cluster scoped object references and their associated
	// resource versions, to be propagated to destination clusters.
	Workload DownsyncObjectReferences `json:"workload,omitempty"`

	// `destinations` is a list of cluster-identifiers that the objects should be propagated to.
	Destinations []Destination `json:"destinations,omitempty"`
}

BindingSpec holds a list of object references with their associated resource versions, and a list of destinations which are the resolution of a BindingPolicy's `what` and `where`: what objects to propagate and to where. All objects referenced in this spec are propagated to all destinations present.

func (*BindingSpec) DeepCopy

func (in *BindingSpec) DeepCopy() *BindingSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingSpec.

func (*BindingSpec) DeepCopyInto

func (in *BindingSpec) DeepCopyInto(out *BindingSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterScopeDownsyncObject added in v0.21.0

type ClusterScopeDownsyncObject struct {
	metav1.GroupVersionResource `json:",inline"`
	// `name` of the object to downsync.
	Name string `json:"name"`
	// `resourceVersion` is the version of the resource to downsync.
	ResourceVersion string `json:"resourceVersion"`
}

ClusterScopeDownsyncObject represents a specific cluster-scoped object to downsync, identified by its GroupVersionResource and name. The ResourceVersion specifies the exact version of the object to downsync.

func (*ClusterScopeDownsyncObject) DeepCopy added in v0.21.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScopeDownsyncObject.

func (*ClusterScopeDownsyncObject) DeepCopyInto added in v0.21.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConditionReason

type ConditionReason string
const (
	ReasonAvailable   ConditionReason = "Available"
	ReasonUnavailable ConditionReason = "Unavailable"
	ReasonCreating    ConditionReason = "Creating"
	ReasonDeleting    ConditionReason = "Deleting"
)
const (
	ReasonReconcileSuccess ConditionReason = "ReconcileSuccess"
	ReasonReconcileError   ConditionReason = "ReconcileError"
	ReasonReconcilePaused  ConditionReason = "ReconcilePaused"
)

type ConditionType

type ConditionType string
const (
	TypeReady  ConditionType = "Ready"
	TypeSynced ConditionType = "Synced"
)

type Destination

type Destination struct {
	ClusterId string `json:"clusterId,omitempty"`
}

Destination wraps the identifiers required to uniquely identify a destination cluster.

func (*Destination) DeepCopy

func (in *Destination) DeepCopy() *Destination

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Destination.

func (*Destination) DeepCopyInto

func (in *Destination) DeepCopyInto(out *Destination)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DownsyncObjectReferences

type DownsyncObjectReferences struct {
	// `clusterScope` holds a list of cluster-scoped object references with their associated
	// resource versions to downsync.
	ClusterScope []ClusterScopeDownsyncObject `json:"clusterScope,omitempty"`

	// `namespaceScope` holds a list of namespace-scoped object references with their associated
	// resource versions to downsync.
	NamespaceScope []NamespaceScopeDownsyncObject `json:"namespaceScope,omitempty"`
}

DownsyncObjectReferences defines the objects to be down-synced, grouping them by scope. It specifies a set of object references with their associated resource versions, to be downsynced. This effectively acts as a map from object reference to ResourceVersion.

func (*DownsyncObjectReferences) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownsyncObjectReferences.

func (*DownsyncObjectReferences) DeepCopyInto

func (in *DownsyncObjectReferences) DeepCopyInto(out *DownsyncObjectReferences)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DownsyncObjectTest

type DownsyncObjectTest struct {
	// `apiGroup` is the API group of the referenced object, empty string for the core API group.
	// `nil` matches every API group.
	// +optional
	APIGroup *string `json:"apiGroup"`

	// `resources` is a list of lowercase plural names for the sorts of objects to match.
	// An entry of `"*"` means that all match.
	// If this list contains `"*"` then it should contain nothing else.
	// Empty list is a special case, it matches every object.
	// +optional
	Resources []string `json:"resources,omitempty"`

	// `namespaces` is a list of acceptable names for the object's namespace.
	// An entry of `"*"` means that any namespace is acceptable;
	// this is the only way to match a cluster-scoped object.
	// If this list contains `"*"` then it should contain nothing else.
	// Empty list is a special case, it matches every object.
	// +optional
	Namespaces []string `json:"namespaces,omitempty"`

	// `namespaceSelectors` a list of label selectors.
	// For a namespaced object, at least one of these label selectors has to match
	// the labels of the Namespace object that defines the namespace of the object that this DownsyncObjectTest is testing.
	// For a cluster-scoped object, at least one of these label selectors must be `{}`.
	// Empty list is a special case, it matches every object.
	// +optional
	NamespaceSelectors []metav1.LabelSelector `json:"namespaceSelectors,omitempty"`

	// `objectSelectors` is a list of label selectors.
	// At least one of them must match the labels of the object being tested.
	// Empty list is a special case, it matches every object.
	// +optional
	ObjectSelectors []metav1.LabelSelector `json:"objectSelectors,omitempty"`

	// `objectNames` is a list of object names that match.
	// An entry of `"*"` means that all match.
	// If this list contains `"*"` then it should contain nothing else.
	// Empty list is a special case, it matches every object.
	// +optional
	ObjectNames []string `json:"objectNames,omitempty"`
}

DownsyncObjectTest is a set of criteria that characterize matching objects. An object matches if: - the `apiGroup` criterion is satisfied; - the `resources` criterion is satisfied; - the `namespaces` criterion is satisfied; - the `namespaceSelectors` criterion is satisfied; - the `objectNames` criterion is satisfied; and - the `objectSelectors` criterion is satisfied. At least one of the fields must make some discrimination; it is not valid for every field to match all objects. Validation might not be fully checked by apiservers until the Kubernetes dependency is release 1.25; in the meantime validation error messages will appear in annotations whose key is `validation-error.kubestellar.io/{number}`.

func (*DownsyncObjectTest) DeepCopy

func (in *DownsyncObjectTest) DeepCopy() *DownsyncObjectTest

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownsyncObjectTest.

func (*DownsyncObjectTest) DeepCopyInto

func (in *DownsyncObjectTest) DeepCopyInto(out *DownsyncObjectTest)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceScopeDownsyncObject added in v0.21.0

type NamespaceScopeDownsyncObject struct {
	metav1.GroupVersionResource `json:",inline"`
	// `namespace` of the object to downsync.
	Namespace string `json:"namespace"`
	// `name` of the object to downsync.
	Name string `json:"name"`
	// `resourceVersion` is the version of the resource to downsync.
	ResourceVersion string `json:"resourceVersion"`
}

NamespaceScopeDownsyncObject represents a specific namespace-scoped object to downsync, identified by its GroupVersionResource, namespace, and name. The ResourceVersion specifies the exact version of the object to downsync.

func (*NamespaceScopeDownsyncObject) DeepCopy added in v0.21.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceScopeDownsyncObject.

func (*NamespaceScopeDownsyncObject) DeepCopyInto added in v0.21.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL