Skip to content

Commit

Permalink
kubernetes driver: add serviceaccount opt
Browse files Browse the repository at this point in the history
Signed-off-by: robertlestak <robert.lestak@umusic.com>
  • Loading branch information
robertlestak authored and jedevc committed Apr 26, 2023
1 parent 75ed3e2 commit 65037e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions driver/kubernetes/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (f *factory) processDriverOpts(deploymentName string, namespace string, cfg
if _, isImage := cfg.DriverOpts["image"]; !isImage {
deploymentOpt.Image = bkimage.DefaultRootlessImage
}
case "serviceaccount":
deploymentOpt.ServiceAccountName = v
case "nodeselector":
kvs := strings.Split(strings.Trim(v, `"`), ",")
s := map[string]string{}
Expand Down
10 changes: 6 additions & 4 deletions driver/kubernetes/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import (
)

type DeploymentOpt struct {
Namespace string
Name string
Image string
Replicas int
Namespace string
Name string
Image string
Replicas int
ServiceAccountName string

// Qemu
Qemu struct {
Expand Down Expand Up @@ -80,6 +81,7 @@ func NewDeployment(opt *DeploymentOpt) (d *appsv1.Deployment, c []*corev1.Config
Annotations: annotations,
},
Spec: corev1.PodSpec{
ServiceAccountName: opt.ServiceAccountName,
Containers: []corev1.Container{
{
Name: containerName,
Expand Down

0 comments on commit 65037e4

Please sign in to comment.