Skip to content

Commit bb55cee

Browse files
committed
adding e2e tests
1 parent 48349d2 commit bb55cee

File tree

4 files changed

+70
-13
lines changed

4 files changed

+70
-13
lines changed

.github/workflows/e2e.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ on:
3030
append-java-version:
3131
type: boolean
3232
default: false
33+
helm-values-yaml-path:
34+
required: false
35+
type: string
36+
default: "helm/flink-kubernetes-operator/values.yaml"
3337

3438
jobs:
3539
e2e_test:
@@ -68,12 +72,50 @@ jobs:
6872
source e2e-tests/utils.sh
6973
create_namespace ${{ inputs.namespace }}
7074
echo 'EXTRA_HELM_INSTALL_ARGS=--set "watchNamespaces={default,flink}"' >> $GITHUB_OUTPUT
75+
- name: Start the operator with legacy flink-conf.yaml
76+
run: |
77+
if [[ "${{ inputs.test }}" == "test_flink_operator_ha.sh" ]]; then
78+
sed -i "s/# kubernetes.operator.leader-election.enabled: false/kubernetes.operator.leader-election.enabled: true/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
79+
sed -i "s/# kubernetes.operator.leader-election.lease-name: flink-operator-lease/kubernetes.operator.leader-election.lease-name: flink-operator-lease/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
80+
sed -i "s/config.yaml: |+/flink-conf.yaml: |+/" helm/flink-kubernetes-operator/values.yaml
81+
fi
82+
helm --debug install flink-kubernetes-operator -n ${{ inputs.namespace }} helm/flink-kubernetes-operator --set image.repository=flink-kubernetes-operator --set image.tag=ci-latest ${{ steps.namespace-creator.outputs.EXTRA_HELM_INSTALL_ARGS }}
83+
kubectl wait --for=condition=Available --timeout=120s -n ${{ inputs.namespace }} deploy/flink-kubernetes-operator
84+
kubectl get pods -n ${{ inputs.namespace }}
85+
- name: Run Flink e2e tests using legacy flink-conf.yaml
86+
run: |
87+
FLINK_IMAGE=$(sed --regexp-extended 's/v([0-9]+)_([0-9]+)/flink:\1.\2/g' <<< ${{ inputs.flink-version }} )
88+
if [[ "${{ inputs.append-java-version }}" == "true" ]]; then
89+
FLINK_IMAGE=${FLINK_IMAGE}-java${{ inputs.java-version }}
90+
fi
91+
92+
EXAMPLES_JAR="https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming_2.12/1.14.4/flink-examples-streaming_2.12-1.14.4.jar"
93+
if [[ ${{ inputs.flink-version }} == v2* ]]; then
94+
EXAMPLES_JAR="https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming/2.0-preview1/flink-examples-streaming-2.0-preview1.jar"
95+
elif [[ "${{ inputs.test }}" == "test_batch_job.sh" ]]; then
96+
EXAMPLES_JAR="https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming/1.20.1/flink-examples-streaming-1.20.1.jar"
97+
fi
98+
ESCAPED_EXAMPLES_JAR=$(printf '%s\n' "$EXAMPLES_JAR" | sed -e 's/[\/&]/\\&/g')
99+
100+
echo FLINK_IMAGE=${FLINK_IMAGE}
101+
echo EXAMPLES_JAR=${EXAMPLES_JAR}
102+
sed -i "s/image: flink:.*/image: ${FLINK_IMAGE}/" e2e-tests/data/*.yaml
103+
sed -i "s/flinkVersion: .*/flinkVersion: ${{ inputs.flink-version }}/" e2e-tests/data/*.yaml
104+
sed -i "s/mode: .*/mode: ${{ inputs.mode }}/" e2e-tests/data/*.yaml
105+
sed -i "s/STREAMING_EXAMPLES_JAR_URL/${ESCAPED_EXAMPLES_JAR}/" e2e-tests/data/*.yaml
106+
git diff HEAD
107+
echo "Running e2e-tests/$test"
108+
bash e2e-tests/${{ inputs.test }} || exit 1
109+
git reset --hard
110+
- name: Stop the operator legacy flink-conf.yaml
111+
run: |
112+
helm uninstall -n ${{ inputs.namespace }} flink-kubernetes-operator
71113
- name: Start the operator
72114
run: |
73115
if [[ "${{ inputs.test }}" == "test_flink_operator_ha.sh" ]]; then
74116
sed -i "s/# kubernetes.operator.leader-election.enabled: false/kubernetes.operator.leader-election.enabled: true/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
75117
sed -i "s/# kubernetes.operator.leader-election.lease-name: flink-operator-lease/kubernetes.operator.leader-election.lease-name: flink-operator-lease/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
76-
sed -i "s/replicas: 1/replicas: 2/" helm/flink-kubernetes-operator/values.yaml
118+
sed -i "s/flink-conf.yaml: |+/config.yaml: |+/" helm/flink-kubernetes-operator/values.yaml
77119
fi
78120
helm --debug install flink-kubernetes-operator -n ${{ inputs.namespace }} helm/flink-kubernetes-operator --set image.repository=flink-kubernetes-operator --set image.tag=ci-latest ${{ steps.namespace-creator.outputs.EXTRA_HELM_INSTALL_ARGS }}
79121
kubectl wait --for=condition=Available --timeout=120s -n ${{ inputs.namespace }} deploy/flink-kubernetes-operator
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defaultConfiguration:
2+
flink-conf.yaml: |+
3+
# Flink Config Overrides
4+
kubernetes.operator.metrics.reporter.slf4j.factory.class: org.apache.flink.metrics.slf4j.Slf4jReporterFactory
5+
kubernetes.operator.metrics.reporter.slf4j.interval: 5 MINUTE
6+
7+
kubernetes.operator.reconcile.interval: 15 s
8+
kubernetes.operator.observer.progress-check.interval: 5 s

helm/flink-kubernetes-operator/templates/flink-operator.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ spec:
235235
configMap:
236236
name: flink-operator-config
237237
items:
238-
{{- if index .Values.defaultConfiguration "config.yaml" }}
239-
- key: config.yaml
240-
path: config.yaml
241-
{{- else }}
238+
{{- if hasKey .Values.defaultConfiguration "flink-conf.yaml" }}
242239
- key: flink-conf.yaml
243240
path: flink-conf.yaml
241+
{{- else }}
242+
- key: config.yaml
243+
path: config.yaml
244244
{{- end }}
245245
- key: log4j-operator.properties
246246
path: log4j-operator.properties
@@ -276,19 +276,26 @@ metadata:
276276
labels:
277277
{{- include "flink-operator.labels" . | nindent 4 }}
278278
data:
279-
{{- if index .Values.defaultConfiguration "config.yaml" }}
280279
config.yaml: |+
281-
{{- else }}
282-
flink-conf.yaml: |+
283-
{{- end }}
284280
{{- if .Values.defaultConfiguration.append }}
285281
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 -}}
286282
{{- end }}
287283
{{- if index (.Values.defaultConfiguration) "flink-conf.yaml" }}
288284
{{- index (.Values.defaultConfiguration) "flink-conf.yaml" | nindent 4 -}}
289285
{{- end }}
290-
{{- if index (.Values.defaultConfiguration) "config.yaml" }}
291-
{{- index (.Values.defaultConfiguration) "config.yaml" | nindent 4 -}}
286+
{{- if .Values.watchNamespaces }}
287+
kubernetes.operator.watched.namespaces: {{ join "," .Values.watchNamespaces }}
288+
{{- end }}
289+
{{- if index .Values "operatorHealth" }}
290+
kubernetes.operator.health.probe.enabled: true
291+
kubernetes.operator.health.probe.port: {{ .Values.operatorHealth.port }}
292+
{{- end }}
293+
flink-conf.yaml: |+
294+
{{- if .Values.defaultConfiguration.append }}
295+
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 -}}
296+
{{- end }}
297+
{{- if index (.Values.defaultConfiguration) "flink-conf.yaml" }}
298+
{{- index (.Values.defaultConfiguration) "flink-conf.yaml" | nindent 4 -}}
292299
{{- end }}
293300
{{- if .Values.watchNamespaces }}
294301
kubernetes.operator.watched.namespaces: {{ join "," .Values.watchNamespaces }}

helm/flink-kubernetes-operator/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# watchNamespaces: ["flink"]
2424

2525
image:
26-
repository: flink-kubernetes-operator
26+
repository: localhost:5000/flink-kubernetes-operator
2727
pullPolicy: IfNotPresent
2828
tag: latest
2929
# If image digest is set then it takes precedence and the image tag will be ignored
@@ -163,7 +163,7 @@ defaultConfiguration:
163163
# If set to false, loads just the overrides as in (2).
164164
# This option has not effect, if create is equal to false.
165165
append: true
166-
flink-conf.yaml: |+
166+
config.yaml: |+
167167
# Flink Config Overrides
168168
kubernetes.operator.metrics.reporter.slf4j.factory.class: org.apache.flink.metrics.slf4j.Slf4jReporterFactory
169169
kubernetes.operator.metrics.reporter.slf4j.interval: 5 MINUTE

0 commit comments

Comments
 (0)