diff --git a/e2e/tests/test_e2e.py b/e2e/tests/test_e2e.py index 52aa0549a..874ac9c21 100644 --- a/e2e/tests/test_e2e.py +++ b/e2e/tests/test_e2e.py @@ -44,11 +44,8 @@ class EndToEndTestCase(unittest.TestCase): operator_deployment["spec"]["template"]["spec"]["containers"][0]["image"] = os.environ['OPERATOR_IMAGE'] yaml.dump(operator_deployment, f, Dumper=yaml.Dumper) - for filename in ["operator-service-account-rbac.yaml", - "configmap.yaml", - "postgres-operator.yaml"]: - k8s.create_with_kubectl("manifests/" + filename) - + k8s.create_with_kubectl("manifests/operatorconfiguration.crd.yaml") + k8s.apply_kustomization("manifests") k8s.wait_for_operator_pod_start() actual_operator_image = k8s.api.core_v1.list_namespaced_pod( @@ -182,12 +179,15 @@ class EndToEndTestCase(unittest.TestCase): # update the cluster-wide image of the logical backup pod image = "test-image-name" - config_map_patch = { - "data": { - "logical_backup_docker_image": image, + config_patch = { + "configuration": { + "logical_backup": { + "logical_backup_docker_image": image, + } } } - k8s.api.core_v1.patch_namespaced_config_map("postgres-operator", "default", config_map_patch) + k8s.api.custom_objects_api.patch_namespaced_custom_object( + "acid.zalan.do", "v1", "default", "operatorconfigurations", "postgresql-operator-default-configuration", config_patch) operator_pod = k8s.api.core_v1.list_namespaced_pod( 'default', label_selector="name=postgres-operator").items[0].metadata.name @@ -319,6 +319,9 @@ class K8s: def wait_for_logical_backup_job_creation(self): self.wait_for_logical_backup_job(expected_num_of_jobs=1) + def apply_kustomization(self, path): + subprocess.run(["kubectl", "apply", "-k", path]) + def create_with_kubectl(self, path): subprocess.run(["kubectl", "create", "-f", path]) diff --git a/go.sum b/go.sum index e7a0a15e3..897070420 100644 --- a/go.sum +++ b/go.sum @@ -160,6 +160,7 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= @@ -265,6 +266,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -474,6 +476,10 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +sigs.k8s.io/kind v0.5.1 h1:BYnHEJ9DC+0Yjlyyehqd3xnKtEmFdLKU8QxqOqvQzdw= +sigs.k8s.io/kind v0.5.1/go.mod h1:L+Kcoo83/D1+ryU5P2VFbvYm0oqbkJn9zTZq0KNxW68= +sigs.k8s.io/kustomize/v3 v3.1.1-0.20190821175718-4b67a6de1296 h1:iQaIG5Dq+3qSiaFrJ/l/0MjjxKmdwyVNpKRYJwUe/+0= +sigs.k8s.io/kustomize/v3 v3.1.1-0.20190821175718-4b67a6de1296/go.mod h1:ztX4zYc/QIww3gSripwF7TBOarBTm5BvyAMem0kCzOE= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= diff --git a/manifests/kustomization.yaml b/manifests/kustomization.yaml index a39627956..1fa4e3143 100644 --- a/manifests/kustomization.yaml +++ b/manifests/kustomization.yaml @@ -1,6 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- configmap.yaml +- postgresql-operator-default-configuration.yaml - operator-service-account-rbac.yaml - postgres-operator.yaml diff --git a/manifests/postgres-operator.yaml b/manifests/postgres-operator.yaml index 7b74b80a0..77eb6ee1c 100644 --- a/manifests/postgres-operator.yaml +++ b/manifests/postgres-operator.yaml @@ -30,8 +30,8 @@ spec: readOnlyRootFilesystem: true env: # provided additional ENV vars can overwrite individual config map entries - - name: CONFIG_MAP_NAME - value: "postgres-operator" - # In order to use the CRD OperatorConfiguration instead, uncomment these lines and comment out the two lines above - # - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT - # value: postgresql-operator-default-configuration + - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT + value: postgresql-operator-default-configuration + # In order to use the ConfigMap instead, uncomment these lines and comment out the two lines above + #- name: CONFIG_MAP_NAME + # value: "postgres-operator" diff --git a/manifests/postgresql-operator-default-configuration.yaml b/manifests/postgresql-operator-default-configuration.yaml index 7a867d5df..eeb3a3cd5 100644 --- a/manifests/postgresql-operator-default-configuration.yaml +++ b/manifests/postgresql-operator-default-configuration.yaml @@ -21,7 +21,7 @@ configuration: kubernetes: cluster_domain: cluster.local cluster_labels: - application: spilo + application: spilo cluster_name_label: cluster-name # custom_pod_annotations: # keya: valuea @@ -42,11 +42,12 @@ configuration: pod_role_label: spilo-role pod_service_account_name: zalando-postgres-operator pod_terminate_grace_period: 5m - secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}" + secret_name_template: "{username}.{cluster}.credentials" # spilo_fsgroup: 103 spilo_privileged: false - # toleration: {} - # watched_namespace: "" + # toleration: + # postgres: "key:postgres,operator:Exists,effect:NoSchedule" + watched_namespace: "*" postgres_pod_resources: default_cpu_limit: "3" default_cpu_request: 100m @@ -60,14 +61,14 @@ configuration: resource_check_interval: 3s resource_check_timeout: 10m load_balancer: - # db_hosted_zone: "" - enable_master_load_balancer: false + db_hosted_zone: db.example.com + enable_master_load_balancer: true enable_replica_load_balancer: false # custom_service_annotations: # keyx: valuex # keyy: valuey - master_dns_name_format: "{cluster}.{team}.{hostedzone}" - replica_dns_name_format: "{cluster}-repl.{team}.{hostedzone}" + master_dns_name_format: "{cluster}.{team}.staging.{hostedzone}" + replica_dns_name_format: "{cluster}-repl.{team}.staging.{hostedzone}" aws_or_gcp: # additional_secret_mount: "some-secret-name" # additional_secret_mount_path: "/some/dir"