Browse Source

fixing panic if using JWT with KubernetesServiceAccountToken

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Gustavo Carvalho 4 years ago
parent
commit
a01a23bfc1
1 changed files with 4 additions and 1 deletions
  1. 4 1
      pkg/provider/vault/vault.go

+ 4 - 1
pkg/provider/vault/vault.go

@@ -605,7 +605,10 @@ func (v *client) Validate() (esv1beta1.ValidationResult, error) {
 		if v.store.Auth.Ldap != nil && v.store.Auth.Ldap.SecretRef.Namespace == nil {
 			return esv1beta1.ValidationResultUnknown, nil
 		}
-		if v.store.Auth.Jwt != nil && v.store.Auth.Jwt.SecretRef.Namespace == nil {
+		if v.store.Auth.Jwt != nil && v.store.Auth.Jwt.SecretRef != nil && v.store.Auth.Jwt.SecretRef.Namespace == nil {
+			return esv1beta1.ValidationResultUnknown, nil
+		}
+		if v.store.Auth.Jwt != nil && v.store.Auth.Jwt.KubernetesServiceAccountToken != nil && v.store.Auth.Jwt.KubernetesServiceAccountToken.ServiceAccountRef.Namespace == nil {
 			return esv1beta1.ValidationResultUnknown, nil
 		}
 		if v.store.Auth.Cert != nil && v.store.Auth.Cert.SecretRef.Namespace == nil {