Documentation
¶
Index ¶
- Constants
- Variables
- func AsSidecarContainerImage(toolImage parametersv1alpha1.ToolConfig) bool
- func BackgroundDeleteObject(cli client.Client, ctx context.Context, obj client.Object, ...) error
- func BuildHostPortName(clusterName, compName, containerName, portName string) string
- func BuildImagePullSecrets() []corev1.LocalObjectReference
- func BuildPodHostDNS(pod *corev1.Pod) string
- func CheckAndPatchPayload(item *parametersv1alpha1.ConfigTemplateItemDetail, payloadID string, ...) (bool, error)
- func CheckResourceExists(ctx context.Context, cli client.Reader, key client.ObjectKey, ...) (bool, error)
- func CheckedRequeueWithError(err error, logger logr.Logger, msg string, keysAndValues ...interface{}) (reconcile.Result, error)
- func CreateVolumeIfNotExist(volumes []corev1.Volume, volumeName string, createFn createVolumeFn) []corev1.Volume
- func DeleteOwnedResources[T generics.Object, PT generics.PObject[T], L generics.ObjList[T], ...](ctx context.Context, cli client.Client, owner client.Object, ...) error
- func EnabledRuntimeMetrics() bool
- func GenShardingCompSpecList(ctx context.Context, cli client.Reader, cluster *appsv1.Cluster, ...) ([]*appsv1.ClusterComponentSpec, error)
- func GetComponentConfigDescription(pdcr *parametersv1alpha1.ParamConfigRendererSpec, name string) *parametersv1alpha1.ComponentConfigDescription
- func GetComponentConfigDescriptions(pdcr *parametersv1alpha1.ParamConfigRendererSpec, tpl string) []parametersv1alpha1.ComponentConfigDescription
- func GetComponentSpecByName(ctx context.Context, cli client.Reader, cluster *appsv1.Cluster, ...) (*appsv1.ClusterComponentSpec, error)
- func GetConfigTemplateItem(parameterSpec *parametersv1alpha1.ComponentParameterSpec, name string) *parametersv1alpha1.ConfigTemplateItemDetail
- func GetContainerByConfigSpec(podSpec *corev1.PodSpec, configs []appsv1alpha1.ComponentConfigSpec) *corev1.Container
- func GetContainerByName(containers []corev1.Container, name string) (int, *corev1.Container)
- func GetContainerID(pod *corev1.Pod, containerName string) string
- func GetContainersByConfigmap(containers []corev1.Container, volumeName string, cmName string, ...) []string
- func GetCoreNum(container corev1.Container) int64
- func GetIntOrPercentValue(intOrStr *metautil.IntOrString) (int, bool, error)
- func GetItemStatus(status *parametersv1alpha1.ComponentParameterStatus, name string) *parametersv1alpha1.ConfigTemplateItemDetailStatus
- func GetKubeRestConfig(userAgent string) *rest.Config
- func GetMemorySize(container corev1.Container) int64
- func GetParameter(spec *parametersv1alpha1.ParameterSpec, component string) *parametersv1alpha1.ComponentParametersSpec
- func GetParameterReconfiguringStatus(status *parametersv1alpha1.ComponentReconfiguringStatus, name string) *parametersv1alpha1.ReconfiguringStatus
- func GetParameterStatus(status *parametersv1alpha1.ParameterStatus, name string) *parametersv1alpha1.ComponentReconfiguringStatus
- func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) *corev1.PodCondition
- func GetPodContainer(pod *corev1.Pod, containerName string) *corev1.Container
- func GetPodContainerWithVolumeMount(podSpec *corev1.PodSpec, volumeName string) []*corev1.Container
- func GetPodListByInstanceSet(ctx context.Context, cli client.Client, its *workloads.InstanceSet) ([]corev1.Pod, error)
- func GetPodRevision(pod *corev1.Pod) string
- func GetPodSelector(pd *parametersv1alpha1.ParametersDefinitionSpec) *metav1.LabelSelector
- func GetPortByName(pod corev1.Pod, cname, pname string) (int32, error)
- func GetRequestMemorySize(container corev1.Container) int64
- func GetStorageSizeFromPersistentVolume(pvc corev1.PersistentVolumeClaimTemplate) int64
- func GetUncachedObjects() []client.Object
- func GetUpdatedParametersReconciledPhase(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail, ...) parametersv1alpha1.ParameterPhase
- func GetVolumeMountByVolume(container *corev1.Container, volumeName string) *corev1.VolumeMount
- func GetVolumeMountName(volumes []corev1.Volume, resourceName string) *corev1.Volume
- func HandleCRDeletion(reqCtx RequestCtx, r client.Writer, cr client.Object, finalizer string, ...) (*ctrl.Result, error)
- func IgnoreIsAlreadyExists(err error) error
- func InitHostPortManager(cli client.Client) error
- func InjectZeroResourcesLimitsIfEmpty(c *corev1.Container)
- func IsAPIVersionSupported(apiVersion string) bool
- func IsApplyUpdatedParameters(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail) bool
- func IsDelayedRequeueError(err error) bool
- func IsFailedPhase(phase parametersv1alpha1.ParameterPhase) bool
- func IsMatchConfigVersion(obj client.Object, labelKey string, version string) bool
- func IsNotFound(err error) bool
- func IsParameterFinished(phase parametersv1alpha1.ParameterPhase) bool
- func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32) bool
- func IsPodFailedAndTimedOut(pod *corev1.Pod) (bool, bool, string)
- func IsPodReady(pod *corev1.Pod) bool
- func IsRequeueError(err error) bool
- func IsRerender(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail) bool
- func IsTargetError(err error, errorType ErrorType) bool
- func ListOwnedPods(ctx context.Context, cli client.Reader, ...) ([]*corev1.Pod, error)
- func ListShardingComponents(ctx context.Context, cli client.Reader, cluster *appsv1.Cluster, ...) ([]appsv1.Component, error)
- func LoadRegistryConfig() error
- func MergeAndValidateConfigs(baseConfigs map[string]string, updatedParams []core.ParamPairs, ...) (map[string]string, error)
- func MergeList[E any](src, dst *[]E, f func(E) func(E) bool)
- func MergeMetadataMapInplace(originalMap map[string]string, targetMap *map[string]string)
- func MergeMetadataMaps(originalMap map[string]string, targetMaps ...map[string]string) map[string]string
- func NeedDynamicReloadAction(pd *parametersv1alpha1.ParametersDefinitionSpec) bool
- func NewControllerManagedBy(mgr manager.Manager) *builder.Builder
- func NewDelayedRequeueError(after time.Duration, reason string) error
- func NewEncryptor(encryptionKey string) *encryptor
- func NewRequeueError(after time.Duration, reason string) error
- func ObjectAPIVersionSupported(obj client.Object) bool
- func ParametersDefinitionTerminalPhases(status parametersv1alpha1.ParametersDefinitionStatus, generation int64) bool
- func ParametersDrivenConfigRenderTerminalPhases(status parametersv1alpha1.ParamConfigRendererStatus, generation int64) bool
- func ParametersTerminalPhases(status parametersv1alpha1.ParameterStatus, generation int64) bool
- func PodFQDN(namespace, compName, podName string) string
- func PodIsReadyWithLabel(pod corev1.Pod) bool
- func Reconciled() (reconcile.Result, error)
- func RecordCreatedEvent(r record.EventRecorder, cr client.Object)
- func ReloadStaticParameters(pd *parametersv1alpha1.ParametersDefinitionSpec) bool
- func ReplaceImageRegistry(image string) string
- func Requeue(logger logr.Logger, msg string, keysAndValues ...interface{}) (reconcile.Result, error)
- func RequeueAfter(duration time.Duration, logger logr.Logger, msg string, ...) (reconcile.Result, error)
- func RequeueWithError(err error, logger logr.Logger, msg string, keysAndValues ...interface{}) (reconcile.Result, error)
- func RequeueWithErrorAndRecordEvent(obj client.Object, recorder record.EventRecorder, err error, ...) (reconcile.Result, error)
- func ResolveCmpdParametersDefs(ctx context.Context, reader client.Reader, cmpd *appsv1.ComponentDefinition) (*parametersv1alpha1.ParamConfigRenderer, ...)
- func ResolveComponentConfigRender(ctx context.Context, reader client.Reader, cmpd *appsv1.ComponentDefinition) (*parametersv1alpha1.ParamConfigRenderer, error)
- func ResolveConfigParameterSchema(paramDef *parametersv1alpha1.ParametersDefinition, ...) map[string]*ParameterMeta
- func ResolveContainerDefaultFields(container corev1.Container, pcontainer *corev1.Container)
- func ResolvePodSpecDefaultFields(obj corev1.PodSpec, pobj *corev1.PodSpec)
- func ResourcesPayloadForComponent(resources corev1.ResourceRequirements) any
- func ResultToP(res reconcile.Result, err error) (*reconcile.Result, error)
- func ServiceFQDN(namespace, serviceName string) string
- func SetControllerReference(owner, object metav1.Object) error
- func SetOwnerReference(owner, object metav1.Object) error
- func SetOwnership(owner, obj client.Object, scheme *runtime.Scheme, finalizer string, ...) error
- func ToCoreV1PVCTs(vcts []appsv1.ClusterComponentVolumeClaimTemplate) []corev1.PersistentVolumeClaimTemplate
- func ToCoreV1PVCs(vcts []appsv1.ClusterComponentVolumeClaimTemplate) []corev1.PersistentVolumeClaim
- func TransformComponentParameters(params []opsv1alpha1.ParameterPair) parametersv1alpha1.ComponentParameters
- func ValidateReferenceCR(reqCtx RequestCtx, cli client.Client, obj client.Object, labelKey string, ...) (*ctrl.Result, error)
- type ByPodName
- type DelayedRequeueError
- type Error
- type ErrorType
- type ParameterMeta
- type PortManager
- func (pm *PortManager) AllocatePort(key string) (int32, error)
- func (pm *PortManager) GetPort(key string) (int32, error)
- func (pm *PortManager) ReleaseByPrefix(prefix string) error
- func (pm *PortManager) ReleasePort(key string) error
- func (pm *PortManager) ReleasePorts(keys []string) error
- func (pm *PortManager) UsePort(key string, port int32) error
- type PortRange
- type RequestCtx
- func (r *RequestCtx) Event(object runtime.Object, eventtype, reason, message string)
- func (r *RequestCtx) Eventf(object runtime.Object, eventtype, reason, messageFmt string, ...)
- func (r *RequestCtx) UpdateCtxValue(key, val any) context.Context
- func (r *RequestCtx) WithValue(key, val any) context.Context
- type RequeueError
- type Result
Constants ¶
const FeatureGateEnableRuntimeMetrics = "ENABLED_RUNTIME_METRICS"
const (
GenerateNameMaxRetryTimes = 1000000
)
const ( // PodContainerFailedTimeout the timeout for container of pod failures, the component phase will be set to Failed after this time. PodContainerFailedTimeout = 10 * time.Second )
Variables ¶
var ErrFailedToAddFinalizer = errors.New("failed to add finalizer")
Functions ¶
func AsSidecarContainerImage ¶ added in v1.0.0
func AsSidecarContainerImage(toolImage parametersv1alpha1.ToolConfig) bool
func BackgroundDeleteObject ¶
func BackgroundDeleteObject(cli client.Client, ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
BackgroundDeleteObject deletes the object in the background, usually used in the Reconcile method
func BuildHostPortName ¶ added in v0.8.0
func BuildImagePullSecrets ¶ added in v0.9.1
func BuildImagePullSecrets() []corev1.LocalObjectReference
func BuildPodHostDNS ¶
BuildPodHostDNS builds the host dns of pod. ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
func CheckAndPatchPayload ¶ added in v0.8.0
func CheckAndPatchPayload(item *parametersv1alpha1.ConfigTemplateItemDetail, payloadID string, payload interface{}) (bool, error)
func CheckResourceExists ¶
func CheckResourceExists( ctx context.Context, cli client.Reader, key client.ObjectKey, obj client.Object) (bool, error)
CheckResourceExists checks whether resource exist or not.
func CheckedRequeueWithError ¶
func CheckedRequeueWithError(err error, logger logr.Logger, msg string, keysAndValues ...interface{}) (reconcile.Result, error)
CheckedRequeueWithError passes the error through to the controller manager, it ignores unknown errors.
func CreateVolumeIfNotExist ¶ added in v1.0.0
func DeleteOwnedResources ¶ added in v0.8.3
func DeleteOwnedResources[T generics.Object, PT generics.PObject[T], L generics.ObjList[T], PL generics.PObjList[T, L]](ctx context.Context, cli client.Client, owner client.Object, resourceMatchLabels client.MatchingLabels, _ func(T, PT, L, PL)) error
DeleteOwnedResources deletes the matched resources which are owned by the owner.
func EnabledRuntimeMetrics ¶ added in v0.9.0
func EnabledRuntimeMetrics() bool
func GenShardingCompSpecList ¶ added in v0.8.2
func GetComponentConfigDescription ¶ added in v1.0.0
func GetComponentConfigDescription(pdcr *parametersv1alpha1.ParamConfigRendererSpec, name string) *parametersv1alpha1.ComponentConfigDescription
func GetComponentConfigDescriptions ¶ added in v1.0.0
func GetComponentConfigDescriptions(pdcr *parametersv1alpha1.ParamConfigRendererSpec, tpl string) []parametersv1alpha1.ComponentConfigDescription
func GetComponentSpecByName ¶ added in v1.0.0
func GetConfigTemplateItem ¶ added in v1.0.0
func GetConfigTemplateItem(parameterSpec *parametersv1alpha1.ComponentParameterSpec, name string) *parametersv1alpha1.ConfigTemplateItemDetail
func GetContainerByConfigSpec ¶
func GetContainerByConfigSpec(podSpec *corev1.PodSpec, configs []appsv1alpha1.ComponentConfigSpec) *corev1.Container
GetContainerByConfigSpec searches for container using the configmap of config from the pod
e.g.: ClusterDefinition.configTemplateRef: - Name: "mysql-8.0" VolumeName: "mysql_config" PodTemplate.containers[*].volumeMounts: - mountPath: /data/config name: mysql_config - mountPath: /data name: data - mountPath: /log name: log
func GetContainerByName ¶
func GetContainerID ¶
GetContainerID gets the containerID from pod by name
func GetCoreNum ¶
GetCoreNum gets content of Resources.Limits.cpu
func GetIntOrPercentValue ¶
func GetIntOrPercentValue(intOrStr *metautil.IntOrString) (int, bool, error)
func GetItemStatus ¶ added in v1.0.0
func GetItemStatus(status *parametersv1alpha1.ComponentParameterStatus, name string) *parametersv1alpha1.ConfigTemplateItemDetailStatus
func GetKubeRestConfig ¶ added in v1.0.0
func GetMemorySize ¶
GetMemorySize gets content of Resources.Limits.memory
func GetParameter ¶ added in v1.0.0
func GetParameter(spec *parametersv1alpha1.ParameterSpec, component string) *parametersv1alpha1.ComponentParametersSpec
func GetParameterReconfiguringStatus ¶ added in v1.0.0
func GetParameterReconfiguringStatus(status *parametersv1alpha1.ComponentReconfiguringStatus, name string) *parametersv1alpha1.ReconfiguringStatus
func GetParameterStatus ¶ added in v1.0.0
func GetParameterStatus(status *parametersv1alpha1.ParameterStatus, name string) *parametersv1alpha1.ComponentReconfiguringStatus
func GetPodCondition ¶
func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) *corev1.PodCondition
func GetPodContainer ¶ added in v0.9.0
GetPodContainer gets the pod container by name. if containerName is empty, return the first container.
func GetPodContainerWithVolumeMount ¶
GetPodContainerWithVolumeMount searches for containers mounting the volume
func GetPodListByInstanceSet ¶ added in v0.9.0
func GetPodListByInstanceSet(ctx context.Context, cli client.Client, its *workloads.InstanceSet) ([]corev1.Pod, error)
GetPodListByInstanceSet gets ITS pod list.
func GetPodRevision ¶
GetPodRevision gets the revision of Pod by inspecting the StatefulSetRevisionLabel. If pod has no revision empty string is returned.
func GetPodSelector ¶ added in v1.0.0
func GetPodSelector(pd *parametersv1alpha1.ParametersDefinitionSpec) *metav1.LabelSelector
func GetPortByName ¶ added in v1.0.0
func GetRequestMemorySize ¶
GetRequestMemorySize gets content of Resources.Limits.memory
func GetStorageSizeFromPersistentVolume ¶
func GetStorageSizeFromPersistentVolume(pvc corev1.PersistentVolumeClaimTemplate) int64
GetStorageSizeFromPersistentVolume gets content of Resources.Requests.storage
func GetUncachedObjects ¶
GetUncachedObjects returns a list of K8s objects, for these object types, and their list types, client.Reader will read directly from the API server instead of the cache, which may not be up-to-date. see sigs.k8s.io/controller-runtime/pkg/client/split.go to understand how client works with this UncachedObjects filter.
func GetUpdatedParametersReconciledPhase ¶ added in v1.0.0
func GetUpdatedParametersReconciledPhase(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail, status *parametersv1alpha1.ConfigTemplateItemDetailStatus) parametersv1alpha1.ParameterPhase
GetUpdatedParametersReconciledPhase gets the configuration phase
func GetVolumeMountByVolume ¶
func GetVolumeMountByVolume(container *corev1.Container, volumeName string) *corev1.VolumeMount
func GetVolumeMountName ¶
GetVolumeMountName finds the volume with mount name
func HandleCRDeletion ¶
func HandleCRDeletion(reqCtx RequestCtx, r client.Writer, cr client.Object, finalizer string, deletionHandler func() (*ctrl.Result, error)) (*ctrl.Result, error)
HandleCRDeletion handles CR deletion, adds finalizer if found a non-deleting object and removes finalizer during deletion process. Passes optional 'deletionHandler' func for external dependency deletion. Returns Result pointer if required to return out of outer 'Reconcile' reconciliation loop.
func IgnoreIsAlreadyExists ¶
IgnoreIsAlreadyExists returns errors if 'err' is not type of AlreadyExists
func InitHostPortManager ¶ added in v0.8.0
func IsAPIVersionSupported ¶ added in v1.0.0
func IsApplyUpdatedParameters ¶ added in v1.0.0
func IsApplyUpdatedParameters(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail) bool
IsApplyUpdatedParameters checks if the configuration is changed
func IsDelayedRequeueError ¶
func IsFailedPhase ¶ added in v1.0.0
func IsFailedPhase(phase parametersv1alpha1.ParameterPhase) bool
func IsMatchConfigVersion ¶
func IsNotFound ¶
IsNotFound returns true if the specified error is the error type of ErrorTypeNotFound.
func IsParameterFinished ¶ added in v1.0.0
func IsParameterFinished(phase parametersv1alpha1.ParameterPhase) bool
func IsPodAvailable ¶ added in v1.0.0
IsPodAvailable returns true if pod is ready for at least minReadySeconds
func IsPodFailedAndTimedOut ¶ added in v0.8.2
IsPodFailedAndTimedOut checks if the pod is failed and timed out.
func IsPodReady ¶ added in v1.0.0
IsPodReady returns true if pod is ready Currently, if pod is being deleted and have a grace period, k8s still considers it ready, which is not what we expect. See https://github.com/kubernetes/kubernetes/issues/129552
func IsRequeueError ¶
IsRequeueError checks if the error is the RequeueError.
func IsRerender ¶
func IsRerender(configMap *corev1.ConfigMap, item parametersv1alpha1.ConfigTemplateItemDetail) bool
IsRerender checks if the configuration template is changed
func IsTargetError ¶
IsTargetError checks if the error is the target error.
func ListOwnedPods ¶ added in v1.0.0
func ListShardingComponents ¶ added in v0.9.0
func LoadRegistryConfig ¶ added in v1.0.0
func LoadRegistryConfig() error
func MergeAndValidateConfigs ¶
func MergeAndValidateConfigs(baseConfigs map[string]string, updatedParams []core.ParamPairs, paramsDefs []*parametersv1alpha1.ParametersDefinition, configDescs []parametersv1alpha1.ComponentConfigDescription) (map[string]string, error)
MergeAndValidateConfigs merges and validates configuration files
func MergeList ¶ added in v0.9.0
MergeList merge src to dst, dst is modified in place. f returns a function that can be passed to slices.IndexFunc(). Items in src will overwrite items in dst, if possible.
func MergeMetadataMapInplace ¶ added in v0.8.2
MergeMetadataMapInplace merges two map[string]string, the targetMap will be updated.
func MergeMetadataMaps ¶ added in v0.8.2
func NeedDynamicReloadAction ¶ added in v1.0.0
func NeedDynamicReloadAction(pd *parametersv1alpha1.ParametersDefinitionSpec) bool
func NewControllerManagedBy ¶ added in v0.9.2
func NewDelayedRequeueError ¶
NewDelayedRequeueError creates a delayed requeue error which only returns in the last step of the DAG.
func NewEncryptor ¶
func NewEncryptor(encryptionKey string) *encryptor
func ObjectAPIVersionSupported ¶ added in v0.9.3
func ParametersDefinitionTerminalPhases ¶ added in v1.0.0
func ParametersDefinitionTerminalPhases(status parametersv1alpha1.ParametersDefinitionStatus, generation int64) bool
func ParametersDrivenConfigRenderTerminalPhases ¶ added in v1.0.0
func ParametersDrivenConfigRenderTerminalPhases(status parametersv1alpha1.ParamConfigRendererStatus, generation int64) bool
func ParametersTerminalPhases ¶ added in v1.0.0
func ParametersTerminalPhases(status parametersv1alpha1.ParameterStatus, generation int64) bool
func PodIsReadyWithLabel ¶
PodIsReadyWithLabel checks if pod is ready for ConsensusSet/ReplicationSet component, it will be available when the pod is ready and labeled with role.
func Reconciled ¶
Reconciled returns an empty result with nil error to signal a successful reconcile to the controller manager
func RecordCreatedEvent ¶
func RecordCreatedEvent(r record.EventRecorder, cr client.Object)
RecordCreatedEvent records an event when a CR created successfully
func ReloadStaticParameters ¶ added in v1.0.0
func ReloadStaticParameters(pd *parametersv1alpha1.ParametersDefinitionSpec) bool
func ReplaceImageRegistry ¶ added in v1.0.0
func RequeueAfter ¶
func RequeueWithError ¶
func RequeueWithError(err error, logger logr.Logger, msg string, keysAndValues ...interface{}) (reconcile.Result, error)
RequeueWithError requeues when an error occurs
func RequeueWithErrorAndRecordEvent ¶
func RequeueWithErrorAndRecordEvent(obj client.Object, recorder record.EventRecorder, err error, logger logr.Logger) (reconcile.Result, error)
RequeueWithErrorAndRecordEvent requeues when an error occurs. if it is an unknown error, triggers an event
func ResolveCmpdParametersDefs ¶ added in v1.0.0
func ResolveCmpdParametersDefs(ctx context.Context, reader client.Reader, cmpd *appsv1.ComponentDefinition) (*parametersv1alpha1.ParamConfigRenderer, []*parametersv1alpha1.ParametersDefinition, error)
func ResolveComponentConfigRender ¶ added in v1.0.0
func ResolveComponentConfigRender(ctx context.Context, reader client.Reader, cmpd *appsv1.ComponentDefinition) (*parametersv1alpha1.ParamConfigRenderer, error)
func ResolveConfigParameterSchema ¶ added in v1.0.0
func ResolveConfigParameterSchema(paramDef *parametersv1alpha1.ParametersDefinition, configTemplate *appsv1.ComponentFileTemplate) map[string]*ParameterMeta
func ResolveContainerDefaultFields ¶ added in v0.8.0
ResolveContainerDefaultFields set default value for some known fields of proto Container @pcontainer.
func ResolvePodSpecDefaultFields ¶ added in v0.8.0
ResolvePodSpecDefaultFields set default value for some known fields of proto PodSpec @pobj.
func ResourcesPayloadForComponent ¶ added in v0.9.0
func ResourcesPayloadForComponent(resources corev1.ResourceRequirements) any
func ServiceFQDN ¶ added in v1.0.0
func SetControllerReference ¶
func SetOwnerReference ¶
func SetOwnership ¶
func SetOwnership(owner, obj client.Object, scheme *runtime.Scheme, finalizer string, useOwnerReference ...bool) error
SetOwnership provides helper function controllerutil.SetControllerReference/controllerutil.SetOwnerReference and controllerutil.AddFinalizer if not exists.
func ToCoreV1PVCTs ¶ added in v1.0.0
func ToCoreV1PVCTs(vcts []appsv1.ClusterComponentVolumeClaimTemplate) []corev1.PersistentVolumeClaimTemplate
func ToCoreV1PVCs ¶ added in v1.0.0
func ToCoreV1PVCs(vcts []appsv1.ClusterComponentVolumeClaimTemplate) []corev1.PersistentVolumeClaim
func TransformComponentParameters ¶ added in v1.0.0
func TransformComponentParameters(params []opsv1alpha1.ParameterPair) parametersv1alpha1.ComponentParameters
func ValidateReferenceCR ¶
func ValidateReferenceCR(reqCtx RequestCtx, cli client.Client, obj client.Object, labelKey string, recordEvent func(), objLists ...client.ObjectList) (*ctrl.Result, error)
ValidateReferenceCR validates existing referencing CRs, if exists, requeue reconcile after 30 seconds
Types ¶
type ByPodName ¶
ByPodName sorts a list of jobs by pod name
type DelayedRequeueError ¶
type DelayedRequeueError interface { RequeueError Delayed() }
type Error ¶
func NewFatalError ¶
NewFatalError returns a new Error with ErrorTypeFatal
func NewNotFound ¶
NewNotFound returns a new Error with ErrorTypeNotFound.
func UnwrapControllerError ¶
UnwrapControllerError unwraps the Controller error from target error.
type ErrorType ¶
type ErrorType string
ErrorType is explicit error type.
const ( // ErrorWaitCacheRefresh waits for synchronization of the corresponding object cache in client-go from ApiServer. ErrorWaitCacheRefresh ErrorType = "WaitCacheRefresh" ErrorIgnoreCancel ErrorType = "IgnoreCancel" // ErrorTypeNotFound not found any resource. ErrorTypeNotFound ErrorType = "NotFound" ErrorTypeRequeue ErrorType = "Requeue" // requeue for reconcile. ErrorTypeFatal ErrorType = "Fatal" // fatal error // ErrorType for cluster controller ErrorTypeBackupFailed ErrorType = "BackupFailed" ErrorTypeRestoreFailed ErrorType = "RestoreFailed" ErrorTypeNeedWaiting ErrorType = "NeedWaiting" // waiting for next reconcile // ErrorType for preflight ErrorTypePreflightCommon = "PreflightCommon" ErrorTypeSkipPreflight = "SkipPreflight" // ErrorTypeExpectedInProcess is used to indicate that the operation is expected to be in process. ErrorTypeExpectedInProcess ErrorType = "ExpectedInProcess" )
type ParameterMeta ¶ added in v1.0.0
type PortManager ¶ added in v0.8.0
func GetPortManager ¶ added in v0.8.0
func GetPortManager() *PortManager
func NewPortManager ¶ added in v0.8.0
func NewPortManager(includes []PortRange, excludes []PortRange, cli client.Client) (*PortManager, error)
NewPortManager creates a new PortManager TODO[ziang] Putting all the port information in one configmap may have performance issues and is not secure enough. There is a risk of accidental deletion leading to the loss of cluster port information.
func (*PortManager) AllocatePort ¶ added in v0.8.0
func (pm *PortManager) AllocatePort(key string) (int32, error)
func (*PortManager) GetPort ¶ added in v0.9.0
func (pm *PortManager) GetPort(key string) (int32, error)
func (*PortManager) ReleaseByPrefix ¶ added in v0.8.0
func (pm *PortManager) ReleaseByPrefix(prefix string) error
func (*PortManager) ReleasePort ¶ added in v0.8.0
func (pm *PortManager) ReleasePort(key string) error
func (*PortManager) ReleasePorts ¶ added in v0.8.0
func (pm *PortManager) ReleasePorts(keys []string) error
type RequestCtx ¶
type RequestCtx struct { Ctx context.Context Req ctrl.Request Log logr.Logger Recorder record.EventRecorder }
RequestCtx wrapper for reconcile procedure context parameters
func (*RequestCtx) Event ¶
func (r *RequestCtx) Event(object runtime.Object, eventtype, reason, message string)
Event is wrapper for Recorder.Event, if Recorder is nil, then it's no-op.
func (*RequestCtx) Eventf ¶
func (r *RequestCtx) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})
Eventf is wrapper for Recorder.Eventf, if Recorder is nil, then it's no-op.
func (*RequestCtx) UpdateCtxValue ¶
func (r *RequestCtx) UpdateCtxValue(key, val any) context.Context
UpdateCtxValue updates Context value, returns parent Context.
type RequeueError ¶
type Result ¶
type Result struct { Phase parametersv1alpha1.ParameterPhase `json:"phase"` Revision string `json:"revision"` Policy string `json:"policy"` ExecResult string `json:"execResult"` SucceedCount int32 `json:"succeedCount"` ExpectedCount int32 `json:"expectedCount"` Retry bool `json:"retry"` Failed bool `json:"failed"` Message string `json:"message"` }