Documentation ¶
Index ¶
- func IsPodFailedAndTimedOut(pod *corev1.Pod) (bool, bool, string)
- type ComponentBase
- func (c *ComponentBase) AddResource(obj client.Object, action *ictrltypes.LifecycleAction, ...) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) CreateResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) DeleteResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) GetCluster() *appsv1alpha1.Cluster
- func (c *ComponentBase) GetClusterName() string
- func (c *ComponentBase) GetClusterVersion() *appsv1alpha1.ClusterVersion
- func (c *ComponentBase) GetConsensusSpec() *appsv1alpha1.ConsensusSetSpec
- func (c *ComponentBase) GetDefinitionName() string
- func (c *ComponentBase) GetMatchingLabels() client.MatchingLabels
- func (c *ComponentBase) GetName() string
- func (c *ComponentBase) GetNamespace() string
- func (c *ComponentBase) GetPhase() appsv1alpha1.ClusterComponentPhase
- func (c *ComponentBase) GetSynthesizedComponent() *component.SynthesizedComponent
- func (c *ComponentBase) NoopResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) PatchResource(obj client.Object, objCopy client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) ResolveObjectsAction(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *ComponentBase) SetStatusPhase(phase appsv1alpha1.ClusterComponentPhase, ...)
- func (c *ComponentBase) SetWorkload(obj client.Object, action *ictrltypes.LifecycleAction, ...)
- func (c *ComponentBase) StatusWorkload(reqCtx intctrlutil.RequestCtx, cli client.Client, obj client.Object, ...) error
- func (c *ComponentBase) UpdatePDB(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *ComponentBase) UpdateResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
- func (c *ComponentBase) UpdateService(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *ComponentBase) ValidateObjectsAction() error
- type ComponentSet
- type ComponentSetBase
- type ComponentWorkloadBuilder
- type ComponentWorkloadBuilderBase
- func (b *ComponentWorkloadBuilderBase) BuildConfig() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildEnv() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildHeadlessService() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildPDB() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildService() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildTLSCert() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildTLSVolume() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildVolumeMount() ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildWorkload4StatefulSet(workloadType string) ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) BuildWrapper(buildfn func() ([]client.Object, error)) ComponentWorkloadBuilder
- func (b *ComponentWorkloadBuilderBase) Complete() error
- type StatefulComponentBase
- func (c *StatefulComponentBase) Create(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- func (c *StatefulComponentBase) Delete(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *StatefulComponentBase) ExpandVolume(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *StatefulComponentBase) GetBuiltObjects(builder ComponentWorkloadBuilder) ([]client.Object, error)
- func (c *StatefulComponentBase) HorizontalScale(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *StatefulComponentBase) Restart(reqCtx intctrlutil.RequestCtx, cli client.Client) error
- func (c *StatefulComponentBase) Status(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
- func (c *StatefulComponentBase) Update(reqCtx intctrlutil.RequestCtx, cli client.Client, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComponentBase ¶
type ComponentBase struct { Client client.Client Recorder record.EventRecorder Cluster *appsv1alpha1.Cluster ClusterVersion *appsv1alpha1.ClusterVersion // building config needs the cluster version Component *component.SynthesizedComponent // built synthesized component, replace it with component workload proto ComponentSet ComponentSet Dag *graph.DAG WorkloadVertex *ictrltypes.LifecycleVertex // DAG vertex of main workload object }
func (*ComponentBase) AddResource ¶
func (c *ComponentBase) AddResource(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) CreateResource ¶
func (c *ComponentBase) CreateResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) DeleteResource ¶
func (c *ComponentBase) DeleteResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) GetCluster ¶
func (c *ComponentBase) GetCluster() *appsv1alpha1.Cluster
func (*ComponentBase) GetClusterName ¶
func (c *ComponentBase) GetClusterName() string
func (*ComponentBase) GetClusterVersion ¶
func (c *ComponentBase) GetClusterVersion() *appsv1alpha1.ClusterVersion
func (*ComponentBase) GetConsensusSpec ¶
func (c *ComponentBase) GetConsensusSpec() *appsv1alpha1.ConsensusSetSpec
func (*ComponentBase) GetDefinitionName ¶
func (c *ComponentBase) GetDefinitionName() string
func (*ComponentBase) GetMatchingLabels ¶
func (c *ComponentBase) GetMatchingLabels() client.MatchingLabels
func (*ComponentBase) GetName ¶
func (c *ComponentBase) GetName() string
func (*ComponentBase) GetNamespace ¶
func (c *ComponentBase) GetNamespace() string
func (*ComponentBase) GetPhase ¶
func (c *ComponentBase) GetPhase() appsv1alpha1.ClusterComponentPhase
func (*ComponentBase) GetSynthesizedComponent ¶
func (c *ComponentBase) GetSynthesizedComponent() *component.SynthesizedComponent
func (*ComponentBase) NoopResource ¶
func (c *ComponentBase) NoopResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) PatchResource ¶
func (c *ComponentBase) PatchResource(obj client.Object, objCopy client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) ResolveObjectsAction ¶
func (c *ComponentBase) ResolveObjectsAction(reqCtx intctrlutil.RequestCtx, cli client.Client) error
ResolveObjectsAction resolves the action of objects in dag to guarantee that all object actions will be determined.
func (*ComponentBase) SetStatusPhase ¶
func (c *ComponentBase) SetStatusPhase(phase appsv1alpha1.ClusterComponentPhase, statusMessage appsv1alpha1.ComponentMessageMap, phaseTransitionMsg string)
SetStatusPhase sets the cluster component phase and messages conditionally.
func (*ComponentBase) SetWorkload ¶
func (c *ComponentBase) SetWorkload(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex)
func (*ComponentBase) StatusWorkload ¶
func (c *ComponentBase) StatusWorkload(reqCtx intctrlutil.RequestCtx, cli client.Client, obj client.Object, txn *statusReconciliationTxn) error
func (*ComponentBase) UpdatePDB ¶
func (c *ComponentBase) UpdatePDB(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*ComponentBase) UpdateResource ¶
func (c *ComponentBase) UpdateResource(obj client.Object, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex
func (*ComponentBase) UpdateService ¶
func (c *ComponentBase) UpdateService(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*ComponentBase) ValidateObjectsAction ¶
func (c *ComponentBase) ValidateObjectsAction() error
ValidateObjectsAction validates the action of objects in dag has been determined.
type ComponentSet ¶
type ComponentSet interface { // IsRunning when relevant k8s workloads changes, it checks whether the component is running. // you can also reconcile the pods of component till the component is Running here. IsRunning(ctx context.Context, obj client.Object) (bool, error) // PodsReady checks whether all pods of the component are ready. // it means the pods are available in StatefulSet or Deployment. PodsReady(ctx context.Context, obj client.Object) (bool, error) // PodIsAvailable checks whether a pod of the component is available. // if the component is Stateless/StatefulSet, the available conditions follows as: // 1. the pod is ready. // 2. readyTime reached minReadySeconds. // if the component is ConsensusSet,it will be available when the pod is ready and labeled with its role. PodIsAvailable(pod *corev1.Pod, minReadySeconds int32) bool // GetPhaseWhenPodsReadyAndProbeTimeout when the pods of component are ready but the probe timed-out, // calculate the component phase is Failed or Abnormal. GetPhaseWhenPodsReadyAndProbeTimeout(pods []*corev1.Pod) (v1alpha1.ClusterComponentPhase, v1alpha1.ComponentMessageMap) // GetPhaseWhenPodsNotReady when the pods of component are not ready, calculate the component phase is Failed or Abnormal. // if return an empty phase, means the pods of component are ready and skips it. GetPhaseWhenPodsNotReady(ctx context.Context, componentName string, originPhaseIsUpRunning bool) (v1alpha1.ClusterComponentPhase, v1alpha1.ComponentMessageMap, error) HandleRestart(ctx context.Context, obj client.Object) ([]graph.Vertex, error) HandleRoleChange(ctx context.Context, obj client.Object) ([]graph.Vertex, error) }
type ComponentSetBase ¶
type ComponentSetBase struct { Cli client.Client Cluster *v1alpha1.Cluster SynthesizedComponent *component.SynthesizedComponent ComponentSpec *v1alpha1.ClusterComponentSpec // for test cases used only ComponentDef *v1alpha1.ClusterComponentDefinition // for test cases used only }
ComponentSetBase is a common component set base struct.
type ComponentWorkloadBuilder ¶
type ComponentWorkloadBuilder interface { // runtime, config, script, env, volume, service, monitor, probe BuildEnv() ComponentWorkloadBuilder BuildConfig() ComponentWorkloadBuilder BuildWorkload() ComponentWorkloadBuilder BuildPDB() ComponentWorkloadBuilder BuildVolumeMount() ComponentWorkloadBuilder BuildService() ComponentWorkloadBuilder BuildHeadlessService() ComponentWorkloadBuilder BuildTLSCert() ComponentWorkloadBuilder BuildTLSVolume() ComponentWorkloadBuilder Complete() error }
type ComponentWorkloadBuilderBase ¶
type ComponentWorkloadBuilderBase struct { ReqCtx intctrlutil.RequestCtx Client client.Client Comp types.Component DefaultAction *ictrltypes.LifecycleAction ConcreteBuilder ComponentWorkloadBuilder Error error EnvConfig *corev1.ConfigMap Workload client.Object LocalObjs []client.Object // cache the objects needed for configuration, should remove this after refactoring the configuration }
func (*ComponentWorkloadBuilderBase) BuildConfig ¶
func (b *ComponentWorkloadBuilderBase) BuildConfig() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildEnv ¶
func (b *ComponentWorkloadBuilderBase) BuildEnv() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildHeadlessService ¶
func (b *ComponentWorkloadBuilderBase) BuildHeadlessService() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildPDB ¶
func (b *ComponentWorkloadBuilderBase) BuildPDB() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildService ¶
func (b *ComponentWorkloadBuilderBase) BuildService() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildTLSCert ¶
func (b *ComponentWorkloadBuilderBase) BuildTLSCert() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildTLSVolume ¶
func (b *ComponentWorkloadBuilderBase) BuildTLSVolume() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildVolumeMount ¶
func (b *ComponentWorkloadBuilderBase) BuildVolumeMount() ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildWorkload4StatefulSet ¶
func (b *ComponentWorkloadBuilderBase) BuildWorkload4StatefulSet(workloadType string) ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) BuildWrapper ¶
func (b *ComponentWorkloadBuilderBase) BuildWrapper(buildfn func() ([]client.Object, error)) ComponentWorkloadBuilder
func (*ComponentWorkloadBuilderBase) Complete ¶
func (b *ComponentWorkloadBuilderBase) Complete() error
type StatefulComponentBase ¶
type StatefulComponentBase struct { ComponentBase // contains filtered or unexported fields }
StatefulComponentBase as a base class for single stateful-set based component (stateful & replication & consensus).
func (*StatefulComponentBase) Create ¶
func (c *StatefulComponentBase) Create(reqCtx intctrlutil.RequestCtx, cli client.Client, builder ComponentWorkloadBuilder) error
func (*StatefulComponentBase) Delete ¶
func (c *StatefulComponentBase) Delete(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*StatefulComponentBase) ExpandVolume ¶
func (c *StatefulComponentBase) ExpandVolume(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*StatefulComponentBase) GetBuiltObjects ¶
func (c *StatefulComponentBase) GetBuiltObjects(builder ComponentWorkloadBuilder) ([]client.Object, error)
func (*StatefulComponentBase) HorizontalScale ¶
func (c *StatefulComponentBase) HorizontalScale(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*StatefulComponentBase) Restart ¶
func (c *StatefulComponentBase) Restart(reqCtx intctrlutil.RequestCtx, cli client.Client) error
func (*StatefulComponentBase) Status ¶
func (c *StatefulComponentBase) Status(reqCtx intctrlutil.RequestCtx, cli client.Client, builder ComponentWorkloadBuilder) error
func (*StatefulComponentBase) Update ¶
func (c *StatefulComponentBase) Update(reqCtx intctrlutil.RequestCtx, cli client.Client, builder ComponentWorkloadBuilder) error
Click to show internal directories.
Click to hide internal directories.