lib

package
v0.60.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCertRenewBefore = time.Minute * 5
	DefaultAuthRenewBefore = time.Minute * 10
)
View Source
const (
	MergedOpsSubStr     = "-rcfg-merged-"
	OriginalOpsSkipped  = "OriginalOpsSkipped"
	MergedFromOps       = "MergedFromOps"
	ConfigurationMerged = "ConfigurationMerged"
)
View Source
const (
	ContinueGeneral  = iota // 0
	MergeNeeded             // 1
	RequeueNeeded           // 2
	RequeueNotNeeded        // 3
)
View Source
const StorageMigrationAnnotationCoreKey = "storagemigration.ops.kubedb.com"
View Source
const VolumeExpansionAnnotationCoreKey = "volumeexpansion.ops.kubedb.com"

Variables

View Source
var ExcludedFromSkipperLogic = []string{"Reconfigure"} // Skip Reconfigure ops requests - they are handled by ReconfigureMerger

Functions

func AddOwnerReferenceToSecret added in v0.60.0

func AddOwnerReferenceToSecret(kc kubernetes.Interface, gvk schema.GroupVersionKind, db LabeledObject, secret metav1.ObjectMeta) error

func BackupOrRestoreRunningForDB added in v0.60.0

func BackupOrRestoreRunningForDB(KBClient client.Client, stashClient scs.StashV1beta1Interface, dbMeta metav1.ObjectMeta, kind string) (bool, string, error)

func CheckManifestWorkPodReady added in v0.60.0

func CheckManifestWorkPodReady(mw *ocmapi.ManifestWork, log *logr.Logger) bool

Check the Pod ready condition from manifestWork condition feedback.

func CreateDataMigratorJob added in v0.60.0

func CreateDataMigratorJob(client kubernetes.Interface, jobMeta metav1.ObjectMeta, pvcTemplate string, podName string) error

func CreateDatabasePVC added in v0.60.0

func CreateDatabasePVC(client kubernetes.Interface, pvcMeta metav1.ObjectMeta, pvc *core.PersistentVolumeClaim, storageClass *string, labels map[string]string) error

func CreateMigratorPVC added in v0.60.0

func CreateMigratorPVC(client kubernetes.Interface, pvcMeta metav1.ObjectMeta, pvc *core.PersistentVolumeClaim, storageClass *string, owner *metav1.OwnerReference) error

func CreatePVCMounterPod added in v0.60.0

func CreatePVCMounterPod(client kubernetes.Interface, dbPod *core.Pod, pvcMounter string) error

func DBForSecret added in v0.60.0

func DBForSecret(certGetter cm_cs.CertificatesGetter, kind string, s *core.Secret) (cache.ExplicitKey, error)

func DBForService added in v0.60.0

func DBForService(kind string, s *core.Service) cache.ExplicitKey

func DBsForClusterIssuer added in v0.60.0

func DBsForClusterIssuer(dc dynamic.Interface, gvr schema.GroupVersionResource, clusterIssuer *cm_api.ClusterIssuer) ([]cache.ExplicitKey, error)

func DBsForIssuer added in v0.60.0

func DBsForIssuer(dc dynamic.Interface, gvr schema.GroupVersionResource, issuer *cm_api.Issuer) ([]cache.ExplicitKey, error)

func EvictDistributedPod added in v0.60.0

func EvictDistributedPod(kbClient client.Client, pp, podName string) (types.UID, error)

Evict Pod restart the pod by deleting the manifestwork resouces. podMeta.namespace contain the origin namespace of pod rather than the distributed manifest namespace.

func EvictPod added in v0.60.0

func EvictPod(kClient kubernetes.Interface, podMeta metav1.ObjectMeta) (types.UID, error)

func ExtractPVCFromManifestWork added in v0.60.0

func ExtractPVCFromManifestWork(kbClient client.Client, pp, podName string) (*core.PersistentVolumeClaim, error)

func ExtractPodFromManifestWork added in v0.60.0

func ExtractPodFromManifestWork(kbClient client.Client, pp, podName string) (*core.Pod, error)

extractPodFromManifestWork return the pod manifest. podMeta contain the original namespace of the pods.

func GetCertificateCondition added in v0.60.0

func GetCertificateCondition(conditions []cm_api.CertificateCondition, condType cm_api.CertificateConditionType) (int, *cm_api.CertificateCondition)

func GetDatabasePVCName added in v0.60.0

func GetDatabasePVCName(pvcTemplate string, podName string) string

func GetDistributedPodNamespace added in v0.60.0

func GetDistributedPodNamespace(kbClient client.Client, ppName, podName string) (string, error)

get the manifestwork namespace for podManifestWork

func GetIssuerObjectRef added in v0.60.0

func GetIssuerObjectRef(tlsConfig *kmapi.TLSConfig, alias string) cmmeta.ObjectReference

func GetMigratorPVCName added in v0.60.0

func GetMigratorPVCName(podName string) string

func GetPVCMounterPodName added in v0.60.0

func GetPVCMounterPodName(podName string) string

func GetPodMigrationCompleteCondition added in v0.60.0

func GetPodMigrationCompleteCondition(podName string) string

func GetSecret added in v0.60.0

func GetSecret(kbClient client.Client, namespacedName types.NamespacedName) (*core.Secret, error)

func GetStorageMigratorJobName added in v0.60.0

func GetStorageMigratorJobName(podName string) string

func HasCertificateCondition added in v0.60.0

func HasCertificateCondition(conditions []cm_api.CertificateCondition, condType cm_api.CertificateConditionType) bool

func IsCertificateConditionTrue added in v0.60.0

func IsCertificateConditionTrue(conditions []cm_api.CertificateCondition, condType cm_api.CertificateConditionType) bool

func IsJobConditionTrue added in v0.60.0

func IsJobConditionTrue(conditions []batchv1.JobCondition, condType batchv1.JobConditionType) bool

func IsOpsTypeSupported added in v0.60.0

func IsOpsTypeSupported(supportedTypes []string, curOpsType string) bool

func IsServiceReady added in v0.60.0

func IsServiceReady(getter v1.ServicesGetter, svc metav1.ObjectMeta) bool

func NewLogger

func NewLogger(verbosity int) logr.Logger

func NewSkipper added in v0.60.0

func NewSkipper(kbClient client.Client, kind string, curOps client.Object, opsReqList []client.Object) skipper

func ObjectToUnstructured added in v0.60.0

func ObjectToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error)

func PauseBackupConfiguration added in v0.60.0

func PauseBackupConfiguration(KBClient client.Client, stashClient scs.StashV1beta1Interface, dbMeta metav1.ObjectMeta, pausedBackups []kmapi.TypedObjectReference, kind string, opsGeneration int64) ([]kmapi.TypedObjectReference, []kmapi.Condition, error)

func ResumeBackupConfiguration added in v0.60.0

func ResumeBackupConfiguration(KBClient client.Client, stashClient scs.StashV1beta1Interface, pausedBackups []kmapi.TypedObjectReference, opsGeneration int64) ([]kmapi.Condition, error)

func SecretExists added in v0.60.0

func SecretExists(kc kubernetes.Interface, meta metav1.ObjectMeta) bool

func ServiceDNS added in v0.60.0

func ServiceDNS(svc metav1.ObjectMeta) []string

func ServiceHosts added in v0.60.0

func ServiceHosts(getter v1.ServicesGetter, svc metav1.ObjectMeta) (sets.Set[string], sets.Set[string], error)

func SetNodeSelector added in v0.60.0

func SetNodeSelector(policy nodemeta.NodeSelectionPolicy, selector map[string]string, topology *opsapi.Topology) map[string]string

func SetToleration added in v0.60.0

func SetToleration(policy nodemeta.NodeSelectionPolicy, tolerations []core.Toleration, topology *opsapi.Topology) []core.Toleration

func StorageMigrationAnnotationKey added in v0.60.0

func StorageMigrationAnnotationKey(podName string) string

func UpdateMachineProfileAnnotation added in v0.60.0

func UpdateMachineProfileAnnotation(db, ops map[string]string)

func UpdateManifestWork added in v0.60.0

func UpdateManifestWork(kbClient client.Client, manifestName, namespace string, objects ...client.Object) error

func UpdatePVCManifestWork added in v0.60.0

func UpdatePVCManifestWork(kbClient client.Client, reqResource core.VolumeResourceRequirements, pp, podName string) error

func UpsertCertificateCondition added in v0.60.0

func UpsertCertificateCondition(conditions []cm_api.CertificateCondition, newCond cm_api.CertificateCondition) []cm_api.CertificateCondition

func ValidateAuthSecret added in v0.60.0

func ValidateAuthSecret(secret *core.Secret) error

func ValidateVirtualAuthSecret added in v0.60.0

func ValidateVirtualAuthSecret(secret *vsecretapi.Secret) error

func VolumeExpansionAnnotationKey added in v0.60.0

func VolumeExpansionAnnotationKey(podName string) string

func WaitForJobToBeCompleted added in v0.60.0

func WaitForJobToBeCompleted(ctx context.Context, timeOut time.Duration, c kubernetes.Interface, meta metav1.ObjectMeta) error

Types

type ConvertFunc added in v0.60.0

type ConvertFunc func(u *unstructured.Unstructured) (opsapi.Accessor, error)

type LabeledObject added in v0.60.0

type LabeledObject interface {
	metav1.Object
	OffshootLabels() map[string]string
}

type MergeFunc added in v0.60.0

type MergeFunc func(pendingReconfigureOps []opsapi.Accessor) (any, error)

type ReconfigureMerger added in v0.60.0

type ReconfigureMerger struct {
	// contains filtered or unexported fields
}

func NewReconfigureMerger added in v0.60.0

func NewReconfigureMerger(kbClient client.Client, kind string, curOps client.Object, mergeFn MergeFunc, convertFn ConvertFunc, log interface {
	Info(msg string, keysAndValues ...any)
},
) (*ReconfigureMerger, error)

func (*ReconfigureMerger) CheckIfAnyOpsRequestIsProgressing added in v0.60.1

func (m *ReconfigureMerger) CheckIfAnyOpsRequestIsProgressing() bool

func (*ReconfigureMerger) EnsureMergedOpsRequest added in v0.60.0

func (m *ReconfigureMerger) EnsureMergedOpsRequest(mergedOpsRequest opsapi.Accessor, pendingReconfigureOps []opsapi.Accessor) error

func (*ReconfigureMerger) FindPendingReconfigureOpsToMerge added in v0.60.0

func (m *ReconfigureMerger) FindPendingReconfigureOpsToMerge() (int, []opsapi.Accessor)

FindPendingReconfigureOpsToMerge - Check if OriginalOpsSkipped condition is present. - If any Reconfigure is Progressing (other than current), requeue current request - Collect pendingReconfigureOps - Avoid parallel processing by checking if current ops is already part of an existing merge - markAsSkipped is the current ops is already merged into another ops.

func (*ReconfigureMerger) GetMergedOpsRequest added in v0.60.0

func (m *ReconfigureMerger) GetMergedOpsRequest(firstPendingOps opsapi.Accessor, config any) (*unstructured.Unstructured, error)

func (*ReconfigureMerger) Run added in v0.60.0

func (m *ReconfigureMerger) Run() (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL