Skip to content

Commit

Permalink
Merge pull request #16 from Al-assad/dev
Browse files Browse the repository at this point in the history
Supports NodeSelector properties for DorisCluster CRD
  • Loading branch information
Al-assad authored Nov 1, 2023
2 parents e5812de + c5cda4c commit f42ecee
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/v1beta1/doriscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ type DorisClusterSpec struct {
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// NodeSelector of the Doris cluster.
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// Tolerations are applied to Doris cluster pods, allowing pods to be scheduled onto nodes with matching taints.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
Expand Down Expand Up @@ -206,6 +210,10 @@ type DorisComponentSpec struct {
// +optional
ServiceAccount string `json:"serviceAccount,omitempty"`

// NodeSelector of the component.
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// Affinity for pod scheduling of Doris cluster.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Expand Down
14 changes: 14 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions config/crd/bases/al-assad.github.io_dorisclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
nodeSelector:
additionalProperties:
type: string
type: object
priorityClassName:
type: string
replicas:
Expand Down Expand Up @@ -4069,6 +4073,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
nodeSelector:
additionalProperties:
type: string
type: object
priorityClassName:
type: string
replicas:
Expand Down Expand Up @@ -5928,6 +5936,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
nodeSelector:
additionalProperties:
type: string
type: object
priorityClassName:
type: string
replicas:
Expand Down Expand Up @@ -7785,6 +7797,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
nodeSelector:
additionalProperties:
type: string
type: object
priorityClassName:
type: string
replicas:
Expand Down Expand Up @@ -7871,6 +7887,10 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: array
nodeSelector:
additionalProperties:
type: string
type: object
priorityClassName:
type: string
serviceAccount:
Expand Down
1 change: 1 addition & 0 deletions internal/transformer/be_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ func MakeBeStatefulSet(cr *dapi.DorisCluster, scheme *runtime.Scheme) *appv1.Sta
InitContainers: []corev1.Container{initContainer},
ImagePullSecrets: cr.Spec.ImagePullSecrets,
ServiceAccountName: util.StringFallback(cr.Spec.BE.ServiceAccount, cr.Spec.ServiceAccount),
NodeSelector: util.MapFallback(cr.Spec.BE.NodeSelector, cr.Spec.NodeSelector),
Affinity: util.PointerFallback(cr.Spec.BE.Affinity, cr.Spec.Affinity),
Tolerations: util.ArrayFallback(cr.Spec.BE.Tolerations, cr.Spec.Tolerations),
PriorityClassName: util.StringFallback(cr.Spec.BE.PriorityClassName, cr.Spec.PriorityClassName),
Expand Down
1 change: 1 addition & 0 deletions internal/transformer/broker_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func MakeBrokerStatefulSet(cr *dapi.DorisCluster, scheme *runtime.Scheme) *appv1
Containers: containers,
ImagePullSecrets: cr.Spec.ImagePullSecrets,
ServiceAccountName: util.StringFallback(cr.Spec.Broker.ServiceAccount, cr.Spec.ServiceAccount),
NodeSelector: util.MapFallback(cr.Spec.Broker.NodeSelector, cr.Spec.NodeSelector),
Affinity: util.PointerFallback(cr.Spec.Broker.Affinity, cr.Spec.Affinity),
Tolerations: util.ArrayFallback(cr.Spec.Broker.Tolerations, cr.Spec.Tolerations),
PriorityClassName: util.StringFallback(cr.Spec.Broker.PriorityClassName, cr.Spec.PriorityClassName),
Expand Down
1 change: 1 addition & 0 deletions internal/transformer/cn_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ func MakeCnStatefulSet(cr *dapi.DorisCluster, scheme *runtime.Scheme) *appv1.Sta
InitContainers: []corev1.Container{initContainer},
ImagePullSecrets: cr.Spec.ImagePullSecrets,
ServiceAccountName: util.StringFallback(cr.Spec.CN.ServiceAccount, cr.Spec.ServiceAccount),
NodeSelector: util.MapFallback(cr.Spec.CN.NodeSelector, cr.Spec.NodeSelector),
Affinity: util.PointerFallback(cr.Spec.CN.Affinity, cr.Spec.Affinity),
Tolerations: util.ArrayFallback(cr.Spec.CN.Tolerations, cr.Spec.Tolerations),
PriorityClassName: util.StringFallback(cr.Spec.CN.PriorityClassName, cr.Spec.PriorityClassName),
Expand Down
1 change: 1 addition & 0 deletions internal/transformer/fe_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ func MakeFeStatefulSet(cr *dapi.DorisCluster, scheme *runtime.Scheme) *appv1.Sta
Containers: containers,
ImagePullSecrets: cr.Spec.ImagePullSecrets,
ServiceAccountName: util.StringFallback(cr.Spec.FE.ServiceAccount, cr.Spec.ServiceAccount),
NodeSelector: util.MapFallback(cr.Spec.FE.NodeSelector, cr.Spec.NodeSelector),
Affinity: util.PointerFallback(cr.Spec.FE.Affinity, cr.Spec.Affinity),
Tolerations: util.ArrayFallback(cr.Spec.FE.Tolerations, cr.Spec.Tolerations),
PriorityClassName: util.StringFallback(cr.Spec.FE.PriorityClassName, cr.Spec.PriorityClassName),
Expand Down

0 comments on commit f42ecee

Please sign in to comment.