Documentation ¶
Overview ¶
Package utils features auxiliary functions for the Anthos DB Operator compliant resources.
Index ¶
- Constants
- Variables
- func DiskSpaceTotal(inst commonv1alpha1.Instance) (int64, error)
- func FindDiskSize(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, ...) resource.Quantity
- func FindPods(ctx context.Context, cli client.Client, sts *appsv1.StatefulSet) ([]corev1.Pod, error)
- func FindStorageClassName(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, ...) (string, error)
- func FindVolumeSnapshotClassName(volumneSnapshotClass string, configSpec *commonv1alpha1.ConfigSpec, ...) (string, error)
- func GetPodCondition(pod corev1.Pod, condType corev1.PodConditionType) *corev1.PodCondition
- func LoadBalancerAnnotations(options *commonv1alpha1.DBLoadBalancerOptions) map[string]string
- func LoadBalancerIpAddress(options *commonv1alpha1.DBLoadBalancerOptions) string
- func LoadBalancerURL(svc *corev1.Service, port int) string
- func ObjectKeyOf(sts *appsv1.StatefulSet, pvc *corev1.PersistentVolumeClaim, i int) client.ObjectKey
- func SnapshotDisks(ctx context.Context, diskSpecs []commonv1alpha1.DiskSpec, owner metav1.Object, ...) error
- func VerifyPodsStatus(ctx context.Context, cli client.Client, sts *appsv1.StatefulSet) error
Constants ¶
const ( PlatformGCP = "GCP" PlatformBareMetal = "BareMetal" PlatformMinikube = "Minikube" PlatformKind = "Kind" EnginePostgres = "Postgres" EngineOracle = "Oracle" )
Variables ¶
var ( ErrPodUnschedulable = errors.New("Pod is unschedulable") ErrNoResources = errors.New("Insufficient resources to create Pod") NoResourcesMessageRegexp = "Insufficient memory|Insufficient cpu|enough free storage" )
Functions ¶
func DiskSpaceTotal ¶
func DiskSpaceTotal(inst commonv1alpha1.Instance) (int64, error)
DiskSpaceTotal is a helper function to calculate the total amount of allocated space across all disks requested for an instance.
func FindDiskSize ¶
func FindDiskSize(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, defaultDiskSpecs map[string]commonv1alpha1.DiskSpec, defaultDiskSize resource.Quantity) resource.Quantity
func FindStorageClassName ¶
func FindStorageClassName(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, defaultPlatform string, engineType string) (string, error)
func FindVolumeSnapshotClassName ¶
func FindVolumeSnapshotClassName(volumneSnapshotClass string, configSpec *commonv1alpha1.ConfigSpec, defaultPlatform string, engineType string) (string, error)
func GetPodCondition ¶
func GetPodCondition(pod corev1.Pod, condType corev1.PodConditionType) *corev1.PodCondition
func LoadBalancerAnnotations ¶
func LoadBalancerAnnotations(options *commonv1alpha1.DBLoadBalancerOptions) map[string]string
LoadBalancerAnnotations returns cloud provider specific annotations that must be attached to a LoadBalancer k8s service during creation
func LoadBalancerIpAddress ¶
func LoadBalancerIpAddress(options *commonv1alpha1.DBLoadBalancerOptions) string
LoadBalancerIpAddress returns an IP address address for the Load Balancer if specified. Otherwise, the empty string is returned.
func LoadBalancerURL ¶
LoadBalancerURL returns a URL that can be used to connect to a Load Balancer.
func ObjectKeyOf ¶
func ObjectKeyOf(sts *appsv1.StatefulSet, pvc *corev1.PersistentVolumeClaim, i int) client.ObjectKey
func SnapshotDisks ¶
func SnapshotDisks(ctx context.Context, diskSpecs []commonv1alpha1.DiskSpec, owner metav1.Object, c client.Client, scheme *runtime.Scheme, getPvcSnapshotName func(commonv1alpha1.DiskSpec) (string, string, string), applyOpts []client.PatchOption) error
SnapshotDisks takes a snapshot of each disk as provided in diskSpecs. Ownership of the snapshots are granted to owner object. getPvcSnapshotName is a function that, given a DiskSpec, returns the full PVC name, snapshot name, and volumeSnapshotClassName of that disk. Taking snapshots here is best-effort only: it will returns errors even if only 1 disk failed the snapshot, and upon retry it will try to take snapshot of all disks again.
func VerifyPodsStatus ¶
Check if POD initialiazation is stuck because of insufficient resources It will return error if Pod creation is stuck and needs manual intervention.
Types ¶
This section is empty.