From e655aeb1b5476301d20bbc1d9c3059d0b8c3e345 Mon Sep 17 00:00:00 2001 From: Andrey Taranik Date: Wed, 6 Sep 2023 14:51:50 +0300 Subject: [PATCH] add serviceAccountName field --- neonvm/apis/neonvm/v1/virtualmachine_types.go | 11 ++++++----- .../crd/bases/vm.neon.tech_virtualmachines.yaml | 2 ++ neonvm/controllers/virtualmachine_controller.go | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/neonvm/apis/neonvm/v1/virtualmachine_types.go b/neonvm/apis/neonvm/v1/virtualmachine_types.go index a3969d5c3..d5cf8b1b6 100644 --- a/neonvm/apis/neonvm/v1/virtualmachine_types.go +++ b/neonvm/apis/neonvm/v1/virtualmachine_types.go @@ -69,11 +69,12 @@ type VirtualMachineSpec struct { // +optional TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds"` - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - Affinity *corev1.Affinity `json:"affinity,omitempty"` - Tolerations []corev1.Toleration `json:"tolerations,omitempty"` - SchedulerName string `json:"schedulerName,omitempty"` - PodResources corev1.ResourceRequirements `json:"podResources,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + Affinity *corev1.Affinity `json:"affinity,omitempty"` + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + SchedulerName string `json:"schedulerName,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty"` + PodResources corev1.ResourceRequirements `json:"podResources,omitempty"` // +kubebuilder:default:=Always // +optional diff --git a/neonvm/config/common/crd/bases/vm.neon.tech_virtualmachines.yaml b/neonvm/config/common/crd/bases/vm.neon.tech_virtualmachines.yaml index 7a3f7d2a7..f8dc1e5f9 100644 --- a/neonvm/config/common/crd/bases/vm.neon.tech_virtualmachines.yaml +++ b/neonvm/config/common/crd/bases/vm.neon.tech_virtualmachines.yaml @@ -2516,6 +2516,8 @@ spec: type: string service_links: type: boolean + serviceAccountName: + type: string terminationGracePeriodSeconds: default: 5 format: int64 diff --git a/neonvm/controllers/virtualmachine_controller.go b/neonvm/controllers/virtualmachine_controller.go index bb819f7b1..fae0ccd60 100644 --- a/neonvm/controllers/virtualmachine_controller.go +++ b/neonvm/controllers/virtualmachine_controller.go @@ -1046,6 +1046,7 @@ func podSpec(virtualmachine *vmv1.VirtualMachine) (*corev1.Pod, error) { NodeSelector: virtualmachine.Spec.NodeSelector, ImagePullSecrets: virtualmachine.Spec.ImagePullSecrets, Tolerations: virtualmachine.Spec.Tolerations, + ServiceAccountName: virtualmachine.Spec.ServiceAccountName, SchedulerName: virtualmachine.Spec.SchedulerName, Affinity: affinity, InitContainers: []corev1.Container{