Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support dataflow affinity #3829

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,35 @@ const (
DataProcessType OperationType = "DataProcess"
)

// AffinityPolicy the strategy for the affinity between Data Operation Pods.
type AffinityPolicy string
xliuqq marked this conversation as resolved.
Show resolved Hide resolved

const (
DefaultAffinityStrategy AffinityPolicy = ""
RequireAffinityStrategy AffinityPolicy = "Require"
PreferAffinityStrategy AffinityPolicy = "Prefer"
)

type AffinityStrategy struct {
// Policy one of: "", "Require", "Prefer"
// +optional
Policy AffinityPolicy `json:"policy,omitempty"`

Prefer []Prefer `json:"prefer,omitempty"`
xliuqq marked this conversation as resolved.
Show resolved Hide resolved
Require []Require `json:"require,omitempty"`
}

// Prefer defines the label key and weight for generating a PreferredSchedulingTerm.
type Prefer struct {
xliuqq marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name"`
Weight int32 `json:"weight"`
}

// Require defines the label key for generating a NodeSelectorTerm.
type Require struct {
Name string `json:"name"`
}

type OperationRef struct {
// API version of the referent operation
// +optional
Expand All @@ -261,6 +290,10 @@ type OperationRef struct {
// Namespace specifies the namespace of the referent operation.
// +optional
Namespace string `json:"namespace,omitempty"`

// AffinityStrategy specifies the pod affinity strategy with the referent operation.
// +optional
AffinityStrategy AffinityStrategy `json:"affinityStrategy,omitempty"`
}

type WaitingStatus struct {
Expand Down
116 changes: 115 additions & 1 deletion api/v1alpha1/openapi_generated.go

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

3 changes: 3 additions & 0 deletions api/v1alpha1/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ type OperationStatus struct {
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"`
// WaitingStatus stores information about waiting operation.
WaitingFor WaitingStatus `json:"waitingFor,omitempty"`

// NodeAffinity records the node affinity for operation pods
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty"`
}

type RuntimePhase string
Expand Down
69 changes: 65 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions charts/fluid-databackup/alluxio/templates/databackup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ spec:
mountPath: /etc/group
readOnly: true
{{- end}}
{{- if .Values.dataBackup.affinity }}
affinity:
{{ toYaml .Values.dataBackup.affinity | indent 4 }}
{{- end }}

restartPolicy: Never
volumes:
{{- if .Values.dataBackup.workdir }}
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid-databackup/alluxio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ dataBackup:
# Description: optional image pull secrets on DataLoad pods
imagePullSecrets: []

affinity:

initUsers:
enabled: false
image: registry.cn-hangzhou.aliyuncs.com/fluid/init-users
Expand Down
4 changes: 4 additions & 0 deletions charts/fluid-dataprocess/common/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
{{- if .Values.dataProcess.scriptProcessor.volumeMounts }}
{{- toYaml .Values.dataProcess.scriptProcessor.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.dataProcess.scriptProcessor.affinity }}
affinity:
{{ toYaml .Values.dataProcess.scriptProcessor.affinity | indent 8 }}
{{- end }}
volumes:
- name: script-cm-vol
configMap:
Expand Down
Loading
Loading