Explorar el Código

fixing panic if using JWT with KubernetesServiceAccountToken

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Gustavo Carvalho hace 4 años
padre
commit
a01a23bfc1
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  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 {