1 package v1 2 3 // This code is copied from 4 // https://github.com/kubevirt/controller-lifecycle-operator-sdk/blob/master/pkg/sdk/api/types.go 5 // in order to avoid dependency loops 6 7 import ( 8 corev1 "k8s.io/api/core/v1" 9 ) 10 11 // NodePlacement describes node scheduling configuration. 12 type NodePlacement struct { 13 // nodeSelector is the node selector applied to the relevant kind of pods 14 // It specifies a map of key-value pairs: for the pod to be eligible to run on a node, 15 // the node must have each of the indicated key-value pairs as labels 16 // (it can have additional labels as well). 17 // See https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector 18 // +kubebuilder:validation:Optional 19 // +optional 20 NodeSelector map[string]string `json:"nodeSelector,omitempty"` 21 22 // affinity enables pod affinity/anti-affinity placement expanding the types of constraints 23 // that can be expressed with nodeSelector. 24 // affinity is going to be applied to the relevant kind of pods in parallel with nodeSelector 25 // See https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity 26 // +kubebuilder:validation:Optional 27 // +optional 28 Affinity *corev1.Affinity `json:"affinity,omitempty"` 29 30 // tolerations is a list of tolerations applied to the relevant kind of pods 31 // See https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ for more info. 32 // These are additional tolerations other than default ones. 33 // +kubebuilder:validation:Optional 34 // +optional 35 Tolerations []corev1.Toleration `json:"tolerations,omitempty"` 36 } 37 38 type ComponentConfig struct { 39 // nodePlacement describes scheduling configuration for specific 40 // KubeVirt components 41 //+optional 42 NodePlacement *NodePlacement `json:"nodePlacement,omitempty"` 43 // replicas indicates how many replicas should be created for each KubeVirt infrastructure 44 // component (like virt-api or virt-controller). Defaults to 2. 45 // WARNING: this is an advanced feature that prevents auto-scaling for core kubevirt components. Please use with caution! 46 //+optional 47 Replicas *uint8 `json:"replicas,omitempty"` 48 } 49