Documentation ¶
Index ¶
- Constants
- func ComposeRolePriorityMap(consensusSpec *appsv1alpha1.ConsensusSetSpec) map[string]int
- func DefaultRole(i int32) string
- func GetClusterByObject(ctx context.Context, cli client.Client, obj client.Object) (*appsv1alpha1.Cluster, error)
- func GetComponentDefByCluster(ctx context.Context, cli client2.ReadonlyClient, cluster appsv1alpha1.Cluster, ...) (*appsv1alpha1.ClusterComponentDefinition, error)
- func GetComponentDeployMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (minReadySeconds int32, err error)
- func GetComponentInfoByPod(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (componentName string, componentDef *appsv1alpha1.ClusterComponentDefinition, ...)
- func GetComponentPodList(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (*corev1.PodList, error)
- func GetComponentPodListWithRole(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (*corev1.PodList, error)
- func GetComponentStsMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (minReadySeconds int32, err error)
- func GetComponentWorkloadMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (minReadySeconds int32, err error)
- func GetPodListByStatefulSet(ctx context.Context, cli client.Client, stsObj *appsv1.StatefulSet) ([]corev1.Pod, error)
- func HandleReplicationSetRoleChangeEvent(cli client.Client, reqCtx intctrlutil.RequestCtx, event *corev1.Event, ...) error
- func IsFailedOrAbnormal(phase appsv1alpha1.ClusterComponentPhase) bool
- func IsMemberOf(set *appsv1.StatefulSet, pod *corev1.Pod) bool
- func IsPodFailedAndTimedOut(pod *corev1.Pod) (bool, bool, string)
- func NewDeploymentReconciler(mgr ctrl.Manager) error
- func NewStatefulSetReconciler(mgr ctrl.Manager) error
- func ParseParentNameAndOrdinal(s string) (string, int32)
- func PodIsAvailable(workloadType appsv1alpha1.WorkloadType, pod *corev1.Pod, minReadySeconds int32) bool
- func SortPods(pods []corev1.Pod, priorityMap map[string]int, idLabelKey string)
- func UpdateConsensusSetRoleLabel(cli client.Client, reqCtx intctrlutil.RequestCtx, event *corev1.Event, ...) error
- type Component
- type ComponentWorkload
- type DescendingOrdinalSts
- type Plan
- type Step
Constants ¶
const ( // ComponentPhaseTransition the event reason indicates that the component transits to a new phase. ComponentPhaseTransition = "ComponentPhaseTransition" // PodContainerFailedTimeout the timeout for container of pod failures, the component phase will be set to Failed/Abnormal after this time. PodContainerFailedTimeout = 10 * time.Second // PodScheduledFailedTimeout timeout for scheduling failure. PodScheduledFailedTimeout = 30 * time.Second )
const NewRSAvailableReason = "NewReplicaSetAvailable"
NewRSAvailableReason is added in a deployment when its newest replica set is made available ie. the number of new pods that have passed readiness checks and run for at least minReadySeconds is at least the minimum available pods that need to run for the deployment.
Variables ¶
This section is empty.
Functions ¶
func ComposeRolePriorityMap ¶ added in v0.6.0
func ComposeRolePriorityMap(consensusSpec *appsv1alpha1.ConsensusSetSpec) map[string]int
ComposeRolePriorityMap generates a priority map based on roles.
func DefaultRole ¶ added in v0.6.0
DefaultRole is used to get the default role of the Pod of the Replication workload.
func GetClusterByObject ¶ added in v0.6.0
func GetClusterByObject(ctx context.Context, cli client.Client, obj client.Object) (*appsv1alpha1.Cluster, error)
GetClusterByObject gets cluster by related k8s workloads.
func GetComponentDefByCluster ¶ added in v0.6.0
func GetComponentDefByCluster(ctx context.Context, cli client2.ReadonlyClient, cluster appsv1alpha1.Cluster, compDefName string) (*appsv1alpha1.ClusterComponentDefinition, error)
GetComponentDefByCluster gets component from ClusterDefinition with compDefName
func GetComponentDeployMinReadySeconds ¶ added in v0.6.0
func GetComponentDeployMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, componentName string) (minReadySeconds int32, err error)
GetComponentDeployMinReadySeconds gets the deployment minReadySeconds of the component.
func GetComponentInfoByPod ¶ added in v0.6.0
func GetComponentInfoByPod(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, pod *corev1.Pod) (componentName string, componentDef *appsv1alpha1.ClusterComponentDefinition, err error)
GetComponentInfoByPod gets componentName and componentDefinition info by Pod.
func GetComponentPodList ¶ added in v0.6.0
func GetComponentPodList(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, componentName string) (*corev1.PodList, error)
GetComponentPodList gets the pod list by cluster and componentName
func GetComponentPodListWithRole ¶ added in v0.6.0
func GetComponentPodListWithRole(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, compSpecName, role string) (*corev1.PodList, error)
GetComponentPodListWithRole gets the pod list with target role by cluster and componentName
func GetComponentStsMinReadySeconds ¶ added in v0.6.0
func GetComponentStsMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, componentName string) (minReadySeconds int32, err error)
GetComponentStsMinReadySeconds gets the statefulSet minReadySeconds of the component.
func GetComponentWorkloadMinReadySeconds ¶ added in v0.6.0
func GetComponentWorkloadMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, workloadType appsv1alpha1.WorkloadType, componentName string) (minReadySeconds int32, err error)
GetComponentWorkloadMinReadySeconds gets the workload minReadySeconds of the component.
func GetPodListByStatefulSet ¶ added in v0.6.0
func GetPodListByStatefulSet(ctx context.Context, cli client.Client, stsObj *appsv1.StatefulSet) ([]corev1.Pod, error)
GetPodListByStatefulSet gets statefulSet pod list.
func HandleReplicationSetRoleChangeEvent ¶ added in v0.6.0
func HandleReplicationSetRoleChangeEvent(cli client.Client, reqCtx intctrlutil.RequestCtx, event *corev1.Event, cluster *appsv1alpha1.Cluster, compName string, pod *corev1.Pod, newRole string) error
HandleReplicationSetRoleChangeEvent handles the role change event of the replication workload when switchPolicy is Noop.
func IsFailedOrAbnormal ¶ added in v0.6.0
func IsFailedOrAbnormal(phase appsv1alpha1.ClusterComponentPhase) bool
func IsMemberOf ¶ added in v0.6.0
func IsMemberOf(set *appsv1.StatefulSet, pod *corev1.Pod) bool
IsMemberOf tests if pod is a member of set.
func IsPodFailedAndTimedOut ¶ added in v0.6.0
IsPodFailedAndTimedOut checks if the pod is failed and timed out.
func NewDeploymentReconciler ¶ added in v0.6.0
func NewStatefulSetReconciler ¶ added in v0.6.0
func ParseParentNameAndOrdinal ¶ added in v0.6.0
ParseParentNameAndOrdinal gets the name of cluster-component and StatefulSet's ordinal as extracted from its Name. If the StatefulSet's Name was not match a statefulSetRegex, its parent is considered to be empty string, and its ordinal is considered to be -1.
func PodIsAvailable ¶ added in v0.6.0
func PodIsAvailable(workloadType appsv1alpha1.WorkloadType, pod *corev1.Pod, minReadySeconds int32) bool
PodIsAvailable checks whether a pod is available with respect to the workload type. Deprecated: provide for ops request using, remove this interface later.
func UpdateConsensusSetRoleLabel ¶ added in v0.6.0
func UpdateConsensusSetRoleLabel(cli client.Client, reqCtx intctrlutil.RequestCtx, event *corev1.Event, componentDef *appsv1alpha1.ClusterComponentDefinition, pod *corev1.Pod, role string) error
UpdateConsensusSetRoleLabel updates pod role label when internal container role changed
Types ¶
type Component ¶ added in v0.6.0
type Component interface { GetName() string GetNamespace() string GetClusterName() string GetDefinitionName() string GetWorkloadType() appsv1alpha1.WorkloadType GetCluster() *appsv1alpha1.Cluster GetClusterVersion() *appsv1alpha1.ClusterVersion GetSynthesizedComponent() *component.SynthesizedComponent GetConsensusSpec() *appsv1alpha1.ConsensusSetSpec GetMatchingLabels() client.MatchingLabels GetPhase() appsv1alpha1.ClusterComponentPhase // GetBuiltObjects returns all objects that will be created by this component GetBuiltObjects(reqCtx intctrlutil.RequestCtx, cli client.Client) ([]client.Object, error) Create(reqCtx intctrlutil.RequestCtx, cli client.Client) error Delete(reqCtx intctrlutil.RequestCtx, cli client.Client) error Update(reqCtx intctrlutil.RequestCtx, cli client.Client) error Status(reqCtx intctrlutil.RequestCtx, cli client.Client) error Restart(reqCtx intctrlutil.RequestCtx, cli client.Client) error ExpandVolume(reqCtx intctrlutil.RequestCtx, cli client.Client) error HorizontalScale(reqCtx intctrlutil.RequestCtx, cli client.Client) error // TODO(impl): impl-related, replace them with component workload SetWorkload(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex) AddResource(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex }
func NewComponent ¶ added in v0.6.0
func NewComponent(reqCtx intctrlutil.RequestCtx, cli client.Client, definition *appsv1alpha1.ClusterDefinition, version *appsv1alpha1.ClusterVersion, cluster *appsv1alpha1.Cluster, compName string, dag *graph.DAG) (Component, error)
type ComponentWorkload ¶ added in v0.6.0
type ComponentWorkload interface{}
type DescendingOrdinalSts ¶ added in v0.6.0
type DescendingOrdinalSts []*appsv1.StatefulSet
DescendingOrdinalSts is a sort.Interface that Sorts a list of StatefulSet based on the ordinals extracted from the statefulSet.
type Plan ¶ added in v0.6.0
type Plan struct { Start *Step WalkFunc walkFunc }
func (*Plan) WalkOneStep ¶ added in v0.6.0
WalkOneStep process plan stepping @return isCompleted @return err
Source Files ¶
- base.go
- base_stateful.go
- base_stateful_hscale.go
- component.go
- component_set.go
- consensus.go
- consensus_set.go
- consensus_set_utils.go
- consensus_workload.go
- plan.go
- replication.go
- replication_set.go
- replication_set_utils.go
- replication_workload.go
- stateful.go
- stateful_set.go
- stateful_set_utils.go
- stateful_workload.go
- stateless.go
- stateless_set.go
- stateless_workload.go
- status.go
- types.go
- utils.go
- workload_builder.go
- workload_controller.go