Explicitly warn on account name mismatch

This commit is contained in:
Sergey Dudoladov 2018-04-24 15:30:15 +02:00
parent 485ec4b8ea
commit 3d0ab40d64
1 changed files with 4 additions and 2 deletions

View File

@ -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