Documentation
¶
Index ¶
- Variables
- func AcquireLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string, ...) error
- func AddAnnotation(obj client.Object, key, value string)
- func AddLabel(obj client.Object, key, value string)
- func AnnotateObject(ctx context.Context, c client.Client, obj client.Object, ...) error
- func ConfigMap(cr *apiv1.PerconaServerMySQL, name, filename, data string, component string) *corev1.ConfigMap
- func ConfigMapHash(cm *corev1.ConfigMap) (string, error)
- func CustomConfigHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL, ...) (string, error)
- func DeannotateObject(ctx context.Context, c client.Client, obj client.Object, ...) error
- func DefaultAPINamespace() (string, error)
- func DeleteSecrets(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL, ...) error
- func EnsureObjectWithHash(ctx context.Context, cl client.Client, owner metav1.Object, obj client.Object, ...) error
- func EnsureService(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL, ...) error
- func EqualConfigMaps(cfgs ...*corev1.ConfigMap) bool
- func EqualMetadata(m ...metav1.ObjectMeta) bool
- func ExecProbe(probe corev1.Probe, cmd []string) *corev1.Probe
- func GetCRWithDefaults(ctx context.Context, cl client.Client, nn types.NamespacedName, ...) (*apiv1.PerconaServerMySQL, error)
- func GetImageIDFromPod(pod *corev1.Pod, containerName string) (string, error)
- func GetLease(ctx context.Context, client client.Client, leaseName, namespace string) (*coordv1.Lease, error)
- func GetMySQLTLSHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL) (string, error)
- func GetTLSHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL) (string, error)
- func InitContainer(cr *apiv1.PerconaServerMySQL, component string, image string, ...) corev1.Container
- func InitImage(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, ...) (string, error)
- func IsPodReady(pod corev1.Pod) bool
- func IsPodRunning(pod corev1.Pod) bool
- func IsPodWithNameReady(ctx context.Context, cl client.Client, nn types.NamespacedName) (bool, error)
- func KStatusCompute(obj client.Object) (*kstatus.Result, error)
- func KubernetesClusterDomain(ctx context.Context, override string) string
- func ObjectExists(ctx context.Context, cl client.Reader, nn types.NamespacedName, ...) (bool, error)
- func ObjectHash(obj runtime.Object) (string, error)
- func OperatorImage(ctx context.Context, cl client.Reader) (string, error)
- func PVC(cr *apiv1.PerconaServerMySQL, name string, spec *apiv1.VolumeSpec) corev1.PersistentVolumeClaim
- func PVCsByLabels(ctx context.Context, cl client.Reader, l map[string]string, namespace string) ([]corev1.PersistentVolumeClaim, error)
- func PodsByLabels(ctx context.Context, cl client.Reader, l map[string]string, namespace string) ([]corev1.Pod, error)
- func PrepareInitContainersWithS3CA(job *batchv1.Job, cluster *apiv1.PerconaServerMySQL, ...)
- func PrepareJobWithS3CA(job *batchv1.Job, storage *apiv1.BackupStorageS3Spec)
- func ReadyPods(ctx context.Context, cl client.Reader, l map[string]string, namespace string) ([]corev1.Pod, error)
- func ReleaseLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string) error
- func RemoveFinalizers(ctx context.Context, c client.Client, obj client.Object, finalizers ...string) error
- func RemoveLabel(obj client.Object, key string)
- func RenderConfiguration(configurable Configurable) (string, error)
- func RolloutRestart(ctx context.Context, cl client.Client, obj runtime.Object, ...) error
- func S3CAPath(selector apiv1.CABundleSecretSelector) string
- func S3CertVolumes(selectors []apiv1.CABundleSecretSelector) []corev1.Volume
- func SecretKeySelector(name, key string) *corev1.SecretKeySelector
- func ServicesByLabels(ctx context.Context, cl client.Reader, l map[string]string, namespace string) ([]corev1.Service, error)
- func SetFinalizers(ctx context.Context, c client.Client, obj client.Object, finalizers ...string) error
- func UserPassword(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, ...) (string, error)
- type Component
- type ComponentWithInit
- type Configurable
- type EnsureResult
- type IsHolderStaleFunc
Constants ¶
This section is empty.
Variables ¶
var ErrLeaseAlreadyHeld = errors.New("lease held by another holder")
var ErrPasswordNotFound = errors.New("password not found in secret")
Functions ¶
func AcquireLease ¶ added in v1.1.0
func AcquireLease(ctx context.Context, cl client.Client, leaseName, holder, namespace string, checkStale IsHolderStaleFunc) error
AcquireLease attempts to acquire a named lease for the given holder. If isHolderStale is non-nil and the lease is held by a different holder, the callback is invoked to determine whether the current holder is stale. A stale holder is evicted atomically and the lease is granted to the new holder.
func AddAnnotation ¶ added in v0.6.0
func AnnotateObject ¶ added in v0.11.0
func AnnotateObject(ctx context.Context, c client.Client, obj client.Object, annotations map[naming.AnnotationKey]string) error
AnnotateObject adds the specified annotations to the object
func CustomConfigHash ¶ added in v0.12.0
func CustomConfigHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL, configurable Configurable, component string) (string, error)
func DeannotateObject ¶ added in v0.11.0
func DeannotateObject(ctx context.Context, c client.Client, obj client.Object, annotation naming.AnnotationKey) error
DeannotateObject removes the specified annotation from the object
func DefaultAPINamespace ¶
DefaultAPINamespace returns namespace for direct api access from a pod https://v1-21.docs.kubernetes.io/docs/tasks/run-application/access-api-from-pod/#directly-accessing-the-rest-api
func DeleteSecrets ¶ added in v0.9.0
func EnsureObjectWithHash ¶
func EnsureService ¶ added in v0.4.0
func EqualConfigMaps ¶ added in v1.0.0
func EqualMetadata ¶ added in v0.12.0
func EqualMetadata(m ...metav1.ObjectMeta) bool
func GetCRWithDefaults ¶ added in v0.4.0
func GetCRWithDefaults( ctx context.Context, cl client.Client, nn types.NamespacedName, serverVersion *platform.ServerVersion, ) (*apiv1.PerconaServerMySQL, error)
func GetImageIDFromPod ¶ added in v0.11.0
func GetLease ¶ added in v1.1.0
func GetLease(ctx context.Context, client client.Client, leaseName, namespace string) (*coordv1.Lease, error)
+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch
func GetMySQLTLSHash ¶ added in v1.3.0
func GetMySQLTLSHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL) (string, error)
GetMySQLTLSHash returns the same hash for the MySQL pod template, except that starting with 1.3.0 it only covers the CA: a new leaf signed by the same CA is reloaded into the running mysqld instead of restarting it.
func GetTLSHash ¶ added in v0.12.0
func GetTLSHash(ctx context.Context, cl client.Client, cr *apiv1.PerconaServerMySQL) (string, error)
GetTLSHash returns the hash a pod template carries so that a change in the TLS secret rolls it out. Orchestrator, HAProxy and Router read the certificates once at startup, so any change to them means a restart.
func InitContainer ¶ added in v0.3.0
func InitContainer(cr *apiv1.PerconaServerMySQL, component string, image string, initSpec *apiv1.InitContainerSpec, pullPolicy corev1.PullPolicy, secCtx *corev1.SecurityContext, resources corev1.ResourceRequirements, extraVolumeMounts []corev1.VolumeMount, ) corev1.Container
func InitImage ¶
func InitImage(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, comp ComponentWithInit) (string, error)
InitImage returns the image to be used in init container. It returns component specific init image if it's defined, else it returns top level init image. If there is no init image defined in the CR, it returns the current running operator image.
func IsPodReady ¶
func IsPodRunning ¶ added in v1.3.0
func IsPodWithNameReady ¶ added in v0.3.0
func KStatusCompute ¶ added in v1.2.0
func KubernetesClusterDomain ¶ added in v1.2.0
KubernetesClusterDomain looks up the Kubernetes cluster domain name. If the override parameter is provided, it is returned without performing any operations
func ObjectExists ¶
func OperatorImage ¶ added in v0.2.0
func PVC ¶
func PVC(cr *apiv1.PerconaServerMySQL, name string, spec *apiv1.VolumeSpec) corev1.PersistentVolumeClaim
func PVCsByLabels ¶ added in v0.4.0
func PodsByLabels ¶
func PrepareInitContainersWithS3CA ¶ added in v1.3.0
func PrepareInitContainersWithS3CA(job *batchv1.Job, cluster *apiv1.PerconaServerMySQL, storage *apiv1.BackupStorageS3Spec)
func PrepareJobWithS3CA ¶ added in v1.3.0
func PrepareJobWithS3CA(job *batchv1.Job, storage *apiv1.BackupStorageS3Spec)
func ReleaseLease ¶ added in v1.1.0
ReleaseLease deletes the lease only if it is still held by the given holder. UID and ResourceVersion preconditions prevent accidentally deleting a lease that was re-created by a concurrent acquirer between the Get and Delete.
func RemoveFinalizers ¶ added in v1.3.0
func RemoveLabel ¶
func RenderConfiguration ¶ added in v1.3.0
func RenderConfiguration(configurable Configurable) (string, error)
RenderConfiguration expands .spec.<component>.configuration into the content the operator writes to the generated ConfigMap.
func RolloutRestart ¶
func RolloutRestart(ctx context.Context, cl client.Client, obj runtime.Object, key naming.AnnotationKey, value string) error
RolloutRestart restarts pods owned by object by updating the pod template with passed annotation key-value.
func S3CAPath ¶ added in v1.3.0
func S3CAPath(selector apiv1.CABundleSecretSelector) string
func S3CertVolumes ¶ added in v1.3.0
func S3CertVolumes(selectors []apiv1.CABundleSecretSelector) []corev1.Volume
func SecretKeySelector ¶
func SecretKeySelector(name, key string) *corev1.SecretKeySelector
SecretKeySelector is a k8s helper to create SecretKeySelector object
func ServicesByLabels ¶
func SetFinalizers ¶ added in v1.3.0
func UserPassword ¶
func UserPassword(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, username apiv1.SystemUser) (string, error)
Types ¶
type ComponentWithInit ¶ added in v0.3.0
type ComponentWithInit interface {
GetInitSpec(cr *apiv1.PerconaServerMySQL) apiv1.InitContainerSpec
}
type Configurable ¶ added in v0.12.0
type EnsureResult ¶ added in v1.3.0
EnsureResult reports what ensuring a component did to the object in the API. PodsRestarting is true only when the write replaced the pod template.