Some tweaks to ensure compat with newer Go. (#383)
This commit is contained in:
parent
f9cbed9be9
commit
688d252752
|
|
@ -129,13 +129,8 @@ var unmarshalCluster = []struct {
|
||||||
Name: "acid-testcluster1",
|
Name: "acid-testcluster1",
|
||||||
},
|
},
|
||||||
Status: ClusterStatusInvalid,
|
Status: ClusterStatusInvalid,
|
||||||
Error: (&json.UnmarshalTypeError{
|
// This error message can vary between Go versions, so compute it for the current version.
|
||||||
Value: "number",
|
Error: json.Unmarshal([]byte(`{"teamId": 0}`), &PostgresSpec{}).Error(),
|
||||||
Type: reflect.TypeOf(""),
|
|
||||||
Offset: 126,
|
|
||||||
Struct: "PostgresSpec",
|
|
||||||
Field: "teamId",
|
|
||||||
}).Error(),
|
|
||||||
},
|
},
|
||||||
[]byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"","parameters":null},"volume":{"size":"","storageClass":""},"patroni":{"initdb":null,"pg_hba":null,"ttl":0,"loop_wait":0,"retry_timeout":0,"maximum_lag_on_failover":0},"resources":{"requests":{"cpu":"","memory":""},"limits":{"cpu":"","memory":""}},"teamId":"","allowedSourceRanges":null,"numberOfInstances":0,"users":null,"clone":{}},"status":"Invalid"}`), nil},
|
[]byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"","parameters":null},"volume":{"size":"","storageClass":""},"patroni":{"initdb":null,"pg_hba":null,"ttl":0,"loop_wait":0,"retry_timeout":0,"maximum_lag_on_failover":0},"resources":{"requests":{"cpu":"","memory":""},"limits":{"cpu":"","memory":""}},"teamId":"","allowedSourceRanges":null,"numberOfInstances":0,"users":null,"clone":{}},"status":"Invalid"}`), nil},
|
||||||
{[]byte(`{
|
{[]byte(`{
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ func TestInitHumanUsersWithSuperuserTeams(t *testing.T) {
|
||||||
ownerTeam: "postgres_superusers",
|
ownerTeam: "postgres_superusers",
|
||||||
existingRoles: map[string]spec.PgUser{
|
existingRoles: map[string]spec.PgUser{
|
||||||
// role with the name exists before w/o superuser privilege
|
// role with the name exists before w/o superuser privilege
|
||||||
"postgres_superuser": spec.PgUser{
|
"postgres_superuser": {
|
||||||
Origin: spec.RoleOriginTeamsAPI,
|
Origin: spec.RoleOriginTeamsAPI,
|
||||||
Name: "postgres_superuser",
|
Name: "postgres_superuser",
|
||||||
Password: "",
|
Password: "",
|
||||||
|
|
|
||||||
|
|
@ -139,10 +139,10 @@ func (c *Controller) initPodServiceAccount() {
|
||||||
|
|
||||||
if c.opConfig.PodServiceAccountDefinition == "" {
|
if c.opConfig.PodServiceAccountDefinition == "" {
|
||||||
c.opConfig.PodServiceAccountDefinition = `
|
c.opConfig.PodServiceAccountDefinition = `
|
||||||
{ "apiVersion": "v1",
|
{ "apiVersion": "v1",
|
||||||
"kind": "ServiceAccount",
|
"kind": "ServiceAccount",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "operator"
|
"name": "operator"
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
|
@ -175,10 +175,10 @@ func (c *Controller) initRoleBinding() {
|
||||||
// we assume the role is created by the k8s administrator
|
// we assume the role is created by the k8s administrator
|
||||||
if c.opConfig.PodServiceAccountRoleBindingDefinition == "" {
|
if c.opConfig.PodServiceAccountRoleBindingDefinition == "" {
|
||||||
c.opConfig.PodServiceAccountRoleBindingDefinition = `
|
c.opConfig.PodServiceAccountRoleBindingDefinition = `
|
||||||
{
|
{
|
||||||
"apiVersion": "rbac.authorization.k8s.io/v1beta1",
|
"apiVersion": "rbac.authorization.k8s.io/v1beta1",
|
||||||
"kind": "RoleBinding",
|
"kind": "RoleBinding",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "zalando-postgres-operator"
|
"name": "zalando-postgres-operator"
|
||||||
},
|
},
|
||||||
"roleRef": {
|
"roleRef": {
|
||||||
|
|
@ -191,7 +191,7 @@ func (c *Controller) initRoleBinding() {
|
||||||
"kind": "ServiceAccount",
|
"kind": "ServiceAccount",
|
||||||
"name": "operator"
|
"name": "operator"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
c.logger.Info("Parse role bindings")
|
c.logger.Info("Parse role bindings")
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func (c *Controller) clusterListAndSync() error {
|
||||||
}
|
}
|
||||||
c.queueEvents(list, event)
|
c.queueEvents(list, event)
|
||||||
} else {
|
} else {
|
||||||
c.logger.Infof("not enough time passed since the last sync (%s seconds) or repair (%s seconds)",
|
c.logger.Infof("not enough time passed since the last sync (%v seconds) or repair (%v seconds)",
|
||||||
timeFromPreviousSync, timeFromPreviousRepair)
|
timeFromPreviousSync, timeFromPreviousRepair)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue