v1beta1

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

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

+kubebuilder:object:generate=true +groupName=cluster.kubernetes-fleet.io

Index

Constants

View Source
const (
	MemberClusterKind                = "MemberCluster"
	MemberClusterResource            = "memberclusters"
	InternalMemberClusterKind        = "InternalMemberCluster"
	ClusterResourcePlacementResource = "clusterresourceplacements"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "cluster.kubernetes-fleet.io", Version: "v1beta1"}

	// 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 AgentConditionType

type AgentConditionType string

AgentConditionType identifies a specific condition on the Agent.

const (
	// AgentJoined indicates the join condition of the given member agent.
	// Its condition status can be one of the following:
	// - "True" means the member agent has joined.
	// - "False" means the member agent has left.
	// - "Unknown" means the member agent is joining or leaving or in an unknown status.
	AgentJoined AgentConditionType = "Joined"
	// AgentHealthy indicates the health condition of the given member agent.
	// Its condition status can be one of the following:
	// - "True" means the member agent is healthy.
	// - "False" means the member agent is unhealthy.
	// - "Unknown" means the member agent has an unknown health status.
	AgentHealthy AgentConditionType = "Healthy"
)

type AgentStatus

type AgentStatus struct {
	// Type of the member agent.
	// +required
	Type AgentType `json:"type"`

	// Conditions is an array of current observed conditions for the member agent.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Last time we received a heartbeat from the member agent.
	// +optional
	LastReceivedHeartbeat metav1.Time `json:"lastReceivedHeartbeat,omitempty"`
}

AgentStatus defines the observed status of the member agent of the given type.

func (*AgentStatus) DeepCopy

func (in *AgentStatus) DeepCopy() *AgentStatus

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

func (*AgentStatus) DeepCopyInto

func (in *AgentStatus) DeepCopyInto(out *AgentStatus)

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

type AgentType

type AgentType string

AgentType defines a type of agent/binary running in a member cluster.

const (
	// MemberAgent (core) handles member cluster joining/leaving as well as k8s object placement from hub to member clusters.
	MemberAgent AgentType = "MemberAgent"
	// MultiClusterServiceAgent (networking) is responsible for exposing multi-cluster services via L4 load
	// balancer.
	MultiClusterServiceAgent AgentType = "MultiClusterServiceAgent"
	// ServiceExportImportAgent (networking) is responsible for export or import services across multi-clusters.
	ServiceExportImportAgent AgentType = "ServiceExportImportAgent"
)

type ClusterState

type ClusterState string
const (
	ClusterStateJoin  ClusterState = "Join"
	ClusterStateLeave ClusterState = "Leave"
)

type ConditionedAgentObj

type ConditionedAgentObj interface {
	client.Object
	ConditionedWithType
}

A ConditionedAgentObj is for kubernetes resources where multiple agents can set and update conditions within AgentStatus. +kubebuilder:object:generate=false

type ConditionedWithType

type ConditionedWithType interface {
	SetConditionsWithType(AgentType, ...metav1.Condition)
	GetConditionWithType(AgentType, string) *metav1.Condition
}

A ConditionedWithType may have conditions set or retrieved based on agent type. Conditions typically indicate the status of both a resource and its reconciliation process. +kubebuilder:object:generate=false

type InternalMemberCluster

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

	// The desired state of InternalMemberCluster.
	// +required
	Spec InternalMemberClusterSpec `json:"spec"`

	// The observed status of InternalMemberCluster.
	// +optional
	Status InternalMemberClusterStatus `json:"status,omitempty"`
}

InternalMemberCluster is used by hub agent to notify the member agents about the member cluster state changes, and is used by the member agents to report their status.

func (*InternalMemberCluster) DeepCopy

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

func (*InternalMemberCluster) DeepCopyInto

func (in *InternalMemberCluster) DeepCopyInto(out *InternalMemberCluster)

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

func (*InternalMemberCluster) DeepCopyObject

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

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

func (*InternalMemberCluster) GetAgentStatus

func (m *InternalMemberCluster) GetAgentStatus(agentType AgentType) *AgentStatus

GetAgentStatus is used to retrieve agent status from internal member cluster, if it doesn't exist it creates the expected agent status and returns it.

func (*InternalMemberCluster) GetConditionWithType

func (m *InternalMemberCluster) GetConditionWithType(agentType AgentType, conditionType string) *metav1.Condition

GetConditionWithType is used to retrieve the desired condition from AgentStatus for given agentType

func (*InternalMemberCluster) SetConditionsWithType

func (m *InternalMemberCluster) SetConditionsWithType(agentType AgentType, conditions ...metav1.Condition)

SetConditionsWithType is used to add condition to AgentStatus for a given agentType.

type InternalMemberClusterList

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

InternalMemberClusterList contains a list of InternalMemberCluster.

func (*InternalMemberClusterList) DeepCopy

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

func (*InternalMemberClusterList) DeepCopyInto

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

func (*InternalMemberClusterList) DeepCopyObject

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

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

type InternalMemberClusterSpec

type InternalMemberClusterSpec struct {

	// The desired state of the member cluster. Possible values: Join, Leave.
	// +required
	State ClusterState `json:"state"`

	// How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes.
	// +optional
	HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"`
}

InternalMemberClusterSpec defines the desired state of InternalMemberCluster. Set by the hub agent.

func (*InternalMemberClusterSpec) DeepCopy

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

func (*InternalMemberClusterSpec) DeepCopyInto

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

type InternalMemberClusterStatus

type InternalMemberClusterStatus struct {
	// Conditions is an array of current observed conditions for the member cluster.
	// +optional
	Conditions []metav1.Condition `json:"conditions"`

	// Properties is an array of properties observed for the member cluster.
	//
	// This field is beta-level; it is for the property-based scheduling feature and is only
	// populated when a property provider is enabled in the deployment.
	// +optional
	Properties map[PropertyName]PropertyValue `json:"properties,omitempty"`

	// The current observed resource usage of the member cluster. It is populated by the member agent.
	// +optional
	ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"`

	// AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster.
	// +optional
	AgentStatus []AgentStatus `json:"agentStatus,omitempty"`
}

InternalMemberClusterStatus defines the observed state of InternalMemberCluster.

func (*InternalMemberClusterStatus) DeepCopy

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

func (*InternalMemberClusterStatus) DeepCopyInto

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

type MemberCluster

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

	// The desired state of MemberCluster.
	// +required
	Spec MemberClusterSpec `json:"spec"`

	// The observed status of MemberCluster.
	// +optional
	Status MemberClusterStatus `json:"status,omitempty"`
}

MemberCluster is a resource created in the hub cluster to represent a member cluster within a fleet.

func (*MemberCluster) DeepCopy

func (in *MemberCluster) DeepCopy() *MemberCluster

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

func (*MemberCluster) DeepCopyInto

func (in *MemberCluster) DeepCopyInto(out *MemberCluster)

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

func (*MemberCluster) DeepCopyObject

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

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

func (*MemberCluster) GetAgentCondition

func (m *MemberCluster) GetAgentCondition(agentType AgentType, conditionType AgentConditionType) *metav1.Condition

GetAgentCondition queries the conditions in an agent status for a specific condition type.

func (*MemberCluster) GetAgentStatus

func (m *MemberCluster) GetAgentStatus(agentType AgentType) *AgentStatus

GetAgentStatus retrieves the status of a specific member agent from the MemberCluster object.

If the specified agent does not exist, or it has not updated its status with the hub cluster yet, this function returns nil.

func (*MemberCluster) GetCondition

func (m *MemberCluster) GetCondition(conditionType string) *metav1.Condition

func (*MemberCluster) RemoveCondition

func (m *MemberCluster) RemoveCondition(conditionType string)

func (*MemberCluster) SetConditions

func (m *MemberCluster) SetConditions(conditions ...metav1.Condition)

type MemberClusterConditionType

type MemberClusterConditionType string

MemberClusterConditionType defines a specific condition of a member cluster.

const (
	// ConditionTypeMemberClusterReadyToJoin indicates the readiness condition of the given member cluster for joining the hub cluster.
	// Its condition status can be one of the following:
	// - "True" means the hub cluster is ready for the member cluster to join.
	// - "False" means the hub cluster is not ready for the member cluster to join.
	// - "Unknown" means it is unknown whether the hub cluster is ready for the member cluster to join.
	ConditionTypeMemberClusterReadyToJoin MemberClusterConditionType = "ReadyToJoin"

	// ConditionTypeMemberClusterJoined indicates the join condition of the given member cluster.
	// Its condition status can be one of the following:
	// - "True" means all the agents on the member cluster have joined.
	// - "False" means all the agents on the member cluster have left.
	// - "Unknown" means not all the agents have joined or left.
	ConditionTypeMemberClusterJoined MemberClusterConditionType = "Joined"

	// ConditionTypeMemberClusterHealthy indicates the health condition of the given member cluster.
	// Its condition status can be one of the following:
	// - "True" means the member cluster is healthy.
	// - "False" means the member cluster is unhealthy.
	// - "Unknown" means the member cluster has an unknown health status.
	// NOTE: This condition type is currently unused.
	ConditionTypeMemberClusterHealthy MemberClusterConditionType = "Healthy"

	// ConditionTypeClusterPropertyProviderStarted indicates the startup condition of the configured
	// cluster property provider (if any).
	// Its condition status can be one of the following:
	// - "True" means the cluster property provider has started.
	// - "False" means the cluster property provider has failed to start.
	// - "Unknown" means it is unknown whether the cluster property provider has started or not.
	ConditionTypeClusterPropertyProviderStarted MemberClusterConditionType = "ClusterPropertyProviderStarted"

	// ConditionTypeClusterPropertyCollectionSucceeded indicates the
	// condition of the latest attempt to collect cluster properties from the configured
	// cluster property provider (if any).
	// Its condition status can be one of the following:
	// - "True" means the cluster property collection has succeeded.
	// - "False" means the cluster property collection has failed.
	// - "Unknown" means it is unknown whether the cluster property collection has succeeded or not.
	ConditionTypeClusterPropertyCollectionSucceeded MemberClusterConditionType = "ClusterPropertyCollectionSucceeded"
)

type MemberClusterList

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

MemberClusterList contains a list of MemberCluster.

func (*MemberClusterList) DeepCopy

func (in *MemberClusterList) DeepCopy() *MemberClusterList

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

func (*MemberClusterList) DeepCopyInto

func (in *MemberClusterList) DeepCopyInto(out *MemberClusterList)

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

func (*MemberClusterList) DeepCopyObject

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

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

type MemberClusterSpec

type MemberClusterSpec struct {

	// The identity used by the member cluster to access the hub cluster.
	// The hub agents deployed on the hub cluster will automatically grant the minimal required permissions to this identity for the member agents deployed on the member cluster to access the hub cluster.
	// +required
	Identity rbacv1.Subject `json:"identity"`

	// How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes.
	// +optional
	HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"`

	// If specified, the MemberCluster's taints.
	//
	// This field is beta-level and is for the taints and tolerations feature.
	// +kubebuilder:validation:MaxItems=100
	// +optional
	Taints []Taint `json:"taints,omitempty"`
}

MemberClusterSpec defines the desired state of MemberCluster.

func (*MemberClusterSpec) DeepCopy

func (in *MemberClusterSpec) DeepCopy() *MemberClusterSpec

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

func (*MemberClusterSpec) DeepCopyInto

func (in *MemberClusterSpec) DeepCopyInto(out *MemberClusterSpec)

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

type MemberClusterStatus

type MemberClusterStatus struct {

	// Conditions is an array of current observed conditions for the member cluster.
	// +optional
	Conditions []metav1.Condition `json:"conditions"`

	// Properties is an array of properties observed for the member cluster.
	//
	// This field is beta-level; it is for the property-based scheduling feature and is only
	// populated when a property provider is enabled in the deployment.
	// +optional
	Properties map[PropertyName]PropertyValue `json:"properties,omitempty"`

	// The current observed resource usage of the member cluster. It is copied from the corresponding InternalMemberCluster object.
	// +optional
	ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"`

	// AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster.
	// +optional
	AgentStatus []AgentStatus `json:"agentStatus,omitempty"`
}

MemberClusterStatus defines the observed status of MemberCluster.

func (*MemberClusterStatus) DeepCopy

func (in *MemberClusterStatus) DeepCopy() *MemberClusterStatus

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

func (*MemberClusterStatus) DeepCopyInto

func (in *MemberClusterStatus) DeepCopyInto(out *MemberClusterStatus)

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

type PropertyName added in v0.9.2

type PropertyName string

PropertyName is the name of a cluster property; it should be a Kubernetes label name.

type PropertyValue added in v0.9.2

type PropertyValue struct {
	// Value is the value of the cluster property.
	//
	// Currently, it should be a valid Kubernetes quantity.
	// For more information, see
	// https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity.
	//
	// +required
	Value string `json:"value"`

	// ObservationTime is when the cluster property is observed.
	// +required
	ObservationTime metav1.Time `json:"observationTime"`
}

PropertyValue is the value of a cluster property.

func (*PropertyValue) DeepCopy added in v0.9.2

func (in *PropertyValue) DeepCopy() *PropertyValue

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

func (*PropertyValue) DeepCopyInto added in v0.9.2

func (in *PropertyValue) DeepCopyInto(out *PropertyValue)

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

type ResourceUsage

type ResourceUsage struct {
	// Capacity represents the total resource capacity of all the nodes on a member cluster.
	//
	// A node's total capacity is the amount of resource installed on the node.
	// +optional
	Capacity corev1.ResourceList `json:"capacity,omitempty"`

	// Allocatable represents the total allocatable resources of all the nodes on a member cluster.
	//
	// A node's allocatable capacity is the amount of resource that can actually be used
	// for user workloads, i.e.,
	// allocatable capacity = total capacity - capacities reserved for the OS, kubelet, etc.
	//
	// For more information, see
	// https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/.
	// +optional
	Allocatable corev1.ResourceList `json:"allocatable,omitempty"`

	// Available represents the total available resources of all the nodes on a member cluster.
	//
	// A node's available capacity is the amount of resource that has not been used yet, i.e.,
	// available capacity = allocatable capacity - capacity that has been requested by workloads.
	//
	// This field is beta-level; it is for the property-based scheduling feature and is only
	// populated when a property provider is enabled in the deployment.
	// +optional
	Available corev1.ResourceList `json:"available,omitempty"`

	// When the resource usage is observed.
	// +optional
	ObservationTime metav1.Time `json:"observationTime,omitempty"`
}

ResourceUsage contains the observed resource usage of a member cluster.

func (*ResourceUsage) DeepCopy

func (in *ResourceUsage) DeepCopy() *ResourceUsage

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

func (*ResourceUsage) DeepCopyInto

func (in *ResourceUsage) DeepCopyInto(out *ResourceUsage)

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

type Taint added in v0.8.7

type Taint struct {
	// The taint key to be applied to a MemberCluster.
	// +required
	Key string `json:"key"`

	// The taint value corresponding to the taint key.
	// +optional
	Value string `json:"value,omitempty"`

	// The effect of the taint on ClusterResourcePlacements that do not tolerate the taint.
	// Only NoSchedule is supported.
	// +kubebuilder:validation:Enum=NoSchedule
	// +required
	Effect corev1.TaintEffect `json:"effect"`
}

Taint attached to MemberCluster has the "effect" on any ClusterResourcePlacement that does not tolerate the Taint.

func (*Taint) DeepCopy added in v0.8.9

func (in *Taint) DeepCopy() *Taint

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

func (*Taint) DeepCopyInto added in v0.8.9

func (in *Taint) DeepCopyInto(out *Taint)

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