mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-03 20:56:33 +02:00
Adds a configurable mapping between PostgreSQL CR annotations and EBS
volume tags. The operator reads the configured annotation keys from the
CR metadata and applies them as tags on the associated EBS volumes during
each sync cycle.
Tags are compared against existing EBS tags (extracted from DescribeVolumes,
which is already called for volume management) and CreateTags is only called
when a tag is missing or has a different value, avoiding unnecessary AWS API
calls on steady state.
Configuration example in the operator ConfigMap/OperatorConfiguration:
aws_or_gcp:
ebs_volume_tags_from_annotations:
application: zalando.org/owning-application
team: zalando.org/team
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: tcondeixa <tscondeixa@gmail.com>
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package volumes
|
|
|
|
//go:generate go tool mockgen -package mocks -destination=../../../mocks/$GOFILE -source=$GOFILE
|
|
|
|
import v1 "k8s.io/api/core/v1"
|
|
|
|
// VolumeProperties ...
|
|
type VolumeProperties struct {
|
|
VolumeID string
|
|
VolumeType string
|
|
Size int64
|
|
Iops int64
|
|
Throughput int64
|
|
Tags map[string]string
|
|
}
|
|
|
|
// VolumeResizer defines the set of methods used to implememnt provider-specific resizing of persistent volumes.
|
|
type VolumeResizer interface {
|
|
ConnectToProvider() error
|
|
IsConnectedToProvider() bool
|
|
VolumeBelongsToProvider(pv *v1.PersistentVolume) bool
|
|
GetProviderVolumeID(pv *v1.PersistentVolume) (string, error)
|
|
ExtractVolumeID(volumeID string) (string, error)
|
|
ResizeVolume(providerVolumeID string, newSize int64) error
|
|
ModifyVolume(providerVolumeID string, newType *string, newSize *int64, iops *int64, throughput *int64) error
|
|
DisconnectFromProvider() error
|
|
DescribeVolumes(providerVolumesID []string) ([]VolumeProperties, error)
|
|
TagVolumes(providerVolumesID []string, tags map[string]string) error
|
|
}
|