Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Custom Service Account for vault pods #324

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/apis/vault/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type VaultServiceSpec struct {

// TLS policy of vault nodes
TLS *TLSPolicy `json:"TLS,omitempty"`

// Service Account
// Default: default
ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

// PodPolicy defines the policy for pods owned by vault operator.
Expand Down Expand Up @@ -104,6 +108,10 @@ func (v *VaultService) SetDefaults() bool {
}}
changed = true
}
if len(vs.ServiceAccountName) == 0{
vs.ServiceAccountName = "default"
changed = true
}
return changed
}

Expand Down
1 change: 1 addition & 0 deletions pkg/util/k8sutil/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func DeployVault(kubecli kubernetes.Interface, v *api.VaultService) error {
Labels: selector,
},
Spec: v1.PodSpec{
ServiceAccountName: v.Spec.ServiceAccountName,
Containers: []v1.Container{vaultContainer(v), statsdExporterContainer()},
Volumes: []v1.Volume{{
Name: vaultConfigVolName,
Expand Down