mirror of
https://github.com/wassname/ray.git
synced 2026-08-17 11:25:34 +08:00
Customize service account name. (#8901)
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
rayiov1alpha1 "ray-operator/api/v1alpha1"
|
||||
"strings"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultServiceAccountName = "default"
|
||||
)
|
||||
|
||||
type PodConfig struct {
|
||||
@@ -28,12 +33,16 @@ func BuildPod(conf *PodConfig) *corev1.Pod {
|
||||
// Build the containers for the pod (there is currently only one).
|
||||
containers := []corev1.Container{buildContainer(conf)}
|
||||
|
||||
serviceAccountName := defaultServiceAccountName
|
||||
if len(conf.Extension.ServiceAccountName) > 0 {
|
||||
serviceAccountName = conf.Extension.ServiceAccountName
|
||||
}
|
||||
spec := corev1.PodSpec{
|
||||
Volumes: conf.Extension.Volumes,
|
||||
Containers: containers,
|
||||
Affinity: conf.Extension.Affinity,
|
||||
Tolerations: conf.Extension.Tolerations,
|
||||
ServiceAccountName: conf.RayCluster.Namespace,
|
||||
ServiceAccountName: serviceAccountName,
|
||||
}
|
||||
|
||||
pod := &corev1.Pod{
|
||||
|
||||
Reference in New Issue
Block a user