From 8ec3fa1ec80b92706a23cc7e5a8bce64dfef24ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Rom=C3=A1n?= <39826173+jakub-roman@users.noreply.github.com> Date: Mon, 15 Jul 2019 17:17:42 +0200 Subject: [PATCH 1/3] Kustomization (#608) Add ability to install the operator via kustomization. --- docs/quickstart.md | 10 +++++++--- manifests/kustomization.yaml | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 manifests/kustomization.yaml diff --git a/docs/quickstart.md b/docs/quickstart.md index d665d1815..965e96a36 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -54,9 +54,13 @@ kubectl create -f manifests/operator-service-account-rbac.yaml # identity and p kubectl create -f manifests/postgres-operator.yaml # deployment ``` -When using kubectl 1.14 or newer the mentioned manifests could be also be -bundled in one [Kustomization](https://github.com/kubernetes-sigs/kustomize) -manifest. +There is a [Kustomization](https://github.com/kubernetes-sigs/kustomize) +manifest that [combines the mentioned resources](../manifests/kustomization.yaml) - +it can be used with kubectl 1.14 or newer as easy as: + +```bash +kubectl apply -k github.com/zalando/postgres-operator/manifests +``` For convenience, we have automated starting the operator with minikube using the `run_operator_locally` script. It applies the [`acid-minimal-cluster`](../manifests/minimal-postgres-manifest). diff --git a/manifests/kustomization.yaml b/manifests/kustomization.yaml new file mode 100644 index 000000000..a39627956 --- /dev/null +++ b/manifests/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- configmap.yaml +- operator-service-account-rbac.yaml +- postgres-operator.yaml From 53fea88391d0691d41627787efda364026185fe1 Mon Sep 17 00:00:00 2001 From: Dmitry Dolgov <9erthalion6@gmail.com> Date: Wed, 17 Jul 2019 13:04:54 +0200 Subject: [PATCH 2/3] Update link for pod_antiaffinity_topology_key (#622) Looks like the anchor was changed in the K8S docs. --- docs/reference/operator_parameters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 3faebb832..f3fe96b6b 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -277,7 +277,7 @@ configuration they are grouped under the `kubernetes` key. the same topology , e.g. node. The default is `false`. * **pod_antiaffinity_topology_key** - override [topology key](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels) + override [topology key](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#built-in-node-labels) for pod anti affinity. The default is `kubernetes.io/hostname`. * **pod_management_policy** From 2c3c7fd244e028bad0bbac0e1cb46bd0ba72a0fb Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 18 Jul 2019 14:00:30 +0200 Subject: [PATCH 3/3] query namespaced K8s API in logical backup script (#623) --- docker/logical-backup/dump.sh | 6 +++--- pkg/cluster/k8sres.go | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docker/logical-backup/dump.sh b/docker/logical-backup/dump.sh index fea3161e5..dcbd7d334 100755 --- a/docker/logical-backup/dump.sh +++ b/docker/logical-backup/dump.sh @@ -48,14 +48,14 @@ function aws_upload { function get_pods { declare -r SELECTOR="$1" - curl "${K8S_API_URL}/pods?$SELECTOR" \ + curl "${K8S_API_URL}/namespaces/${POD_NAMESPACE}/pods?$SELECTOR" \ --cacert $CERT \ -H "Authorization: Bearer ${TOKEN}" | jq .items[].status.podIP -r } function get_current_pod { - curl "${K8S_API_URL}/pods?fieldSelector=metadata.name%3D${HOSTNAME}" \ - --cacert $CERT \ + curl "${K8S_API_URL}/namespaces/${POD_NAMESPACE}/pods?fieldSelector=metadata.name%3D${HOSTNAME}" \ + --cacert $CERT \ -H "Authorization: Bearer ${TOKEN}" } diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index 54b123a18..b1342ce4b 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1528,6 +1528,15 @@ func (c *Cluster) generateLogicalBackupPodEnvVars() []v1.EnvVar { Name: "SCOPE", Value: c.Name, }, + { + Name: "POD_NAMESPACE", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + APIVersion: "v1", + FieldPath: "metadata.namespace", + }, + }, + }, // Bucket env vars { Name: "LOGICAL_BACKUP_S3_BUCKET",