From 0b75a899208a459b912b71c42c1493149d0efda2 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Thu, 6 Sep 2018 01:26:48 -0700 Subject: [PATCH 1/3] Fix the casing of github.com/Sirupsen/logrus to match what the project itself uses. (#380) Dep enforces this. --- glide.lock | 2 +- glide.yaml | 2 +- pkg/apiserver/apiserver.go | 2 +- pkg/cluster/cluster.go | 2 +- pkg/cluster/cluster_test.go | 2 +- pkg/cluster/k8sres.go | 2 +- pkg/controller/controller.go | 2 +- pkg/controller/logs_and_api.go | 2 +- pkg/controller/postgresql.go | 2 +- pkg/spec/types.go | 2 +- pkg/util/patroni/patroni.go | 2 +- pkg/util/teams/teams.go | 2 +- pkg/util/teams/teams_test.go | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/glide.lock b/glide.lock index 19cb6c41f..acedb47f5 100644 --- a/glide.lock +++ b/glide.lock @@ -100,7 +100,7 @@ imports: version: b2aad2c9a95d14eb978f29baa6e3a5c3c20eef30 - name: github.com/peterbourgon/diskv version: 5f041e8faa004a95c88a202771f4cc3e991971e6 -- name: github.com/Sirupsen/logrus +- name: github.com/sirupsen/logrus version: 3e01752db0189b9157070a0e1668a620f9a85da2 - name: github.com/spf13/pflag version: 583c0c0531f06d5278b7d917446061adc344b5cd diff --git a/glide.yaml b/glide.yaml index 74e837877..41d8dee29 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,6 +1,6 @@ package: github.com/zalando-incubator/postgres-operator import: -- package: github.com/Sirupsen/logrus +- package: github.com/sirupsen/logrus version: ^1.0.1 - package: github.com/aws/aws-sdk-go version: ^1.8.24 diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 54c870287..7f7a69dd9 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -11,7 +11,7 @@ import ( "sync" "time" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "github.com/zalando-incubator/postgres-operator/pkg/cluster" "github.com/zalando-incubator/postgres-operator/pkg/spec" diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 7e73bd97c..648165b9a 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "k8s.io/api/apps/v1beta1" "k8s.io/api/core/v1" policybeta1 "k8s.io/api/policy/v1beta1" diff --git a/pkg/cluster/cluster_test.go b/pkg/cluster/cluster_test.go index c89874e99..4cae3656c 100644 --- a/pkg/cluster/cluster_test.go +++ b/pkg/cluster/cluster_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" acidv1 "github.com/zalando-incubator/postgres-operator/pkg/apis/acid.zalan.do/v1" "github.com/zalando-incubator/postgres-operator/pkg/spec" "github.com/zalando-incubator/postgres-operator/pkg/util/config" diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index c2049ff29..195d1c76d 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -5,7 +5,7 @@ import ( "fmt" "sort" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "k8s.io/api/apps/v1beta1" "k8s.io/api/core/v1" diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index f99d836b8..b3caa747b 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -5,7 +5,7 @@ import ( "os" "sync" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "k8s.io/api/core/v1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/controller/logs_and_api.go b/pkg/controller/logs_and_api.go index 7a6619203..3e5f20759 100644 --- a/pkg/controller/logs_and_api.go +++ b/pkg/controller/logs_and_api.go @@ -5,7 +5,7 @@ import ( "sort" "sync/atomic" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "github.com/zalando-incubator/postgres-operator/pkg/cluster" "github.com/zalando-incubator/postgres-operator/pkg/spec" diff --git a/pkg/controller/postgresql.go b/pkg/controller/postgresql.go index 379cec842..12f8c20ad 100644 --- a/pkg/controller/postgresql.go +++ b/pkg/controller/postgresql.go @@ -8,7 +8,7 @@ import ( "sync/atomic" "time" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/pkg/spec/types.go b/pkg/spec/types.go index 1607dbd9b..e394462d4 100644 --- a/pkg/spec/types.go +++ b/pkg/spec/types.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" ) diff --git a/pkg/util/patroni/patroni.go b/pkg/util/patroni/patroni.go index a16fd2dfb..23260f277 100644 --- a/pkg/util/patroni/patroni.go +++ b/pkg/util/patroni/patroni.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" "k8s.io/api/core/v1" ) diff --git a/pkg/util/teams/teams.go b/pkg/util/teams/teams.go index 2223d2063..8afcd1a3b 100644 --- a/pkg/util/teams/teams.go +++ b/pkg/util/teams/teams.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" ) // InfrastructureAccount defines an account of the team on some infrastructure (i.e AWS, Google) platform. diff --git a/pkg/util/teams/teams_test.go b/pkg/util/teams/teams_test.go index fd0de591b..637c4e16c 100644 --- a/pkg/util/teams/teams_test.go +++ b/pkg/util/teams/teams_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" ) var ( From f9cbed9be981486f2f48bee19e054c2c548d1b02 Mon Sep 17 00:00:00 2001 From: zerg-junior Date: Mon, 17 Sep 2018 10:12:58 +0200 Subject: [PATCH 2/3] Clarify what a default values is (#368) Clarify what a default values is --- docs/reference/operator_parameters.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 7d8e243bb..b05ab4fd3 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -45,6 +45,8 @@ They will be deprecated and removed in the future. Variable names are underscore-separated words. + + ## General Those are top-level keys, containing both leaf keys and groups. @@ -420,3 +422,5 @@ scalyr sidecar. In the CRD-based configuration they are grouped under the * **scalyr_memory_limit** Memory limit value for the Scalyr sidecar. The default is `1Gi`. + +For the configmap operator configuration, the [default parameter values](https://github.com/zalando-incubator/postgres-operator/blob/master/pkg/util/config/config.go#L14) mentioned here are likely to be overwritten in your local operator installation via your local version of the operator configmap. In the case you use the operator CRD, all the CRD defaults are provided in the [operator's default configuration manifest](https://github.com/zalando-incubator/postgres-operator/blob/master/manifests/postgresql-operator-default-configuration.yaml) \ No newline at end of file From 688d252752e8d1240cf8f1fbb23c1ff4fc52ea28 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Mon, 17 Sep 2018 01:13:07 -0700 Subject: [PATCH 3/3] Some tweaks to ensure compat with newer Go. (#383) --- pkg/apis/acid.zalan.do/v1/util_test.go | 9 ++------- pkg/cluster/cluster_test.go | 2 +- pkg/controller/controller.go | 16 ++++++++-------- pkg/controller/postgresql.go | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/pkg/apis/acid.zalan.do/v1/util_test.go b/pkg/apis/acid.zalan.do/v1/util_test.go index ab5a39e9e..fae6ea1cf 100644 --- a/pkg/apis/acid.zalan.do/v1/util_test.go +++ b/pkg/apis/acid.zalan.do/v1/util_test.go @@ -129,13 +129,8 @@ var unmarshalCluster = []struct { Name: "acid-testcluster1", }, Status: ClusterStatusInvalid, - Error: (&json.UnmarshalTypeError{ - Value: "number", - Type: reflect.TypeOf(""), - Offset: 126, - Struct: "PostgresSpec", - Field: "teamId", - }).Error(), + // This error message can vary between Go versions, so compute it for the current version. + Error: json.Unmarshal([]byte(`{"teamId": 0}`), &PostgresSpec{}).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(`{ diff --git a/pkg/cluster/cluster_test.go b/pkg/cluster/cluster_test.go index 4cae3656c..acf17ace6 100644 --- a/pkg/cluster/cluster_test.go +++ b/pkg/cluster/cluster_test.go @@ -256,7 +256,7 @@ func TestInitHumanUsersWithSuperuserTeams(t *testing.T) { ownerTeam: "postgres_superusers", existingRoles: map[string]spec.PgUser{ // role with the name exists before w/o superuser privilege - "postgres_superuser": spec.PgUser{ + "postgres_superuser": { Origin: spec.RoleOriginTeamsAPI, Name: "postgres_superuser", Password: "", diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index b3caa747b..1bc4e08e0 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -139,10 +139,10 @@ func (c *Controller) initPodServiceAccount() { if c.opConfig.PodServiceAccountDefinition == "" { c.opConfig.PodServiceAccountDefinition = ` - { "apiVersion": "v1", - "kind": "ServiceAccount", - "metadata": { - "name": "operator" + { "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "name": "operator" } }` } @@ -175,10 +175,10 @@ func (c *Controller) initRoleBinding() { // we assume the role is created by the k8s administrator if c.opConfig.PodServiceAccountRoleBindingDefinition == "" { c.opConfig.PodServiceAccountRoleBindingDefinition = ` - { + { "apiVersion": "rbac.authorization.k8s.io/v1beta1", - "kind": "RoleBinding", - "metadata": { + "kind": "RoleBinding", + "metadata": { "name": "zalando-postgres-operator" }, "roleRef": { @@ -191,7 +191,7 @@ func (c *Controller) initRoleBinding() { "kind": "ServiceAccount", "name": "operator" } - ] + ] }` } c.logger.Info("Parse role bindings") diff --git a/pkg/controller/postgresql.go b/pkg/controller/postgresql.go index 12f8c20ad..e67b47193 100644 --- a/pkg/controller/postgresql.go +++ b/pkg/controller/postgresql.go @@ -71,7 +71,7 @@ func (c *Controller) clusterListAndSync() error { } c.queueEvents(list, event) } 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) } return nil