kubernetes driver: add serviceaccount opt

Signed-off-by: robertlestak <robert.lestak@umusic.com>
pull/1597/head
robertlestak 2 years ago committed by Justin Chadwell
parent 75ed3e296b
commit 65037e4611

@ -145,6 +145,8 @@ func (f *factory) processDriverOpts(deploymentName string, namespace string, cfg
if _, isImage := cfg.DriverOpts["image"]; !isImage { if _, isImage := cfg.DriverOpts["image"]; !isImage {
deploymentOpt.Image = bkimage.DefaultRootlessImage deploymentOpt.Image = bkimage.DefaultRootlessImage
} }
case "serviceaccount":
deploymentOpt.ServiceAccountName = v
case "nodeselector": case "nodeselector":
kvs := strings.Split(strings.Trim(v, `"`), ",") kvs := strings.Split(strings.Trim(v, `"`), ",")
s := map[string]string{} s := map[string]string{}

@ -14,10 +14,11 @@ import (
) )
type DeploymentOpt struct { type DeploymentOpt struct {
Namespace string Namespace string
Name string Name string
Image string Image string
Replicas int Replicas int
ServiceAccountName string
// Qemu // Qemu
Qemu struct { Qemu struct {
@ -80,6 +81,7 @@ func NewDeployment(opt *DeploymentOpt) (d *appsv1.Deployment, c []*corev1.Config
Annotations: annotations, Annotations: annotations,
}, },
Spec: corev1.PodSpec{ Spec: corev1.PodSpec{
ServiceAccountName: opt.ServiceAccountName,
Containers: []corev1.Container{ Containers: []corev1.Container{
{ {
Name: containerName, Name: containerName,

Loading…
Cancel
Save