-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Extend CacheRuntime phase 3: add dataload/dataprocess support #5798
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| apiVersion: v2 | ||
| name: fluid-dataloader | ||
| description: A Helm chart for Fluid to prefetch data | ||
|
|
||
| # A chart can be either an 'application' or a 'library' chart. | ||
| # | ||
| # Application charts are a collection of templates that can be packaged into versioned archives | ||
| # to be deployed. | ||
| # | ||
| # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
| # a dependency of application charts to inject those utilities and functions into the rendering | ||
| # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
| type: application | ||
|
|
||
| # This is the chart version. This version number should be incremented each time you make changes | ||
| # to the chart and its templates, including the app version. | ||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
| version: 0.1.0 | ||
|
|
||
| # This is the version number of the application being deployed. This version number should be | ||
| # incremented each time you make changes to the application. Versions are not expected to | ||
| # follow Semantic Versioning. They should reflect the version the application is using. | ||
| appVersion: 0.3.0 | ||
|
|
||
| dependencies: | ||
| - name: library | ||
| version: "0.2.0" | ||
| repository: "file://../../library" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../library |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| {{- if eq (lower .Values.dataloader.policy) "cron" }} | ||
| apiVersion: {{ ternary "batch/v1" "batch/v1beta1" (.Capabilities.APIVersions.Has "batch/v1/CronJob") }} | ||
| kind: CronJob | ||
| metadata: | ||
| name: {{ printf "%s-job" .Release.Name }} | ||
| labels: | ||
| release: {{ .Release.Name }} | ||
| role: dataload-cronjob | ||
| app: cache | ||
| targetDataset: {{ required "targetDataset should be set" .Values.dataloader.targetDataset }} | ||
| dataload: {{ .Values.name }} | ||
| fluid.io/jobPolicy: cron | ||
| {{- include "library.fluid.labels" . | nindent 4 }} | ||
| ownerReferences: | ||
| {{- if .Values.owner.enabled }} | ||
| - apiVersion: {{ .Values.owner.apiVersion }} | ||
| blockOwnerDeletion: {{ .Values.owner.blockOwnerDeletion }} | ||
| controller: {{ .Values.owner.controller }} | ||
| kind: {{ .Values.owner.kind }} | ||
| name: {{ .Values.owner.name }} | ||
| uid: {{ .Values.owner.uid }} | ||
| {{- end }} | ||
| spec: | ||
| schedule: "{{ .Values.dataloader.schedule }}" | ||
| jobTemplate: | ||
| spec: | ||
| backoffLimit: {{ .Values.dataloader.backoffLimit | default "3" }} | ||
| completions: 1 | ||
| parallelism: 1 | ||
| template: | ||
| metadata: | ||
| name: {{ printf "%s-loader" .Release.Name }} | ||
| annotations: | ||
| sidecar.istio.io/inject: "false" | ||
| {{- if .Values.dataloader.annotations }} | ||
| {{- range $key, $val := .Values.dataloader.annotations }} | ||
| {{ $key | quote }}: {{ $val | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| labels: | ||
| release: {{ .Release.Name }} | ||
| role: dataload-pod | ||
| app: cache | ||
| cronjob: {{ printf "%s-job" .Release.Name }} | ||
| targetDataset: {{ required "targetDataset should be set" .Values.dataloader.targetDataset }} | ||
| {{- include "library.fluid.labels" . | nindent 12 }} | ||
| {{- if .Values.dataloader.labels }} | ||
| {{- range $key, $val := .Values.dataloader.labels }} | ||
| {{ $key | quote }}: {{ $val | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| spec: | ||
| {{- include "library.fluid.dataload.cronJobCommonTemplateSpec" . | nindent 10 }} | ||
| containers: | ||
| - name: dataloader | ||
| image: {{ required "Dataloader image should be set" .Values.dataloader.image }} | ||
| imagePullPolicy: IfNotPresent | ||
| command: | ||
| {{- range .Values.dataloader.command }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| args: | ||
|
xliuqq marked this conversation as resolved.
|
||
| {{- range .Values.dataloader.args }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
|
|
||
| {{- if .Values.dataloader.resources }} | ||
| resources: | ||
| {{- toYaml .Values.dataloader.resources | nindent 16}} | ||
|
Check warning on line 69 in charts/fluid-dataloader/cache/templates/cronjob.yaml
|
||
| {{- end }} | ||
| {{- $targetPaths := "" }} | ||
| {{- range .Values.dataloader.targetPaths }} | ||
| {{- $targetPaths = cat $targetPaths (required "Path must be set" .path) ":" }} | ||
| {{- end }} | ||
| {{- $targetPaths = $targetPaths | nospace | trimSuffix ":" }} | ||
|
|
||
| {{- $pathReplicas := ""}} | ||
|
Check warning on line 77 in charts/fluid-dataloader/cache/templates/cronjob.yaml
|
||
| {{- range .Values.dataloader.targetPaths }} | ||
| {{- $pathReplicas = cat $pathReplicas ( default 1 .replicas ) ":"}} | ||
|
Check warning on line 79 in charts/fluid-dataloader/cache/templates/cronjob.yaml
|
||
| {{- end }} | ||
| {{- $pathReplicas = $pathReplicas | nospace | trimSuffix ":"}} | ||
|
Check warning on line 81 in charts/fluid-dataloader/cache/templates/cronjob.yaml
|
||
| env: | ||
| - name: FLUID_DATALOAD_METADATA | ||
| value: {{ default false .Values.dataloader.loadMetadata | quote }} | ||
| - name: FLUID_DATALOAD_DATA_PATH | ||
| value: {{ $targetPaths | quote }} | ||
| - name: FLUID_DATALOAD_PATH_REPLICAS | ||
| value: {{ $pathReplicas | quote }} | ||
| {{- range .Values.dataloader.envs }} | ||
| - name: {{ .name }} | ||
| value: {{ .value | quote }} | ||
| {{- end }} | ||
|
|
||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| {{- if or (eq (lower .Values.dataloader.policy) "") (eq (lower .Values.dataloader.policy) "once") }} | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: {{ printf "%s-job" .Release.Name }} | ||
| labels: | ||
| release: {{ .Release.Name }} | ||
| role: dataload-job | ||
| app: cache | ||
| targetDataset: {{ required "targetDataset should be set" .Values.dataloader.targetDataset }} | ||
| {{- include "library.fluid.labels" . | nindent 4 }} | ||
| ownerReferences: | ||
| {{- if .Values.owner.enabled }} | ||
| - apiVersion: {{ .Values.owner.apiVersion }} | ||
| blockOwnerDeletion: {{ .Values.owner.blockOwnerDeletion }} | ||
| controller: {{ .Values.owner.controller }} | ||
| kind: {{ .Values.owner.kind }} | ||
| name: {{ .Values.owner.name }} | ||
| uid: {{ .Values.owner.uid }} | ||
| {{- end }} | ||
| spec: | ||
| backoffLimit: {{ .Values.dataloader.backoffLimit | default "3" }} | ||
| completions: 1 | ||
| parallelism: 1 | ||
| template: | ||
| metadata: | ||
| name: {{ printf "%s-loader" .Release.Name }} | ||
| annotations: | ||
| sidecar.istio.io/inject: "false" | ||
| {{- if .Values.dataloader.annotations }} | ||
| {{- range $key, $val := .Values.dataloader.annotations }} | ||
| {{ $key | quote }}: {{ $val | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| labels: | ||
| release: {{ .Release.Name }} | ||
| role: dataload-pod | ||
| app: cache | ||
| targetDataset: {{ required "targetDataset should be set" .Values.dataloader.targetDataset }} | ||
| {{- include "library.fluid.labels" . | nindent 8 }} | ||
| {{- if .Values.dataloader.labels }} | ||
| {{- range $key, $val := .Values.dataloader.labels }} | ||
| {{ $key | quote }}: {{ $val | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| spec: | ||
| {{- if .Values.dataloader.schedulerName }} | ||
| schedulerName: {{ .Values.dataloader.schedulerName }} | ||
| {{- end }} | ||
| {{- with .Values.dataloader.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.dataloader.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.dataloader.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| restartPolicy: Never | ||
| {{- with .Values.dataloader.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - name: dataloader | ||
| image: {{ required "Dataloader image should be set" .Values.dataloader.image }} | ||
| imagePullPolicy: IfNotPresent | ||
| command: | ||
| {{- range .Values.dataloader.command }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| args: | ||
| {{- range .Values.dataloader.args }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
|
|
||
| {{- if .Values.dataloader.resources }} | ||
| resources: | ||
| {{ toYaml .Values.dataloader.resources | nindent 12 }} | ||
| {{- end }} | ||
| {{- $targetPaths := "" }} | ||
| {{- range .Values.dataloader.targetPaths }} | ||
| {{- $targetPaths = cat $targetPaths (required "Path must be set" .path) ":" }} | ||
| {{- end }} | ||
| {{- $targetPaths = $targetPaths | nospace | trimSuffix ":" }} | ||
|
|
||
| {{- $pathReplicas := ""}} | ||
| {{- range .Values.dataloader.targetPaths }} | ||
| {{- $pathReplicas = cat $pathReplicas ( default 1 .replicas ) ":"}} | ||
| {{- end }} | ||
| {{- $pathReplicas = $pathReplicas | nospace | trimSuffix ":"}} | ||
| env: | ||
| - name: FLUID_DATALOAD_METADATA | ||
| value: {{ default false .Values.dataloader.loadMetadata | quote }} | ||
| - name: FLUID_DATALOAD_DATA_PATH | ||
| value: {{ $targetPaths | quote }} | ||
| - name: FLUID_DATALOAD_PATH_REPLICAS | ||
| value: {{ $pathReplicas | quote }} | ||
| {{- range .Values.dataloader.envs }} | ||
| - name: {{ .name }} | ||
| value: {{ .value | quote }} | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataOperationSpec.Commandhas no validation — if both command and args are empty, the pod launches with the container's default entrypoint, which may produce unexpected behavior for cache engines. Should the API require at least one of command/args to be non-empty when the operation is declared?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check in
genDataLoadValue.