From 155ae8d50ff791998bc397812f7d56e504e1fcd7 Mon Sep 17 00:00:00 2001 From: Sergey Dudoladov Date: Thu, 15 Feb 2018 11:14:13 +0100 Subject: [PATCH] Rename the function that checks service account existence --- pkg/controller/controller.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index b697ce42c..2abc4a6c6 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -131,9 +131,9 @@ func (c *Controller) initController() { c.logger.Infof("config: %s", c.opConfig.MustMarshal()) - c.mustHaveOperatorServiceAccountInNamespace(c.config.Namespace) + c.checkOperatorServiceAccount(c.config.Namespace) if c.config.Namespace != c.opConfig.WatchedNamespace { - c.mustHaveOperatorServiceAccountInNamespace(c.opConfig.WatchedNamespace) + c.checkOperatorServiceAccount(c.opConfig.WatchedNamespace) } if c.opConfig.DebugLogging { @@ -262,9 +262,10 @@ func (c *Controller) kubeNodesInformer(stopCh <-chan struct{}, wg *sync.WaitGrou c.nodesInformer.Run(stopCh) } -func (c *Controller) mustHaveOperatorServiceAccountInNamespace(namespace string) { +// Check that a namespace has the service account that the operator needs +func (c *Controller) checkOperatorServiceAccount(namespace string) { _, err := c.KubeClient.ServiceAccounts(namespace).Get(c.opConfig.ServiceAccountName, metav1.GetOptions{}) if err != nil { - c.logger.Warnf("Cannot find the '%v' service account in the namepsace %q. Pods will not be able to start. Error: %v", c.opConfig.ServiceAccountName, namespace, err) + c.logger.Warnf("Cannot find the '%v' service account needed for operator in the namespace %q. Pods will not be able to start. Error: %v", c.opConfig.ServiceAccountName, namespace, err) } }