v1alpha1

package
v0.9.8-experimental Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

+kubebuilder:object:generate=true +k8s:deepcopy-gen=package,register +groupName=placement.kubernetes-fleet.io

Index

Constants

View Source
const (

	// ClusterResourceOverrideKind is the kind of the ClusterResourceOverride.
	ClusterResourceOverrideKind = "ClusterResourceOverride"

	// ClusterResourceOverrideSnapshotKind is the kind of the ClusterResourceOverrideSnapshot.
	ClusterResourceOverrideSnapshotKind = "ClusterResourceOverrideSnapshot"

	// ResourceOverrideKind is the kind of the ResourceOverride.
	ResourceOverrideKind = "ResourceOverride"

	// ResourceOverrideSnapshotKind is the kind of the ResourceOverrideSnapshotKind.
	ResourceOverrideSnapshotKind = "ResourceOverrideSnapshot"
)
View Source
const (

	// OverrideIndexLabel is the label that indicate the policy snapshot index of a cluster policy.
	OverrideIndexLabel = fleetPrefix + "override-index"

	// OverrideSnapshotNameFmt is clusterResourceOverrideSnapshot name format: {CROName}-{OverrideSnapshotIndex}.
	OverrideSnapshotNameFmt = "%s-%d"

	// OverrideTrackingLabel is the label that points to the cluster resource override that creates a resource snapshot.
	OverrideTrackingLabel = fleetPrefix + "parent-resource-override"

	// OverrideFinalizer is a finalizer added by the override controllers to all override, to make sure
	// that the override controller can react to override deletions if necessary.
	OverrideFinalizer = fleetPrefix + "override-cleanup"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "placement.kubernetes-fleet.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

This section is empty.

Types

type ClusterResourceOverride

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

	// The desired state of ClusterResourceOverrideSpec.
	// +required
	Spec ClusterResourceOverrideSpec `json:"spec"`
}

ClusterResourceOverride defines a group of override policies about how to override the selected cluster scope resources to target clusters.

func (*ClusterResourceOverride) DeepCopy

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

func (*ClusterResourceOverride) DeepCopyInto

func (in *ClusterResourceOverride) DeepCopyInto(out *ClusterResourceOverride)

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

func (*ClusterResourceOverride) DeepCopyObject

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

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

type ClusterResourceOverrideList

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

ClusterResourceOverrideList contains a list of ClusterResourceOverride. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterResourceOverrideList) DeepCopy

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

func (*ClusterResourceOverrideList) DeepCopyInto

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

func (*ClusterResourceOverrideList) DeepCopyObject

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

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

type ClusterResourceOverrideSnapshot added in v0.8.9

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

	// The desired state of ClusterResourceOverrideSnapshotSpec.
	// +required
	Spec ClusterResourceOverrideSnapshotSpec `json:"spec"`
}

ClusterResourceOverrideSnapshot is used to store a snapshot of ClusterResourceOverride. Its spec is immutable. We assign an ever-increasing index for snapshots. The naming convention of a ClusterResourceOverrideSnapshot is {ClusterResourceOverride}-{resourceIndex}. resourceIndex will begin with 0. Each snapshot MUST have the following labels:

  • `OverrideTrackingLabel` which points to its owner ClusterResourceOverride.
  • `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one.

func (*ClusterResourceOverrideSnapshot) DeepCopy added in v0.8.9

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

func (*ClusterResourceOverrideSnapshot) DeepCopyInto added in v0.8.9

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

func (*ClusterResourceOverrideSnapshot) DeepCopyObject added in v0.8.9

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

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

type ClusterResourceOverrideSnapshotList added in v0.8.9

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

ClusterResourceOverrideSnapshotList contains a list of ClusterResourceOverrideSnapshot. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterResourceOverrideSnapshotList) DeepCopy added in v0.8.9

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

func (*ClusterResourceOverrideSnapshotList) DeepCopyInto added in v0.8.9

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

func (*ClusterResourceOverrideSnapshotList) DeepCopyObject added in v0.8.9

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

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

type ClusterResourceOverrideSnapshotSpec added in v0.8.9

type ClusterResourceOverrideSnapshotSpec struct {
	// OverrideSpec stores the spec of ClusterResourceOverride.
	OverrideSpec ClusterResourceOverrideSpec `json:"overrideSpec"`

	// OverrideHash is the sha-256 hash value of the OverrideSpec field.
	// +required
	OverrideHash []byte `json:"overrideHash"`
}

ClusterResourceOverrideSnapshotSpec defines the desired state of ClusterResourceOverride.

func (*ClusterResourceOverrideSnapshotSpec) DeepCopy added in v0.8.9

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

func (*ClusterResourceOverrideSnapshotSpec) DeepCopyInto added in v0.8.9

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

type ClusterResourceOverrideSpec

type ClusterResourceOverrideSpec struct {
	// ClusterResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`.
	// If a namespace is selected, ALL the resources under the namespace are selected automatically.
	// LabelSelector is not supported.
	// You can have 1-20 selectors.
	// We only support Name selector for now.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=20
	// +required
	ClusterResourceSelectors []placementv1beta1.ClusterResourceSelector `json:"clusterResourceSelectors"`

	// Policy defines how to override the selected resources on the target clusters.
	// +required
	Policy *OverridePolicy `json:"policy"`
}

ClusterResourceOverrideSpec defines the desired state of the Override. The ClusterResourceOverride create or update will fail when the resource has been selected by the existing ClusterResourceOverride. If the resource is selected by both ClusterResourceOverride and ResourceOverride, ResourceOverride will win when resolving conflicts.

func (*ClusterResourceOverrideSpec) DeepCopy

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

func (*ClusterResourceOverrideSpec) DeepCopyInto

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

type JSONPatchOverride

type JSONPatchOverride struct {
	// Operator defines the operation on the target field.
	// +kubebuilder:validation:Enum=add;remove;replace
	// +required
	Operator JSONPatchOverrideOperator `json:"op"`
	// Path defines the target location.
	// Note: override will fail if the resource path does not exist.
	// +required
	Path string `json:"path"`
	// Value defines the content to be applied on the target location.
	// Value should be empty when operator is `remove`.
	// +optional
	Value apiextensionsv1.JSON `json:"value,omitempty"`
}

JSONPatchOverride applies a JSON patch on the selected resources following [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902).

func (*JSONPatchOverride) DeepCopy

func (in *JSONPatchOverride) DeepCopy() *JSONPatchOverride

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

func (*JSONPatchOverride) DeepCopyInto

func (in *JSONPatchOverride) DeepCopyInto(out *JSONPatchOverride)

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

type JSONPatchOverrideOperator

type JSONPatchOverrideOperator string

JSONPatchOverrideOperator defines the supported JSON patch operator.

const (
	// JSONPatchOverrideOpAdd adds the value to the target location.
	// An example target JSON document:
	//
	//   { "foo": [ "bar", "baz" ] }
	//
	//   A JSON Patch override:
	//
	//   [
	//     { "op": "add", "path": "/foo/1", "value": "qux" }
	//   ]
	//
	//   The resulting JSON document:
	//
	//   { "foo": [ "bar", "qux", "baz" ] }
	JSONPatchOverrideOpAdd JSONPatchOverrideOperator = "add"
	// JSONPatchOverrideOpRemove removes the value from the target location.
	// An example target JSON document:
	//
	//   {
	//     "baz": "qux",
	//     "foo": "bar"
	//   }
	//   A JSON Patch override:
	//
	//   [
	//     { "op": "remove", "path": "/baz" }
	//   ]
	//
	//   The resulting JSON document:
	//
	//   { "foo": "bar" }
	JSONPatchOverrideOpRemove JSONPatchOverrideOperator = "remove"
	// JSONPatchOverrideOpReplace replaces the value at the target location with a new value.
	// An example target JSON document:
	//
	//   {
	//     "baz": "qux",
	//     "foo": "bar"
	//   }
	//
	//   A JSON Patch override:
	//
	//   [
	//     { "op": "replace", "path": "/baz", "value": "boo" }
	//   ]
	//
	//   The resulting JSON document:
	//
	//   {
	//     "baz": "boo",
	//     "foo": "bar"
	//   }
	JSONPatchOverrideOpReplace JSONPatchOverrideOperator = "replace"
)

type OverridePolicy

type OverridePolicy struct {
	// OverrideRules defines an array of override rules to be applied on the selected resources.
	// The order of the rules determines the override order.
	// When there are two rules selecting the same fields on the target cluster, the last one will win.
	// You can have 1-20 rules.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=20
	// +required
	OverrideRules []OverrideRule `json:"overrideRules"`
}

OverridePolicy defines how to override the selected resources on the target clusters. More is to be added.

func (*OverridePolicy) DeepCopy

func (in *OverridePolicy) DeepCopy() *OverridePolicy

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

func (*OverridePolicy) DeepCopyInto

func (in *OverridePolicy) DeepCopyInto(out *OverridePolicy)

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

type OverrideRule

type OverrideRule struct {
	// ClusterSelectors selects the target clusters.
	// The resources will be overridden before applying to the matching clusters.
	// An empty clusterSelector selects ALL the member clusters.
	// A nil clusterSelector selects NO member clusters.
	// For now, only labelSelector is supported.
	// +optional
	ClusterSelector *placementv1beta1.ClusterSelector `json:"clusterSelector,omitempty"`

	// JSONPatchOverrides defines a list of JSON patch override rules.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=20
	// +required
	JSONPatchOverrides []JSONPatchOverride `json:"jsonPatchOverrides"`
}

OverrideRule defines how to override the selected resources on the target clusters.

func (*OverrideRule) DeepCopy

func (in *OverrideRule) DeepCopy() *OverrideRule

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

func (*OverrideRule) DeepCopyInto

func (in *OverrideRule) DeepCopyInto(out *OverrideRule)

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

type ResourceOverride

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

	// The desired state of ResourceOverrideSpec.
	// +required
	Spec ResourceOverrideSpec `json:"spec"`
}

ResourceOverride defines a group of override policies about how to override the selected namespaced scope resources to target clusters.

func (*ResourceOverride) DeepCopy

func (in *ResourceOverride) DeepCopy() *ResourceOverride

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

func (*ResourceOverride) DeepCopyInto

func (in *ResourceOverride) DeepCopyInto(out *ResourceOverride)

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

func (*ResourceOverride) DeepCopyObject

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

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

type ResourceOverrideList

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

ResourceOverrideList contains a list of ResourceOverride. +kubebuilder:resource:scope="Namespaced" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ResourceOverrideList) DeepCopy

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

func (*ResourceOverrideList) DeepCopyInto

func (in *ResourceOverrideList) DeepCopyInto(out *ResourceOverrideList)

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

func (*ResourceOverrideList) DeepCopyObject

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

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

type ResourceOverrideSnapshot added in v0.8.9

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

	// The desired state of ResourceOverrideSnapshot.
	// +required
	Spec ResourceOverrideSnapshotSpec `json:"spec"`
}

ResourceOverrideSnapshot is used to store a snapshot of ResourceOverride. Its spec is immutable. We assign an ever-increasing index for snapshots. The naming convention of a ResourceOverrideSnapshot is {ResourceOverride}-{resourceIndex}. resourceIndex will begin with 0. Each snapshot MUST have the following labels:

  • `OverrideTrackingLabel` which points to its owner ResourceOverride.
  • `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one.

func (*ResourceOverrideSnapshot) DeepCopy added in v0.8.9

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

func (*ResourceOverrideSnapshot) DeepCopyInto added in v0.8.9

func (in *ResourceOverrideSnapshot) DeepCopyInto(out *ResourceOverrideSnapshot)

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

func (*ResourceOverrideSnapshot) DeepCopyObject added in v0.8.9

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

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

type ResourceOverrideSnapshotList added in v0.8.9

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

ResourceOverrideSnapshotList contains a list of ResourceOverrideSnapshot. +kubebuilder:resource:scope="Namespaced" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ResourceOverrideSnapshotList) DeepCopy added in v0.8.9

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

func (*ResourceOverrideSnapshotList) DeepCopyInto added in v0.8.9

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

func (*ResourceOverrideSnapshotList) DeepCopyObject added in v0.8.9

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

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

type ResourceOverrideSnapshotSpec added in v0.8.9

type ResourceOverrideSnapshotSpec struct {
	// OverrideSpec stores the spec of ResourceOverride.
	OverrideSpec ResourceOverrideSpec `json:"overrideSpec"`

	// OverrideHash is the sha-256 hash value of the OverrideSpec field.
	// +required
	OverrideHash []byte `json:"overrideHash"`
}

ResourceOverrideSnapshotSpec defines the desired state of ResourceOverride.

func (*ResourceOverrideSnapshotSpec) DeepCopy added in v0.8.9

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

func (*ResourceOverrideSnapshotSpec) DeepCopyInto added in v0.8.9

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

type ResourceOverrideSpec

type ResourceOverrideSpec struct {
	// ResourceSelectors is an array of selectors used to select namespace scoped resources. The selectors are `ORed`.
	// You can have 1-20 selectors.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=20
	// +required
	ResourceSelectors []ResourceSelector `json:"resourceSelectors"`

	// Policy defines how to override the selected resources on the target clusters.
	// +required
	Policy *OverridePolicy `json:"policy"`
}

ResourceOverrideSpec defines the desired state of the Override. The ResourceOverride create or update will fail when the resource has been selected by the existing ResourceOverride. If the resource is selected by both ClusterResourceOverride and ResourceOverride, ResourceOverride will win when resolving conflicts.

func (*ResourceOverrideSpec) DeepCopy

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

func (*ResourceOverrideSpec) DeepCopyInto

func (in *ResourceOverrideSpec) DeepCopyInto(out *ResourceOverrideSpec)

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

type ResourceSelector

type ResourceSelector struct {
	// Group name of the namespace-scoped resource.
	// Use an empty string to select resources under the core API group (e.g., services).
	// +required
	Group string `json:"group"`

	// Version of the namespace-scoped resource.
	// +required
	Version string `json:"version"`

	// Kind of the namespace-scoped resource.
	// +required
	Kind string `json:"kind"`

	// Name of the namespace-scoped resource.
	// +required
	Name string `json:"name"`
}

ResourceSelector is used to select namespace scoped resources as the target resources to be placed. All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. The resource namespace will inherit from the parent object scope.

func (*ResourceSelector) DeepCopy

func (in *ResourceSelector) DeepCopy() *ResourceSelector

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

func (*ResourceSelector) DeepCopyInto

func (in *ResourceSelector) DeepCopyInto(out *ResourceSelector)

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