From 372338138dc48c17e4a33d3e7279ba418c30b03d Mon Sep 17 00:00:00 2001 From: Oleg Sucharevich Date: Tue, 15 Jan 2019 16:38:16 +0200 Subject: [PATCH] throw an error if the serviceaccount has not link to secret --- VERSION | 2 +- pkg/kubernetes/kubernetes.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6261a05..d5e98f7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.3.2 \ No newline at end of file diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index 86cb593..add486a 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -81,6 +81,11 @@ func goOverContext(options *getOverContextOptions) error { options.logger.Warn(message) return fmt.Errorf(message) } + if len(sa.Secrets) == 0 { + message := fmt.Sprintf("Service account has no secrect configured for serviceaccount: %s", options.serviceaccount) + options.logger.Warn(message) + return fmt.Errorf(message) + } secretName := string(sa.Secrets[0].Name) namespace := sa.Namespace options.logger.WithFields(log.Fields{