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/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/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** 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 diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index 66759ff16..4074c61c6 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",