@@ -153,6 +153,7 @@ type VaultLdapAuth struct {
type VaultJwtAuth struct {
// Role is a JWT role to authenticate using the JWT/OIDC Vault
// authentication method
+ // +optional
Role string `json:"role"`
// SecretRef to a key in a Secret resource containing JWT token to
@@ -221,8 +221,6 @@ spec:
required:
- name
type: object
- required:
- - role
kubernetes:
description: Kubernetes authenticates with Vault by passing
@@ -1417,6 +1417,7 @@ string
</em>
</td>
<td>
+<em>(Optional)</em>
<p>Role is a JWT role to authenticate using the JWT/OIDC Vault
authentication method</p>
@@ -267,6 +267,16 @@ func (v *client) setAuth(ctx context.Context, client Client) error {
return nil
}
+ jwtAuth := v.store.Auth.Jwt
+ if jwtAuth != nil {
+ token, err := v.requestTokenWithJwtAuth(ctx, client, jwtAuth)
+ if err != nil {
+ return err
+ }
+ client.SetToken(token)
+ return nil
+
return errors.New(errAuthFormat)