Skip to content
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
10 changes: 10 additions & 0 deletions helm/templates/sts-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions helm/templates/sts-tablet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
333 changes: 333 additions & 0 deletions helm/tests/extra_volumes_test.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading