Move service account to Controller

This commit is contained in:
Sergey Dudoladov
2018-04-24 15:13:08 +02:00
parent c31c76281c
commit 485ec4b8ea
4 changed files with 15 additions and 11 deletions
+4 -2
View File
@@ -51,6 +51,8 @@ type Controller struct {
lastClusterSyncTime int64
workerLogs map[uint32]ringlog.RingLogger
PodServiceAccount *v1.ServiceAccount
}
// NewController creates a new controller
@@ -128,9 +130,9 @@ func (c *Controller) initPodServiceAccount() {
case groupVersionKind.Kind != "ServiceAccount":
panic(fmt.Errorf("pod service account definiton in the operator config map defines another type of resource: %v", groupVersionKind.Kind))
default:
c.opConfig.PodServiceAccount = *obj.(*v1.ServiceAccount)
c.PodServiceAccount = obj.(*v1.ServiceAccount)
// ensure consistent naming of the account
c.opConfig.PodServiceAccount.Name = c.opConfig.PodServiceAccountName
c.PodServiceAccount.Name = c.opConfig.PodServiceAccountName
}
// actual service accounts are deployed at the time of Postgres/Spilo cluster creation
+1
View File
@@ -26,6 +26,7 @@ func (c *Controller) makeClusterConfig() cluster.Config {
RestConfig: c.config.RestConfig,
OpConfig: config.Copy(c.opConfig),
InfrastructureRoles: infrastructureRoles,
PodServiceAccount: c.PodServiceAccount,
}
}