Pod Rolling update

introduce Pod events channel;
add parsing of the MaintenanceWindows section;
skip deleting Etcd key on cluster delete;
use external etcd host;
watch for tpr/pods in the namespace of the operator pod only;
This commit is contained in:
Murat Kabilov
2017-05-12 11:41:25 +02:00
parent 2b8956bd33
commit ae77fa15e8
23 changed files with 1763 additions and 790 deletions
+18 -10
View File
@@ -1,11 +1,12 @@
package util
import (
"fmt"
"math/rand"
"time"
"github.bus.zalan.do/acid/postgres-operator/pkg/spec"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/types"
)
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
@@ -23,15 +24,22 @@ func RandomPassword(n int) string {
return string(b)
}
func FullObjectNameFromMeta(meta v1.ObjectMeta) string {
return FullObjectName(meta.Namespace, meta.Name)
}
//TODO: Remove in favour of FullObjectNameFromMeta
func FullObjectName(ns, name string) string {
if ns == "" {
ns = "default"
func NameFromMeta(meta v1.ObjectMeta) types.NamespacedName {
obj := types.NamespacedName{
Namespace: meta.Namespace,
Name: meta.Name,
}
return fmt.Sprintf("%s / %s", ns, name)
return obj
}
func PodClusterName(pod *v1.Pod) spec.ClusterName {
if name, ok := pod.Labels["spilo-cluster"]; ok {
return spec.ClusterName{
Namespace: pod.Namespace,
Name: name,
}
}
return spec.ClusterName{}
}