Create pg users

This commit is contained in:
Murat Kabilov
2017-05-12 11:37:09 +02:00
parent 7e4d0410c2
commit 58506634c4
9 changed files with 474 additions and 111 deletions
+11 -7
View File
@@ -3,17 +3,21 @@ package constants
import "time"
const (
TPRName = "postgresql"
TPRVendor = "acid.zalan.do"
TPRDescription = "Managed PostgreSQL clusters"
TPRReadyWaitInterval = 3 * time.Second
TPRReadyWaitTimeout = 30 * time.Second
TPRApiVersion = "v1"
TPRName = "postgresql"
TPRVendor = "acid.zalan.do"
TPRDescription = "Managed PostgreSQL clusters"
TPRReadyWaitInterval = 3 * time.Second
TPRReadyWaitTimeout = 30 * time.Second
TPRApiVersion = "v1"
ResourceCheckInterval = 3 * time.Second
ResourceCheckTimeout = 10 * time.Minute
ResourceName = TPRName + "s"
ResyncPeriod = 5 * time.Minute
EtcdHost = "etcd-client.default.svc.cluster.local:2379" //TODO: move to the operator spec
EtcdHost = "etcd-client.default.svc.cluster.local:2379" //TODO: move to the operator spec
SpiloImage = "registry.opensource.zalan.do/acid/spilo-9.6:1.2-p11"
PamRoleName = "zalandos"
PasswordLength = 64
)
+3 -3
View File
@@ -5,17 +5,17 @@ import (
"time"
)
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$^&*=")
var passwordChars = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
func init() {
rand.Seed(int64(time.Now().Unix()))
}
func RandomPasswordBytes(n int) []byte {
func RandomPassword(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = passwordChars[rand.Intn(len(passwordChars))]
}
return b
return string(b)
}