Documentation
¶
Overview ¶
Package common provides shared labels, constants, and utility functions used across the Valkey operator.
Index ¶
- Constants
- func BaseLabels(v *vkov1.Valkey, component string) map[string]string
- func ExtractVersionFromImage(image string) string
- func HeadlessServiceName(v *vkov1.Valkey, component string) string
- func MasterSelectorLabels(v *vkov1.Valkey) map[string]string
- func MergeAnnotations(maps ...map[string]string) map[string]string
- func MergeLabels(maps ...map[string]string) map[string]string
- func PodLabels(v *vkov1.Valkey, component, podName, role string, userLabels map[string]string) map[string]string
- func ReplicaSelectorLabels(v *vkov1.Valkey) map[string]string
- func SelectorLabels(v *vkov1.Valkey, component string) map[string]string
- func StatefulSetName(v *vkov1.Valkey, component string) string
Constants ¶
const ( // LabelComponent is the standard Kubernetes recommended label for the component. LabelComponent = "app.kubernetes.io/component" // LabelInstance is the standard Kubernetes recommended label for the instance. LabelInstance = "app.kubernetes.io/instance" // LabelManagedBy is the standard Kubernetes recommended label for the manager. LabelManagedBy = "app.kubernetes.io/managed-by" // LabelName is the standard Kubernetes recommended label for the name. LabelName = "app.kubernetes.io/name" // LabelVersion is the standard Kubernetes recommended label for the version. LabelVersion = "app.kubernetes.io/version" // LabelCluster is the operator-specific label for the cluster name. LabelCluster = "vko.gtrfc.com/cluster" // LabelInstanceName is the operator-specific label for the instance name. LabelInstanceName = "vko.gtrfc.com/instanceName" // LabelInstanceRole is the operator-specific label for the instance role. LabelInstanceRole = "vko.gtrfc.com/instanceRole" // ComponentValkey is the component value for Valkey instances. ComponentValkey = "valkey" // ComponentSentinel is the component value for Sentinel instances. ComponentSentinel = "sentinel" // RoleMaster is the role value for the master instance. RoleMaster = "master" // RoleReplica is the role value for a replica instance. RoleReplica = "replica" // RoleDraining is the role value for a pod undergoing graceful failover drain. // When set, the pod is removed from the -rw Service immediately. RoleDraining = "draining" // ManagedBy is the constant value for the managed-by label. ManagedBy = "vko.gtrfc.com" )
Variables ¶
This section is empty.
Functions ¶
func BaseLabels ¶
BaseLabels returns the common labels shared by all resources managed by the operator. These labels do NOT include pod-specific labels (instanceName, instanceRole).
func ExtractVersionFromImage ¶
ExtractVersionFromImage extracts the tag portion from a container image string. Returns "latest" if no tag is present.
func HeadlessServiceName ¶
HeadlessServiceName returns the name for a headless Service.
func MasterSelectorLabels ¶ added in v1.1.0
MasterSelectorLabels returns selector labels that match only the master pod. Used by the -rw Service.
func MergeAnnotations ¶
MergeAnnotations merges multiple annotation maps. Later maps take precedence.
func MergeLabels ¶
MergeLabels merges multiple label maps. Later maps take precedence over earlier ones.
func PodLabels ¶
func PodLabels(v *vkov1.Valkey, component, podName, role string, userLabels map[string]string) map[string]string
PodLabels returns the full set of labels for a pod, including instance-specific labels. userLabels are merged in, but operator-managed labels take precedence to prevent overwrites.
func ReplicaSelectorLabels ¶ added in v1.1.0
ReplicaSelectorLabels returns selector labels that match only replica pods. Used by the -r Service.
func SelectorLabels ¶
SelectorLabels returns the minimal label set used for label selectors (e.g., Services, StatefulSets).
Types ¶
This section is empty.