From 3d0ab40d64b3b37e646f2e04053e844ac298a5c7 Mon Sep 17 00:00:00 2001 From: Sergey Dudoladov Date: Tue, 24 Apr 2018 15:30:15 +0200 Subject: [PATCH] Explicitly warn on account name mismatch --- pkg/controller/controller.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 2a9c26d8b..406a29429 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -131,8 +131,10 @@ func (c *Controller) initPodServiceAccount() { panic(fmt.Errorf("pod service account definiton in the operator config map defines another type of resource: %v", groupVersionKind.Kind)) default: c.PodServiceAccount = obj.(*v1.ServiceAccount) - // ensure consistent naming of the account - c.PodServiceAccount.Name = c.opConfig.PodServiceAccountName + if c.PodServiceAccount.Name != c.opConfig.PodServiceAccountName { + c.logger.Warnf("in the operator config map, the pod service account name %v does not match the name %v given in the account definition; using the former for consistency", c.opConfig.PodServiceAccountName, c.PodServiceAccount.Name) + c.PodServiceAccount.Name = c.opConfig.PodServiceAccountName + } } // actual service accounts are deployed at the time of Postgres/Spilo cluster creation