Documentation ¶
Index ¶
- Constants
- Variables
- func AppsInstanceToWorkloadInstance(instance *appsv1alpha1.InstanceTemplate) *workloads.InstanceTemplate
- func BuildComponent(cluster *appsv1alpha1.Cluster, compSpec *appsv1alpha1.ClusterComponentSpec, ...) (*appsv1alpha1.Component, error)
- func BuildComponentDefinition(clusterDef *appsv1alpha1.ClusterDefinition, ...) (*appsv1alpha1.ComponentDefinition, error)
- func BuildJobTolerations(job *batchv1.Job, cluster *appsv1alpha1.Cluster) error
- func BuildWorkloadFrom(synthesizeComp *SynthesizedComponent, protoITS *workloads.InstanceSet) (*workloads.InstanceSet, error)
- func CheckAndGetClusterComponents(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster) ([]client.Object, error)
- func CheckJobSucceed(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster, ...) error
- func CleanJobByName(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, ...) error
- func CleanJobByNameWithDAG(ctx context.Context, cli client.Reader, dag *graph.DAG, ...) error
- func CleanJobWithLabels(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, ...) error
- func CompareServiceVersion(required, provided string) (bool, error)
- func CompatibleCompVersions4Definition(ctx context.Context, cli client.Reader, ...) ([]*appsv1alpha1.ComponentVersion, error)
- func ConvertSynthesizeCompRoleToInstanceSetRole(synthesizedComp *SynthesizedComponent) []workloads.ReplicaRole
- func FullName(clusterName, compName string) string
- func GenerateAllPodNames(compReplicas int32, instances []appsv1alpha1.InstanceTemplate, ...) ([]string, error)
- func GenerateAllPodNamesToSet(compReplicas int32, instances []appsv1alpha1.InstanceTemplate, ...) (map[string]string, error)
- func GetClusterComponentShortNameSet(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster) (sets.Set[string], error)
- func GetClusterName(comp *appsv1alpha1.Component) (string, error)
- func GetClusterUID(comp *appsv1alpha1.Component) (string, error)
- func GetCompDefByName(ctx context.Context, cli client.Reader, compDefName string) (*appsv1alpha1.ComponentDefinition, error)
- func GetCompNCompDefByName(ctx context.Context, cli client.Reader, namespace, fullCompName string) (*appsv1alpha1.Component, *appsv1alpha1.ComponentDefinition, error)
- func GetComponentByName(ctx context.Context, cli client.Reader, namespace, fullCompName string) (*appsv1alpha1.Component, error)
- func GetComponentPodList(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, ...) (*corev1.PodList, error)
- func GetComponentPodListWithRole(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, ...) (*corev1.PodList, error)
- func GetConfigSpecByName(synthesizedComp *SynthesizedComponent, configSpec string) *appsv1alpha1.ComponentConfigSpec
- func GetEnvReplacementMapForConnCredential(clusterName string) map[string]string
- func GetExporter(componentDef appsv1alpha1.ComponentDefinitionSpec) *common.Exporter
- func GetHostNetworkRelatedComponents(podSpec *corev1.PodSpec, ctx context.Context, cli client.Client, ...) ([]client.Object, error)
- func GetJobWithLabels(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, ...) ([]batchv1.Job, error)
- func GetMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, ...) (minReadySeconds int32, err error)
- func GetObjectListByComponentName(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, ...) error
- func GetReplacementMapForBuiltInEnv(clusterName, clusterUID, componentName string) map[string]string
- func GetTemplateNameAndOrdinal(workloadName, podName string) (string, int32, error)
- func InjectEnvVars(synthesizedComp *SynthesizedComponent, envVars []corev1.EnvVar, ...)
- func InjectEnvVars4Containers(synthesizedComp *SynthesizedComponent, envVars []corev1.EnvVar, ...)
- func IsGenerated(comp *appsv1alpha1.Component) bool
- func IsHostNetworkEnabled(synthesizedComp *SynthesizedComponent) bool
- func ListClusterComponents(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster) ([]appsv1alpha1.Component, error)
- func ListObjWithLabelsInNamespace[T generics.Object, PT generics.PObject[T], L generics.ObjList[T], ...](ctx context.Context, cli client.Reader, _ func(T, PT, L, PL), namespace string, ...) ([]PT, error)
- func ListOwnedPods(ctx context.Context, cli client.Reader, ...) ([]*corev1.Pod, error)
- func ListOwnedServices(ctx context.Context, cli client.Reader, ...) ([]*corev1.Service, error)
- func ListOwnedWorkloads(ctx context.Context, cli client.Reader, ...) ([]*workloads.InstanceSet, error)
- func ListPodOwnedByComponent(ctx context.Context, cli client.Reader, namespace string, ...) ([]*corev1.Pod, error)
- func NeedDoPostProvision(ctx context.Context, cli client.Reader, actionCtx *ActionContext) (bool, error)
- func ParseComponentClasses(classDefinition v1alpha1.ComponentClassDefinition) (map[v1alpha1.ClassDefRef]*v1alpha1.ComponentClass, error)
- func ReconcileCompPostProvision(ctx context.Context, cli client.Reader, graphCli model.GraphClient, ...) error
- func ReconcileCompPreTerminate(reqCtx intctrlutil.RequestCtx, cli client.Reader, graphCli model.GraphClient, ...) error
- func ReplaceNamedVars(namedValuesMap map[string]string, targetVar string, limits int, matchAll bool) string
- func ReplaceSecretEnvVars(namedValuesMap map[string]string, envs []corev1.EnvVar) []corev1.EnvVar
- func ResolveEnvVars4LegacyCluster(ctx context.Context, cli client.Reader, synthesizedComp *SynthesizedComponent, ...) (map[string]any, []corev1.EnvVar, error)
- func ResolveTemplateNEnvVars(ctx context.Context, cli client.Reader, synthesizedComp *SynthesizedComponent, ...) (map[string]any, []corev1.EnvVar, error)
- func ShortName(clusterName, compName string) (string, error)
- func UpdateCompDefinitionImages4ServiceVersion(ctx context.Context, cli client.Reader, ...) error
- func VarReferenceRegExp() *regexp.Regexp
- type ActionContext
- type ByClassResource
- type ByResourceList
- type ByRuleList
- type ComponentClassWithRef
- type LifeCycleActionType
- type Manager
- func (r *Manager) ChooseClass(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) (*ComponentClassWithRef, error)
- func (r *Manager) GetClasses() map[string][]*ComponentClassWithRef
- func (r *Manager) GetResources(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) (corev1.ResourceList, error)
- func (r *Manager) HasClass(compType string, classDefRef v1alpha1.ClassDefRef) bool
- func (r *Manager) ValidateResources(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) error
- type SynthesizedComponent
- func BuildSynthesizedComponent(reqCtx intctrlutil.RequestCtx, cli client.Reader, ...) (*SynthesizedComponent, error)
- func BuildSynthesizedComponent4Generated(reqCtx intctrlutil.RequestCtx, cli client.Reader, ...) (*appsv1alpha1.ComponentDefinition, *SynthesizedComponent, error)
- func BuildSynthesizedComponentWrapper(reqCtx intctrlutil.RequestCtx, cli client.Reader, ...) (*SynthesizedComponent, error)
- func BuildSynthesizedComponentWrapper4Test(reqCtx intctrlutil.RequestCtx, cli client.Reader, ...) (*SynthesizedComponent, error)
Constants ¶
const (
KBJobTTLSecondsAfterFinished = 5
)
Variables ¶
var ( ErrClassNotFound = fmt.Errorf("class not found") ErrInvalidResource = fmt.Errorf("resource is not conform to the constraints, please check the ComponentResourceConstraint API") )
var (
Any = v1alpha1.ClassDefRef{}
)
Functions ¶
func AppsInstanceToWorkloadInstance ¶ added in v0.9.0
func AppsInstanceToWorkloadInstance(instance *appsv1alpha1.InstanceTemplate) *workloads.InstanceTemplate
func BuildComponent ¶
func BuildComponent(cluster *appsv1alpha1.Cluster, compSpec *appsv1alpha1.ClusterComponentSpec, labels, annotations map[string]string) (*appsv1alpha1.Component, error)
BuildComponent builds a new Component object from cluster component spec and definition.
func BuildComponentDefinition ¶ added in v0.8.0
func BuildComponentDefinition(clusterDef *appsv1alpha1.ClusterDefinition, clusterVer *appsv1alpha1.ClusterVersion, clusterCompSpec *appsv1alpha1.ClusterComponentSpec) (*appsv1alpha1.ComponentDefinition, error)
func BuildJobTolerations ¶ added in v0.9.1
func BuildJobTolerations(job *batchv1.Job, cluster *appsv1alpha1.Cluster) error
BuildJobTolerations builds the job tolerations.
func BuildWorkloadFrom ¶ added in v0.9.0
func BuildWorkloadFrom(synthesizeComp *SynthesizedComponent, protoITS *workloads.InstanceSet) (*workloads.InstanceSet, error)
BuildWorkloadFrom builds a new Component object based on SynthesizedComponent.
func CheckAndGetClusterComponents ¶ added in v0.8.0
func CheckAndGetClusterComponents(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster) ([]client.Object, error)
CheckAndGetClusterComponents checks if all components have created and gets the created components.
func CheckJobSucceed ¶ added in v0.7.1
func CheckJobSucceed(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster, jobName string) error
CheckJobSucceed checks the result of job execution. Returns: - bool: whether job exist, true exist - error: any error that occurred during the handling
func CleanJobByName ¶ added in v0.7.1
func CleanJobByName(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, jobName string) error
CleanJobByName cleans up the job task by name.
func CleanJobByNameWithDAG ¶ added in v0.9.0
func CleanJobByNameWithDAG(ctx context.Context, cli client.Reader, dag *graph.DAG, cluster *appsv1alpha1.Cluster, jobName string) error
CleanJobByNameWithDAG cleans up the job task by name with DAG.
func CleanJobWithLabels ¶ added in v0.7.1
func CleanJobWithLabels(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, matchLabels client.MatchingLabels) error
CleanJobWithLabels cleans up the job tasks with label.
func CompareServiceVersion ¶ added in v0.9.0
CompareServiceVersion compares whether two service version have the same major, minor and patch version.
func CompatibleCompVersions4Definition ¶ added in v0.9.0
func CompatibleCompVersions4Definition(ctx context.Context, cli client.Reader, compDef *appsv1alpha1.ComponentDefinition) ([]*appsv1alpha1.ComponentVersion, error)
CompatibleCompVersions4Definition returns all component versions that are compatible with specified component definition.
func ConvertSynthesizeCompRoleToInstanceSetRole ¶ added in v0.9.0
func ConvertSynthesizeCompRoleToInstanceSetRole(synthesizedComp *SynthesizedComponent) []workloads.ReplicaRole
ConvertSynthesizeCompRoleToInstanceSetRole converts the component.SynthesizedComponent.Roles to workloads.ReplicaRole.
func GenerateAllPodNames ¶ added in v0.9.0
func GenerateAllPodNames( compReplicas int32, instances []appsv1alpha1.InstanceTemplate, offlineInstances []string, clusterName, fullCompName string) ([]string, error)
GenerateAllPodNames generate all pod names for a component.
func GenerateAllPodNamesToSet ¶ added in v0.9.0
func GenerateAllPodNamesToSet( compReplicas int32, instances []appsv1alpha1.InstanceTemplate, offlineInstances []string, clusterName, fullCompName string) (map[string]string, error)
GenerateAllPodNamesToSet generate all pod names for a component and return a set which key is the pod name and value is a template name.
func GetClusterComponentShortNameSet ¶ added in v0.8.2
func GetClusterComponentShortNameSet(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster) (sets.Set[string], error)
GetClusterComponentShortNameSet gets the component short name set of the cluster.
func GetClusterName ¶ added in v0.8.0
func GetClusterName(comp *appsv1alpha1.Component) (string, error)
func GetClusterUID ¶ added in v0.8.0
func GetClusterUID(comp *appsv1alpha1.Component) (string, error)
func GetCompDefByName ¶ added in v0.9.0
func GetCompDefByName(ctx context.Context, cli client.Reader, compDefName string) (*appsv1alpha1.ComponentDefinition, error)
GetCompDefByName gets the component definition by component definition name.
func GetCompNCompDefByName ¶ added in v0.9.0
func GetCompNCompDefByName(ctx context.Context, cli client.Reader, namespace, fullCompName string) (*appsv1alpha1.Component, *appsv1alpha1.ComponentDefinition, error)
func GetComponentByName ¶ added in v0.9.0
func GetComponentPodList ¶ added in v0.8.0
func GetComponentPodList(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, componentName string) (*corev1.PodList, error)
GetComponentPodList gets the pod list by cluster and componentName
func GetComponentPodListWithRole ¶ added in v0.8.0
func GetComponentPodListWithRole(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, compSpecName, role string) (*corev1.PodList, error)
GetComponentPodListWithRole gets the pod list with target role by cluster and componentName
func GetConfigSpecByName ¶
func GetConfigSpecByName(synthesizedComp *SynthesizedComponent, configSpec string) *appsv1alpha1.ComponentConfigSpec
func GetEnvReplacementMapForConnCredential ¶
GetEnvReplacementMapForConnCredential gets the replacement map for connect credential TODO: deprecated, will be removed later.
func GetExporter ¶ added in v0.9.0
func GetExporter(componentDef appsv1alpha1.ComponentDefinitionSpec) *common.Exporter
func GetHostNetworkRelatedComponents ¶ added in v0.9.0
func GetHostNetworkRelatedComponents(podSpec *corev1.PodSpec, ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster) ([]client.Object, error)
GetHostNetworkRelatedComponents checks if it is necessary to wait for the completion of relevant conditions.
func GetJobWithLabels ¶ added in v0.7.1
func GetJobWithLabels(ctx context.Context, cli client.Client, cluster *appsv1alpha1.Cluster, matchLabels client.MatchingLabels) ([]batchv1.Job, error)
GetJobWithLabels gets the job list with the specified labels.
func GetMinReadySeconds ¶ added in v0.9.0
func GetMinReadySeconds(ctx context.Context, cli client.Client, cluster appsv1alpha1.Cluster, compName string) (minReadySeconds int32, err error)
GetMinReadySeconds gets the underlying workload's minReadySeconds of the component.
func GetObjectListByComponentName ¶ added in v0.8.0
func GetObjectListByComponentName(ctx context.Context, cli client.Reader, cluster appsv1alpha1.Cluster, objectList client.ObjectList, componentName string) error
GetObjectListByComponentName gets k8s workload list with component
func GetReplacementMapForBuiltInEnv ¶
func GetReplacementMapForBuiltInEnv(clusterName, clusterUID, componentName string) map[string]string
GetReplacementMapForBuiltInEnv gets the replacement map for KubeBlocks built-in environment variables.
func GetTemplateNameAndOrdinal ¶ added in v0.9.0
func InjectEnvVars ¶ added in v0.8.0
func InjectEnvVars(synthesizedComp *SynthesizedComponent, envVars []corev1.EnvVar, envFromSources []corev1.EnvFromSource)
func InjectEnvVars4Containers ¶ added in v0.8.0
func InjectEnvVars4Containers(synthesizedComp *SynthesizedComponent, envVars []corev1.EnvVar, envFromSources []corev1.EnvFromSource, filter func(container *corev1.Container) bool)
func IsGenerated ¶ added in v0.9.0
func IsGenerated(comp *appsv1alpha1.Component) bool
IsGenerated checks if the component is generated from legacy cluster definitions.
func IsHostNetworkEnabled ¶ added in v0.9.0
func IsHostNetworkEnabled(synthesizedComp *SynthesizedComponent) bool
func ListClusterComponents ¶ added in v0.8.2
func ListClusterComponents(ctx context.Context, cli client.Reader, cluster *appsv1alpha1.Cluster) ([]appsv1alpha1.Component, error)
ListClusterComponents lists the components of the cluster.
func ListObjWithLabelsInNamespace ¶ added in v0.8.0
func ListOwnedPods ¶ added in v0.9.0
func ListOwnedServices ¶ added in v0.9.0
func ListOwnedWorkloads ¶ added in v0.9.1
func ListPodOwnedByComponent ¶ added in v0.8.0
func NeedDoPostProvision ¶ added in v0.9.0
func ParseComponentClasses ¶ added in v0.8.0
func ParseComponentClasses(classDefinition v1alpha1.ComponentClassDefinition) (map[v1alpha1.ClassDefRef]*v1alpha1.ComponentClass, error)
ParseComponentClasses parses ComponentClassDefinition to component classes
func ReconcileCompPostProvision ¶ added in v0.8.0
func ReconcileCompPostProvision(ctx context.Context, cli client.Reader, graphCli model.GraphClient, actionCtx *ActionContext, dag *graph.DAG) error
ReconcileCompPostProvision reconciles the component-level postProvision command.
func ReconcileCompPreTerminate ¶ added in v0.9.0
func ReconcileCompPreTerminate(reqCtx intctrlutil.RequestCtx, cli client.Reader, graphCli model.GraphClient, cluster *appsv1alpha1.Cluster, comp *appsv1alpha1.Component, dag *graph.DAG) error
ReconcileCompPreTerminate reconciles the component-level preTerminate command.
func ReplaceNamedVars ¶
func ReplaceNamedVars(namedValuesMap map[string]string, targetVar string, limits int, matchAll bool) string
ReplaceNamedVars replaces the placeholder in targetVar if it is match and returns the replaced result
func ReplaceSecretEnvVars ¶
ReplaceSecretEnvVars replaces the env secret value with namedValues and returns new envs
func ResolveEnvVars4LegacyCluster ¶ added in v0.8.0
func ResolveTemplateNEnvVars ¶ added in v0.8.0
func ResolveTemplateNEnvVars(ctx context.Context, cli client.Reader, synthesizedComp *SynthesizedComponent, definedVars []appsv1alpha1.EnvVar) (map[string]any, []corev1.EnvVar, error)
ResolveTemplateNEnvVars resolves all built-in and user-defined vars for config template and Env usage.
func UpdateCompDefinitionImages4ServiceVersion ¶ added in v0.9.0
func UpdateCompDefinitionImages4ServiceVersion(ctx context.Context, cli client.Reader, compDef *appsv1alpha1.ComponentDefinition, serviceVersion string) error
UpdateCompDefinitionImages4ServiceVersion resolves and updates images for the component definition.
func VarReferenceRegExp ¶ added in v0.8.0
Types ¶
type ActionContext ¶ added in v0.9.0
type ActionContext struct {
// contains filtered or unexported fields
}
ActionContext represents the context for lifecycle action.
func NewActionContext ¶ added in v0.9.0
func NewActionContext(cluster *appsv1alpha1.Cluster, component *appsv1alpha1.Component, workload client.Object, lifecycleActions *appsv1alpha1.ComponentLifecycleActions, scriptTemplates []appsv1alpha1.ComponentTemplateSpec, actionType LifeCycleActionType) (*ActionContext, error)
type ByClassResource ¶ added in v0.8.0
type ByClassResource []*ComponentClassWithRef
func (ByClassResource) Len ¶ added in v0.8.0
func (b ByClassResource) Len() int
func (ByClassResource) Less ¶ added in v0.8.0
func (b ByClassResource) Less(i, j int) bool
func (ByClassResource) Swap ¶ added in v0.8.0
func (b ByClassResource) Swap(i, j int)
type ByResourceList ¶ added in v0.8.0
type ByResourceList []corev1.ResourceList
func (ByResourceList) Len ¶ added in v0.8.0
func (b ByResourceList) Len() int
func (ByResourceList) Less ¶ added in v0.8.0
func (b ByResourceList) Less(i, j int) bool
func (ByResourceList) Swap ¶ added in v0.8.0
func (b ByResourceList) Swap(i, j int)
type ByRuleList ¶ added in v0.8.0
type ByRuleList []appsv1alpha1.ResourceConstraintRule
func (ByRuleList) Len ¶ added in v0.8.0
func (m ByRuleList) Len() int
func (ByRuleList) Less ¶ added in v0.8.0
func (m ByRuleList) Less(i, j int) bool
func (ByRuleList) Swap ¶ added in v0.8.0
func (m ByRuleList) Swap(i, j int)
type ComponentClassWithRef ¶ added in v0.8.0
type ComponentClassWithRef struct { appsv1alpha1.ComponentClass ClassDefRef appsv1alpha1.ClassDefRef }
type LifeCycleActionType ¶ added in v0.9.0
type LifeCycleActionType string
LifeCycleActionType represents the lifecycle action type.
const ( // PostProvisionAction represents the post-provision action. PostProvisionAction LifeCycleActionType = "postProvision" // PreTerminateAction represents the pre-terminate action. PreTerminateAction LifeCycleActionType = "preTerminate" )
type Manager ¶ added in v0.8.0
func NewManager ¶ added in v0.8.0
func NewManager(classDefinitionList v1alpha1.ComponentClassDefinitionList, constraintList v1alpha1.ComponentResourceConstraintList) (*Manager, error)
func (*Manager) ChooseClass ¶ added in v0.8.0
func (r *Manager) ChooseClass(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) (*ComponentClassWithRef, error)
ChooseClass chooses the classes to be used for a given component with constraints TODO(xingran): remove the dependency of SynthesizedComponent.ClusterDefName and SynthesizedComponent.ClusterCompDefName in the future
func (*Manager) GetClasses ¶ added in v0.8.0
func (r *Manager) GetClasses() map[string][]*ComponentClassWithRef
func (*Manager) GetResources ¶ added in v0.8.0
func (r *Manager) GetResources(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) (corev1.ResourceList, error)
GetResources returns the resource list of the component TODO(xingran): remove the dependency of SynthesizedComponent.ClusterDefName and SynthesizedComponent.ClusterCompDefName in the future
func (*Manager) HasClass ¶ added in v0.8.0
func (r *Manager) HasClass(compType string, classDefRef v1alpha1.ClassDefRef) bool
HasClass returns true if the component has the specified class
func (*Manager) ValidateResources ¶ added in v0.8.0
func (r *Manager) ValidateResources(synthesizedComp *SynthesizedComponent, comp *v1alpha1.Component) error
ValidateResources validates if the resources of the component is invalid TODO(xingran): remove the dependency of SynthesizedComponent.ClusterDefName and SynthesizedComponent.ClusterCompDefName in the future
type SynthesizedComponent ¶
type SynthesizedComponent struct { Namespace string `json:"namespace,omitempty"` ClusterName string `json:"clusterName,omitempty"` ClusterUID string `json:"clusterUID,omitempty"` ClusterGeneration string `json:"clusterGeneration,omitempty"` Comp2CompDefs map[string]string `json:"comp2CompDefs,omitempty"` // {compName: compDefName} Name string `json:"name,omitempty"` // the name of the component w/o clusterName prefix FullCompName string `json:"fullCompName,omitempty"` // the full name of the component w/ clusterName prefix CompDefName string `json:"compDefName,omitempty"` // the name of the componentDefinition ServiceVersion string `json:"serviceVersion,omitempty"` Replicas int32 `json:"replicas"` Resources corev1.ResourceRequirements `json:"resources,omitempty"` PodSpec *corev1.PodSpec `json:"podSpec,omitempty"` VolumeClaimTemplates []corev1.PersistentVolumeClaimTemplate `json:"volumeClaimTemplates,omitempty"` LogConfigs []v1alpha1.LogConfig `json:"logConfigs,omitempty"` ConfigTemplates []v1alpha1.ComponentConfigSpec `json:"configTemplates,omitempty"` ScriptTemplates []v1alpha1.ComponentTemplateSpec `json:"scriptTemplates,omitempty"` TLSConfig *v1alpha1.TLSConfig `json:"tlsConfig"` ServiceAccountName string `json:"serviceAccountName,omitempty"` // TODO: remove this later ComponentRefEnvs []corev1.EnvVar `json:"componentRefEnvs,omitempty"` ServiceReferences map[string]*v1alpha1.ServiceDescriptor `json:"serviceReferences,omitempty"` UserDefinedLabels map[string]string UserDefinedAnnotations map[string]string TemplateVars map[string]any `json:"templateVars,omitempty"` EnvVars []corev1.EnvVar `json:"envVars,omitempty"` EnvFromSources []corev1.EnvFromSource `json:"envFromSources,omitempty"` Instances []v1alpha1.InstanceTemplate `json:"instances,omitempty"` OfflineInstances []string `json:"offlineInstances,omitempty"` Roles []v1alpha1.ReplicaRole `json:"roles,omitempty"` Labels map[string]string `json:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` UpdateStrategy *v1alpha1.UpdateStrategy `json:"updateStrategy,omitempty"` InstanceUpdateStrategy *v1alpha1.InstanceUpdateStrategy `json:"instanceUpdateStrategy,omitempty"` PodManagementPolicy *appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"` ParallelPodManagementConcurrency *intstr.IntOrString `json:"parallelPodManagementConcurrency,omitempty"` PodUpdatePolicy *workloads.PodUpdatePolicyType `json:"podUpdatePolicy,omitempty"` PolicyRules []rbacv1.PolicyRule `json:"policyRules,omitempty"` LifecycleActions *v1alpha1.ComponentLifecycleActions `json:"lifecycleActions,omitempty"` SystemAccounts []v1alpha1.SystemAccount `json:"systemAccounts,omitempty"` RoleArbitrator *v1alpha1.RoleArbitrator `json:"roleArbitrator,omitempty"` Volumes []v1alpha1.ComponentVolume `json:"volumes,omitempty"` HostNetwork *v1alpha1.HostNetwork `json:"hostNetwork,omitempty"` ComponentServices []v1alpha1.ComponentService `json:"componentServices,omitempty"` MinReadySeconds int32 `json:"minReadySeconds,omitempty"` DisableExporter *bool `json:"disableExporter,omitempty"` Stop *bool // TODO(xingran): The following fields will be deprecated after version 0.8.0 and will be replaced with a new data structure. Probes *v1alpha1.ClusterDefinitionProbes `json:"probes,omitempty"` // The Probes will be replaced with LifecycleActions.RoleProbe in the future. VolumeTypes []v1alpha1.VolumeTypeSpec `json:"volumeTypes,omitempty"` // The VolumeTypes will be replaced with Volumes in the future. VolumeProtection *v1alpha1.VolumeProtectionSpec `json:"volumeProtection,omitempty"` // The VolumeProtection will be replaced with Volumes in the future. Services []corev1.Service `json:"services,omitempty"` // The Services will be replaced with ComponentServices in the future. TLS bool `json:"tls"` // The TLS will be replaced with TLSConfig in the future. // TODO(xingran): The following fields will be deprecated after KubeBlocks version 0.8.0 ClusterDefName string `json:"clusterDefName,omitempty"` // the name of the clusterDefinition ClusterCompDefName string `json:"clusterCompDefName,omitempty"` // the name of the clusterDefinition.Spec.ComponentDefs[*].Name or cluster.Spec.ComponentSpecs[*].ComponentDefRef CharacterType string `json:"characterType,omitempty"` WorkloadType v1alpha1.WorkloadType `json:"workloadType,omitempty"` HorizontalScalePolicy *v1alpha1.HorizontalScalePolicy `json:"horizontalScalePolicy,omitempty"` EnabledLogs []string `json:"enabledLogs,omitempty"` }
func BuildSynthesizedComponent ¶ added in v0.8.0
func BuildSynthesizedComponent(reqCtx intctrlutil.RequestCtx, cli client.Reader, cluster *appsv1alpha1.Cluster, compDef *appsv1alpha1.ComponentDefinition, comp *appsv1alpha1.Component) (*SynthesizedComponent, error)
BuildSynthesizedComponent builds a new SynthesizedComponent object, which is a mixture of component-related configs from ComponentDefinition and Component.
func BuildSynthesizedComponent4Generated ¶ added in v0.8.0
func BuildSynthesizedComponent4Generated(reqCtx intctrlutil.RequestCtx, cli client.Reader, cluster *appsv1alpha1.Cluster, comp *appsv1alpha1.Component) (*appsv1alpha1.ComponentDefinition, *SynthesizedComponent, error)
BuildSynthesizedComponent4Generated builds SynthesizedComponent for generated Component which w/o ComponentDefinition.
func BuildSynthesizedComponentWrapper ¶ added in v0.8.0
func BuildSynthesizedComponentWrapper(reqCtx intctrlutil.RequestCtx, cli client.Reader, cluster *appsv1alpha1.Cluster, clusterCompSpec *appsv1alpha1.ClusterComponentSpec) (*SynthesizedComponent, error)
BuildSynthesizedComponentWrapper builds a new SynthesizedComponent object with a given ClusterComponentSpec. TODO: remove this
func BuildSynthesizedComponentWrapper4Test ¶ added in v0.8.0
func BuildSynthesizedComponentWrapper4Test(reqCtx intctrlutil.RequestCtx, cli client.Reader, clusterDef *appsv1alpha1.ClusterDefinition, clusterVer *appsv1alpha1.ClusterVersion, cluster *appsv1alpha1.Cluster, clusterCompSpec *appsv1alpha1.ClusterComponentSpec) (*SynthesizedComponent, error)
BuildSynthesizedComponentWrapper4Test builds a new SynthesizedComponent object with a given ClusterComponentSpec.
Source Files ¶
- component.go
- component_class_types.go
- component_class_utils.go
- component_definition_convertor.go
- component_fieldref_util.go
- component_lifecycle_action_utils.go
- component_post_provision.go
- component_pre_terminate.go
- component_version.go
- convertor.go
- job_utils.go
- lorry_utils.go
- mock_reader.go
- pod_utils.go
- port_utils.go
- rsm_convertor.go
- service_descriptor_utils.go
- service_reference.go
- synthesize_component.go
- type.go
- utils.go
- vars.go
- workload_utils.go