From b763710573f1b048df7de51e4e38fc1189648bc6 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 19 Mar 2020 09:59:24 +0100 Subject: [PATCH] update docs and comments --- docs/administrator.md | 11 ++++++----- pkg/cluster/k8sres.go | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/administrator.md b/docs/administrator.md index d8313e2e9..93adf2eb1 100644 --- a/docs/administrator.md +++ b/docs/administrator.md @@ -321,11 +321,12 @@ spec: ## Custom Pod Environment Variables It is possible to configure a ConfigMap which is used by the Postgres pods as -an additional provider for environment variables. - -One use case is to customize the Spilo image and configure it with environment -variables. The ConfigMap with the additional settings is configured in the -operator's main ConfigMap: +an additional provider for environment variables. One use case is to customize +the Spilo image and configure it with environment variables. The ConfigMap with +the additional settings is referenced in the operator's main configuration. +A namespace can be specified along with the name. If left out, the configured +default namespace of your K8s client will be used and if the ConfigMap is not +found there, the Postgres cluster's namespace is taken when different: **postgres-operator ConfigMap** diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index 7ffce6b1b..43b5b3636 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -852,7 +852,7 @@ func (c *Cluster) generateStatefulSet(pgSpec *acidv1.PostgresSpec) (*appsv1.Stat var cm *v1.ConfigMap cm, err = c.KubeClient.ConfigMaps(c.OpConfig.PodEnvironmentConfigMap.Namespace).Get(c.OpConfig.PodEnvironmentConfigMap.Name, metav1.GetOptions{}) if err != nil { - // if not found, try again using the operator namespace (old behavior) + // if not found, try again using the cluster's namespace if it's different (old behavior) if k8sutil.ResourceNotFound(err) && c.Namespace != c.OpConfig.PodEnvironmentConfigMap.Namespace { cm, err = c.KubeClient.ConfigMaps(c.Namespace).Get(c.OpConfig.PodEnvironmentConfigMap.Name, metav1.GetOptions{}) }