Documentation ¶
Overview ¶
Package utils features auxiliary functions for the Anthos DB Operator compliant resources.
Index ¶
- Constants
- func DiskSpaceTotal(inst commonv1alpha1.Instance) (int64, error)
- func FindDiskSize(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, ...) resource.Quantity
- func FindStorageClassName(diskSpec *commonv1alpha1.DiskSpec, configSpec *commonv1alpha1.ConfigSpec, ...) (string, error)
- func FindVolumeSnapshotClassName(volumneSnapshotClass string, configSpec *commonv1alpha1.ConfigSpec, ...) (string, error)
- func LoadBalancerAnnotations(options *commonv1alpha1.DBLoadBalancerOptions) map[string]string
- func LoadBalancerIpAddress(options *commonv1alpha1.DBLoadBalancerOptions) string
- func LoadBalancerURL(svc *corev1.Service, port int) string
- func SnapshotDisks(ctx context.Context, diskSpecs []commonv1alpha1.DiskSpec, owner metav1.Object, ...) error
Constants ¶
const ( PlatformGCP = "GCP" PlatformBareMetal = "BareMetal" PlatformMinikube = "Minikube" PlatformKind = "Kind" EnginePostgres = "Postgres" EngineOracle = "Oracle" )
Variables ¶
This section is empty.
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 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 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.
Types ¶
This section is empty.