diff --git a/helm/templates/sts-coordinator.yaml b/helm/templates/sts-coordinator.yaml index 7a6774b281..0b97e8c171 100644 --- a/helm/templates/sts-coordinator.yaml +++ b/helm/templates/sts-coordinator.yaml @@ -39,6 +39,10 @@ spec: serviceAccountName: {{ .Values.serviceAccount.name | default (include "fluss.fullname" .) }} {{- end }} {{- include "fluss.imagePullSecrets" . | nindent 6 }} + {{- with .Values.coordinator.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }}-coordinator image: {{ include "fluss.image" . }} @@ -110,6 +114,9 @@ spec: mountPath: /etc/fluss/conf readOnly: true {{- end }} + {{- with .Values.coordinator.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} volumes: - name: fluss-conf configMap: @@ -123,6 +130,9 @@ spec: secret: secretName: {{ include "fluss.security.jaas.configName" . }} {{- end }} + {{- with .Values.coordinator.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if .Values.coordinator.storage.enabled }} volumeClaimTemplates: - metadata: diff --git a/helm/templates/sts-tablet.yaml b/helm/templates/sts-tablet.yaml index b58fc49f8b..b7a1cb78bb 100644 --- a/helm/templates/sts-tablet.yaml +++ b/helm/templates/sts-tablet.yaml @@ -39,6 +39,10 @@ spec: serviceAccountName: {{ .Values.serviceAccount.name | default (include "fluss.fullname" .) }} {{- end }} {{- include "fluss.imagePullSecrets" . | nindent 6 }} + {{- with .Values.tablet.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }}-tablet image: {{ include "fluss.image" . }} @@ -107,6 +111,9 @@ spec: mountPath: /etc/fluss/conf readOnly: true {{- end }} + {{- with .Values.tablet.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} volumes: - name: fluss-conf configMap: @@ -120,6 +127,9 @@ spec: secret: secretName: {{ include "fluss.security.jaas.configName" . }} {{- end }} + {{- with .Values.tablet.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- if .Values.tablet.storage.enabled }} volumeClaimTemplates: - metadata: diff --git a/helm/tests/extra_volumes_test.yaml b/helm/tests/extra_volumes_test.yaml new file mode 100644 index 0000000000..1ebc29b9ee --- /dev/null +++ b/helm/tests/extra_volumes_test.yaml @@ -0,0 +1,333 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +suite: defaults +templates: + - templates/sts-coordinator.yaml + - templates/sts-tablet.yaml + +tests: + - it: should not render initContainers by default on coordinator + asserts: + - isNull: + path: spec.template.spec.initContainers + template: templates/sts-coordinator.yaml + + - it: should not render initContainers by default on tablet + asserts: + - isNull: + path: spec.template.spec.initContainers + template: templates/sts-tablet.yaml + + - it: should not render extra volumeMounts beyond built-ins by default on coordinator + asserts: + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - name: fluss-conf + mountPath: /opt/conf + - name: data + mountPath: /tmp/fluss/data + template: templates/sts-coordinator.yaml + + - it: should not render extra volumeMounts beyond built-ins by default on tablet + asserts: + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - name: fluss-conf + mountPath: /opt/conf + - name: data + mountPath: /tmp/fluss/data + template: templates/sts-tablet.yaml + +--- + +suite: coordinator extra resources +templates: + - templates/sts-coordinator.yaml + +tests: + - it: should render initContainers on coordinator + set: + coordinator.initContainers: + - name: init-wait + image: busybox:latest + command: ["sh", "-c", "echo ready"] + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: init-wait + image: busybox:latest + command: ["sh", "-c", "echo ready"] + + - it: should render multiple initContainers on coordinator + set: + coordinator.initContainers: + - name: init-one + image: busybox:latest + command: ["sh", "-c", "echo one"] + - name: init-two + image: busybox:latest + command: ["sh", "-c", "echo two"] + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: init-one + image: busybox:latest + command: ["sh", "-c", "echo one"] + - contains: + path: spec.template.spec.initContainers + content: + name: init-two + image: busybox:latest + command: ["sh", "-c", "echo two"] + + - it: should render extraVolumes on coordinator + set: + coordinator.extraVolumes: + - name: custom-config + configMap: + name: my-config + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: custom-config + configMap: + name: my-config + + - it: should render extraVolumeMounts on coordinator + set: + coordinator.extraVolumeMounts: + - name: custom-config + mountPath: /custom + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: custom-config + mountPath: /custom + + - it: should not apply tablet extra resources to coordinator + set: + tablet.extraVolumes: + - name: tablet-only + emptyDir: {} + tablet.extraVolumeMounts: + - name: tablet-only + mountPath: /tablet + tablet.initContainers: + - name: tablet-init + image: busybox:latest + asserts: + - isNull: + path: spec.template.spec.initContainers + - notContains: + path: spec.template.spec.volumes + content: + name: tablet-only + any: true + - notContains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: tablet-only + any: true + +--- + +suite: tablet extra resources +templates: + - templates/sts-tablet.yaml + +tests: + - it: should render initContainers on tablet + set: + tablet.initContainers: + - name: init-wait + image: busybox:latest + command: ["sh", "-c", "echo ready"] + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: init-wait + image: busybox:latest + command: ["sh", "-c", "echo ready"] + + - it: should render multiple initContainers on tablet + set: + tablet.initContainers: + - name: init-one + image: busybox:latest + command: ["sh", "-c", "echo one"] + - name: init-two + image: busybox:latest + command: ["sh", "-c", "echo two"] + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: init-one + image: busybox:latest + command: ["sh", "-c", "echo one"] + - contains: + path: spec.template.spec.initContainers + content: + name: init-two + image: busybox:latest + command: ["sh", "-c", "echo two"] + + - it: should render extraVolumes on tablet + set: + tablet.extraVolumes: + - name: custom-config + configMap: + name: my-config + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: custom-config + configMap: + name: my-config + + - it: should render extraVolumeMounts on tablet + set: + tablet.extraVolumeMounts: + - name: custom-config + mountPath: /custom + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: custom-config + mountPath: /custom + + - it: should not apply coordinator extra resources to tablet + set: + coordinator.extraVolumes: + - name: coordinator-only + emptyDir: {} + coordinator.extraVolumeMounts: + - name: coordinator-only + mountPath: /coordinator + coordinator.initContainers: + - name: coordinator-init + image: busybox:latest + asserts: + - isNull: + path: spec.template.spec.initContainers + - notContains: + path: spec.template.spec.volumes + content: + name: coordinator-only + any: true + - notContains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: coordinator-only + any: true + +--- + +suite: coexistence with existing resources +templates: + - templates/sts-coordinator.yaml + - templates/sts-tablet.yaml + +tests: + - it: should preserve built-in volumes when extraVolumes are added on coordinator + set: + coordinator.extraVolumes: + - name: extra-vol + emptyDir: {} + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: fluss-conf + configMap: + name: fluss-conf-file + template: templates/sts-coordinator.yaml + - contains: + path: spec.template.spec.volumes + content: + name: extra-vol + emptyDir: {} + template: templates/sts-coordinator.yaml + + - it: should preserve built-in volumes when extraVolumes are added on tablet + set: + tablet.extraVolumes: + - name: extra-vol + emptyDir: {} + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: fluss-conf + configMap: + name: fluss-conf-file + template: templates/sts-tablet.yaml + - contains: + path: spec.template.spec.volumes + content: + name: extra-vol + emptyDir: {} + template: templates/sts-tablet.yaml + + - it: should preserve built-in volumeMounts when extraVolumeMounts are added on coordinator + set: + coordinator.extraVolumeMounts: + - name: extra-vol + mountPath: /extra + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: fluss-conf + mountPath: /opt/conf + template: templates/sts-coordinator.yaml + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: extra-vol + mountPath: /extra + template: templates/sts-coordinator.yaml + + - it: should preserve built-in volumeMounts when extraVolumeMounts are added on tablet + set: + tablet.extraVolumeMounts: + - name: extra-vol + mountPath: /extra + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: fluss-conf + mountPath: /opt/conf + template: templates/sts-tablet.yaml + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: extra-vol + mountPath: /extra + template: templates/sts-tablet.yaml diff --git a/helm/values.yaml b/helm/values.yaml index 219fbc75ce..7dd11f5453 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -43,6 +43,9 @@ tablet: enabled: false size: 1Gi storageClass: + extraVolumes: [] + extraVolumeMounts: [] + initContainers: [] coordinator: numberOfReplicas: 1 @@ -50,6 +53,9 @@ coordinator: enabled: false size: 1Gi storageClass: + extraVolumes: [] + extraVolumeMounts: [] + initContainers: [] # Fluss listener configurations listeners: diff --git a/website/docs/install-deploy/deploying-with-helm.md b/website/docs/install-deploy/deploying-with-helm.md index f7e543934d..ec39572f85 100644 --- a/website/docs/install-deploy/deploying-with-helm.md +++ b/website/docs/install-deploy/deploying-with-helm.md @@ -264,6 +264,16 @@ It is recommended to set these explicitly in production. | `resources.tabletServer.limits.cpu` | CPU limits for tablet servers | Not set | | `resources.tabletServer.limits.memory` | Memory limits for tablet servers | Not set | +### Pod Extension Parameters + +| Parameter | Description | Default | +|-----------|-------------|---------| +| `coordinator.extraVolumes` | Extra volumes to add to the CoordinatorServer pod spec | `[]` | +| `coordinator.extraVolumeMounts` | Extra volume mounts to add to the coordinator container | `[]` | +| `coordinator.initContainers` | Init containers to run before the coordinator container starts | `[]` | +| `tablet.extraVolumes` | Extra volumes to add to TabletServer pod specs | `[]` | +| `tablet.extraVolumeMounts` | Extra volume mounts to add to the tablet container | `[]` | +| `tablet.initContainers` | Init containers to run before the tablet container starts | `[]` | ## Advanced Configuration @@ -434,6 +444,45 @@ configurationOverrides: remote.data.dir: "s3://my-bucket/fluss-data" ``` +### Loading Filesystem Plugins via Init Containers + +Fluss discovers filesystem plugins at startup by scanning subdirectories under `$FLUSS_HOME/plugins/`. +To load a plugin that is not bundled in the base image, you can use an init container to download the plugin jar +into a shared `emptyDir` volume before the main container starts. + +The example below loads the Azure filesystem plugin (`fluss-fs-azure`) +so that Fluss can read and write remote data to Azure Blob Storage +(the example is for version `0.9`, adapt to your necessities): + +```yaml +_fsAzurePlugin: &fsAzurePlugin + extraVolumes: + - name: azure-plugin + emptyDir: {} + extraVolumeMounts: + - name: azure-plugin + mountPath: /opt/fluss/plugins/azure + subPath: azure + initContainers: + - name: download-fs-azure + image: alpine:3.20 + command: + - sh + - -c + - | + wget -O /plugins/azure/fluss-fs-azure-0.9.jar \ + https://repo1.maven.org/maven2/org/apache/fluss/fluss-fs-azure/0.9.0-incubating/fluss-fs-azure-0.9.0-incubating.jar + volumeMounts: + - name: azure-plugin + mountPath: /plugins + +coordinator: + <<: *fsAzurePlugin + +tablet: + <<: *fsAzurePlugin +``` + ## Upgrading ### Upgrade the Chart