-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add a data importer for bringing cloud data into onPrem #44
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| {{- if .Values.toolbox.enabled }} | ||
| {{/* | ||
| Toolbox pod — a gated, manually-driven pod for the org import (ENG-912/913). | ||
|
|
||
| Single container on the onPrem scheduler image, which now carries BOTH the org-import | ||
| CLIs (baked in at /app/packages/scheduler/dist/orgImport) and `mongorestore`. So the whole | ||
| import runs here with nothing kubectl-cp'd: the operator copies in a small download.json | ||
| and runs `currents-import`. | ||
|
|
||
| It runs `sleep infinity` and does nothing on its own. | ||
| */}} | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: {{ include "currents.toolbox.fullname" . }} | ||
| labels: | ||
| {{- include "currents.labels" (dict "context" . "component" .Values.toolbox.name) | nindent 4 }} | ||
| {{- with .Values.global.podAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| # A bare Pod, not a Job: the import is operator-driven and must never auto-retry. | ||
| restartPolicy: Never | ||
| {{- with .Values.global.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| serviceAccountName: {{ include "currents.serviceAccountName" . }} | ||
| {{- /* fsGroup makes the PVC writable by the non-root container user. */}} | ||
| {{- with .Values.global.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
|
twk3 marked this conversation as resolved.
|
||
| {{- with .Values.global.priorityClassName }} | ||
| priorityClassName: {{ . }} | ||
| {{- end }} | ||
| containers: | ||
| - name: toolbox | ||
| {{- with .Values.global.containerSecurityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| # The onPrem scheduler image: node + @currents/* + the org-import CLIs + mongorestore. | ||
| image: {{ include "currents.image" (dict "context" . "imageRoot" .Values.scheduler.image) }} | ||
| imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.scheduler.image.pullPolicy }} | ||
| # Override the image's pm2 entrypoint — nothing runs on its own here. | ||
| command: ["sleep", "infinity"] | ||
| env: | ||
| - name: CURRENTS_ENV | ||
| value: "onprem" | ||
| # node/mongorestore write config under $HOME; the root FS is read-only, so point it | ||
| # at the PVC. | ||
| - name: HOME | ||
| value: /data | ||
| {{- /* A bulk merge INSERT … SELECT into test_metric_v2 (+ its rollup MVs) can run for | ||
| minutes with no bytes on the socket; raise the client's request timeout past the | ||
| 30s default so it doesn't trip mid-insert. Matches ch-import's max_execution_time. */}} | ||
| - name: CLICKHOUSE_REQUEST_TIMEOUT_MS | ||
| value: {{ .Values.toolbox.clickhouseRequestTimeoutMs | default 3600000 | int64 | quote }} | ||
| {{- include "currents.connectionConfigEnv" . | nindent 8 }} | ||
| {{- /* The importer refuses a ClickHouse import unless it sees this — safe only | ||
| because the same helper sets it on the change-streams deployment. */}} | ||
| {{- include "currents.clickhouseRestoreModeEnv" . | nindent 8 }} | ||
| {{- with (concat .Values.global.env .Values.toolbox.env) }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| volumeMounts: | ||
| - name: data | ||
| mountPath: /data | ||
| # Writable /tmp for the local merge FIFOs (the transformed BSON flows through the | ||
| # kernel pipe, not to disk). Needed because the root FS is read-only. | ||
| - name: tmp | ||
| mountPath: /tmp | ||
| {{- with .Values.toolbox.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| volumes: | ||
| - name: data | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "currents.toolbox.fullname" . }}-data | ||
| - name: tmp | ||
| emptyDir: | ||
| medium: Memory | ||
| {{- with .Values.toolbox.nodeSelector | default .Values.global.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.toolbox.tolerations | default .Values.global.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.toolbox.affinity | default .Values.global.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| {{- if .Values.toolbox.enabled }} | ||
| {{/* | ||
| Scratch space for the toolbox pod. | ||
|
|
||
| For an org import this holds the export artifact (*.bson, *.native, | ||
| manifest.json) plus the exactly-once import state file, so size it at roughly | ||
| 1.5x the export's manifest.totals.exportedBytes + clickhouseTotals.exportedBytes. | ||
|
|
||
| It deliberately outlives individual exec sessions: the ClickHouse import records | ||
| which tables it has already inserted in /data/.import-state.json, and that record | ||
| is what prevents a re-run from double-counting the AggregatingMergeTree rollups. | ||
| Deleting this volume mid-import destroys that guard. | ||
| */}} | ||
| kind: PersistentVolumeClaim | ||
| apiVersion: v1 | ||
| metadata: | ||
| name: {{ include "currents.toolbox.fullname" . }}-data | ||
| labels: | ||
| {{- include "currents.labels" (dict "context" . "component" .Values.toolbox.name) | nindent 4 }} | ||
| annotations: | ||
| # Keep the volume (and the import state file) if the release is uninstalled | ||
| # while an import is in flight. | ||
| helm.sh/resource-policy: keep | ||
|
twk3 marked this conversation as resolved.
|
||
| spec: | ||
| accessModes: | ||
| - {{ .Values.toolbox.persistence.accessMode | quote }} | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.toolbox.persistence.size | quote }} | ||
| {{- if .Values.toolbox.persistence.volumeName }} | ||
| volumeName: {{ .Values.toolbox.persistence.volumeName }} | ||
| {{- end }} | ||
| {{- if .Values.toolbox.persistence.storageClass }} | ||
| storageClassName: "{{ .Values.toolbox.persistence.storageClass }}" | ||
| {{- end }} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.