mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-06 16:11:52 +02:00
Add version label to the cluster. (#96)
* Add version label to the cluster. According to the STUPS team the daemon that exports logs to scalyr stops the export if the version label is missing. * Move label names to constants. * Run go fmt
This commit is contained in:
committed by
Murat Kabilov
parent
08c0e3b6dd
commit
47e3e29a56
@@ -2,16 +2,20 @@ package constants
|
||||
|
||||
const (
|
||||
//Constants
|
||||
TPRName = "postgresql"
|
||||
TPRVendor = "acid.zalan.do"
|
||||
TPRDescription = "Managed PostgreSQL clusters"
|
||||
TPRApiVersion = "v1"
|
||||
DataVolumeName = "pgdata"
|
||||
PasswordLength = 64
|
||||
UserSecretTemplate = "%s.%s.credentials.%s.%s" // Username, ClusterName, TPRName, TPRVendor
|
||||
ZalandoDnsNameAnnotation = "zalando.org/dnsname"
|
||||
KubeIAmAnnotation = "iam.amazonaws.com/role"
|
||||
ResourceName = TPRName + "s"
|
||||
PodRoleMaster = "master"
|
||||
PodRoleReplica = "replica"
|
||||
TPRName = "postgresql"
|
||||
TPRVendor = "acid.zalan.do"
|
||||
TPRDescription = "Managed PostgreSQL clusters"
|
||||
TPRApiVersion = "v1"
|
||||
DataVolumeName = "pgdata"
|
||||
PasswordLength = 64
|
||||
UserSecretTemplate = "%s.%s.credentials.%s.%s" // Username, ClusterName, TPRName, TPRVendor
|
||||
ZalandoDnsNameAnnotation = "zalando.org/dnsname"
|
||||
KubeIAmAnnotation = "iam.amazonaws.com/role"
|
||||
ResourceName = TPRName + "s"
|
||||
PodRoleMaster = "master"
|
||||
PodRoleReplica = "replica"
|
||||
ApplicationNameLabel = "application"
|
||||
ApplicationNameLabelValue = "spilo"
|
||||
SpiloRoleLabel = "spilo-role"
|
||||
ClusterNameLabel = "version"
|
||||
)
|
||||
|
||||
+5
-4
@@ -5,13 +5,14 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/motomux/pretty"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.bus.zalan.do/acid/postgres-operator/pkg/spec"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"strings"
|
||||
"github.bus.zalan.do/acid/postgres-operator/pkg/util/constants"
|
||||
)
|
||||
|
||||
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
@@ -37,7 +38,7 @@ func NameFromMeta(meta v1.ObjectMeta) spec.NamespacedName {
|
||||
}
|
||||
|
||||
func PodClusterName(pod *v1.Pod) spec.NamespacedName {
|
||||
if name, ok := pod.Labels["spilo-cluster"]; ok {
|
||||
if name, ok := pod.Labels[constants.ClusterNameLabel]; ok {
|
||||
return spec.NamespacedName{
|
||||
Namespace: pod.Namespace,
|
||||
Name: name,
|
||||
@@ -48,7 +49,7 @@ func PodClusterName(pod *v1.Pod) spec.NamespacedName {
|
||||
}
|
||||
|
||||
func PodSpiloRole(pod *v1.Pod) string {
|
||||
return pod.Labels["spilo-role"]
|
||||
return pod.Labels[constants.SpiloRoleLabel]
|
||||
}
|
||||
|
||||
func PGUserPassword(user spec.PgUser) string {
|
||||
|
||||
Reference in New Issue
Block a user