mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-03 22:18:44 +02:00
Use unified type for the namespaced object names
This commit is contained in:
@@ -52,11 +52,11 @@ type PostgresStatus string
|
||||
|
||||
const (
|
||||
ClusterStatusUnknown PostgresStatus = ""
|
||||
ClusterStatusCreating = "Creating"
|
||||
ClusterStatusUpdating = "Updating"
|
||||
ClusterStatusUpdateFailed = "UpdateFailed"
|
||||
ClusterStatusAddFailed = "CreateFailed"
|
||||
ClusterStatusRunning = "Running"
|
||||
ClusterStatusCreating PostgresStatus = "Creating"
|
||||
ClusterStatusUpdating PostgresStatus = "Updating"
|
||||
ClusterStatusUpdateFailed PostgresStatus = "UpdateFailed"
|
||||
ClusterStatusAddFailed PostgresStatus = "CreateFailed"
|
||||
ClusterStatusRunning PostgresStatus = "Running"
|
||||
)
|
||||
|
||||
// PostgreSQL Third Party (resource) Object
|
||||
|
||||
+19
-13
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type PodEventType string
|
||||
|
||||
type PodName types.NamespacedName
|
||||
type NamespacedName types.NamespacedName
|
||||
|
||||
const (
|
||||
PodEventAdd PodEventType = "ADD"
|
||||
@@ -16,26 +16,32 @@ const (
|
||||
)
|
||||
|
||||
type PodEvent struct {
|
||||
ClusterName ClusterName
|
||||
PodName PodName
|
||||
ClusterName NamespacedName
|
||||
PodName NamespacedName
|
||||
PrevPod *v1.Pod
|
||||
CurPod *v1.Pod
|
||||
EventType PodEventType
|
||||
}
|
||||
|
||||
func (p PodName) String() string {
|
||||
return types.NamespacedName(p).String()
|
||||
}
|
||||
|
||||
type ClusterName types.NamespacedName
|
||||
|
||||
func (c ClusterName) String() string {
|
||||
return types.NamespacedName(c).String()
|
||||
}
|
||||
|
||||
type PgUser struct {
|
||||
Name string
|
||||
Password string
|
||||
Flags []string
|
||||
MemberOf string
|
||||
}
|
||||
|
||||
func (p NamespacedName) String() string {
|
||||
return types.NamespacedName(p).String()
|
||||
}
|
||||
|
||||
func (n *NamespacedName) Decode(value string) error {
|
||||
name := types.NewNamespacedNameFromString(value)
|
||||
if value != "" && name == (types.NamespacedName{}) {
|
||||
name.Name = value
|
||||
name.Namespace = v1.NamespaceDefault
|
||||
}
|
||||
|
||||
*n = NamespacedName(name)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user