Skip to content

Commit 0e19953

Browse files
authored
Add support for external engines (#84)
* Add Engine CRD * Use datagen and blackhole connectors for demodb * Add fat driver for integration tests
1 parent f10e6e8 commit 0e19953

File tree

58 files changed

+2321
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2321
-66
lines changed

Makefile

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
install:
3-
./gradlew compileJava installDist shadowJar
3+
./gradlew compileJava installDist
44

55
test:
66
./gradlew test -x spotbugsMain -x spotbugsTest -x spotbugsTestFixtures
77

88
build:
9-
./gradlew build
9+
./gradlew build shadowJar
1010
docker build . -t hoptimator
1111
docker build hoptimator-flink-runner -f hoptimator-flink-runner/Dockerfile-flink-runner -t hoptimator-flink-runner
1212
docker build hoptimator-flink-runner -f hoptimator-flink-runner/Dockerfile-flink-operator -t hoptimator-flink-operator
1313

14-
bounce: build undeploy deploy deploy-samples deploy-config deploy-demo
14+
bounce: build undeploy deploy deploy-samples deploy-config
1515

1616
clean:
1717
./gradlew clean
@@ -34,12 +34,6 @@ undeploy: undeploy-config
3434

3535
quickstart: build deploy
3636

37-
deploy-demo: deploy
38-
kubectl apply -f ./deploy/samples/demodb.yaml
39-
40-
undeploy-demo: undeploy
41-
kubectl delete -f ./deploy/samples/demodb.yaml
42-
4337
deploy-samples: deploy
4438
kubectl wait --for=condition=Established=True \
4539
crds/subscriptions.hoptimator.linkedin.com \
@@ -72,8 +66,6 @@ deploy-kafka: deploy deploy-flink
7266
kubectl create namespace kafka || echo "skipping"
7367
kubectl apply -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka
7468
kubectl wait --for=condition=Established=True crds/kafkas.kafka.strimzi.io
75-
kubectl apply -f ./deploy/dev
76-
kubectl apply -f ./deploy/samples/demodb.yaml
7769
kubectl apply -f ./deploy/samples/kafkadb.yaml
7870

7971
undeploy-kafka:
@@ -83,7 +75,6 @@ undeploy-kafka:
8375
kubectl delete -f "https://strimzi.io/install/latest?namespace=kafka" -n kafka || echo "skipping"
8476
kubectl delete -f ./deploy/samples/kafkadb.yaml || echo "skipping"
8577
kubectl delete -f ./deploy/samples/demodb.yaml || echo "skipping"
86-
kubectl delete -f ./deploy/dev || echo "skipping"
8778
kubectl delete namespace kafka || echo "skipping"
8879

8980
# Deploys Venice cluster in docker and creates two stores in Venice. Stores are not managed via K8s for now.
@@ -98,11 +89,19 @@ undeploy-venice:
9889
docker compose -f ./deploy/docker/venice/docker-compose-single-dc-setup.yaml down
9990

10091
deploy-dev-environment: deploy deploy-flink deploy-kafka deploy-venice
92+
kubectl wait --for=condition=Established=True \
93+
crds/subscriptions.hoptimator.linkedin.com \
94+
crds/kafkatopics.hoptimator.linkedin.com \
95+
crds/sqljobs.hoptimator.linkedin.com
96+
kubectl apply -f ./deploy/dev/
97+
kubectl apply -f ./deploy/samples/demodb.yaml
10198

10299
undeploy-dev-environment: undeploy-venice undeploy-kafka undeploy-flink undeploy
100+
kubectl delete -f ./deploy/dev || echo "skipping"
101+
kubectl delete -f ./deploy/samples/demodb.yaml || echo "skipping"
103102

104103
# Integration test setup intended to be run locally
105-
integration-tests: deploy-dev-environment deploy-samples
104+
integration-tests: deploy-dev-environment
106105
kubectl wait kafka.kafka.strimzi.io/one --for=condition=Ready --timeout=10m -n kafka
107106
kubectl wait kafkatopic.kafka.strimzi.io/existing-topic-1 --for=condition=Ready --timeout=10m -n kafka
108107
kubectl wait kafkatopic.kafka.strimzi.io/existing-topic-2 --for=condition=Ready --timeout=10m -n kafka
@@ -111,7 +110,7 @@ integration-tests: deploy-dev-environment deploy-samples
111110
kill `cat port-forward.pid`
112111

113112
# kind cluster used in github workflow needs to have different routing set up, avoiding the need to forward kafka ports
114-
integration-tests-kind: deploy-dev-environment deploy-samples
113+
integration-tests-kind: deploy-dev-environment
115114
kubectl wait kafka.kafka.strimzi.io/one --for=condition=Ready --timeout=10m -n kafka
116115
kubectl wait kafkatopic.kafka.strimzi.io/existing-topic-1 --for=condition=Ready --timeout=10m -n kafka
117116
kubectl wait kafkatopic.kafka.strimzi.io/existing-topic-2 --for=condition=Ready --timeout=10m -n kafka
@@ -125,15 +124,15 @@ release:
125124
test -n "$(VERSION)" # MISSING ARG: $$VERSION
126125
./gradlew publish
127126

128-
build-zeppelin:
127+
build-zeppelin: build
129128
docker build -t hoptimator-zeppelin -t hoptimator-zeppelin:0.11.2 -f ./deploy/docker/zeppelin/Dockerfile-zeppelin .
130129

131130
# attaches to terminal (not run as daemon)
132-
run-zeppelin:
131+
run-zeppelin: build-zeppelin
133132
docker run --rm -p 8080:8080 \
134133
--volume=${HOME}/.kube/config:/opt/zeppelin/.kube/config \
135134
--add-host=docker-for-desktop:host-gateway \
136135
--name hoptimator-zeppelin \
137136
hoptimator-zeppelin
138137

139-
.PHONY: install test build bounce clean quickstart deploy-config undeploy-config deploy undeploy deploy-demo undeploy-demo deploy-samples undeploy-samples deploy-flink undeploy-flink deploy-kafka undeploy-kafka deploy-venice undeploy-venice build-zeppelin run-zeppelin integration-tests integration-tests-kind deploy-dev-environment undeploy-dev-environment generate-models release
138+
.PHONY: install test build bounce clean quickstart deploy-config undeploy-config deploy undeploy deploy-samples undeploy-samples deploy-flink undeploy-flink deploy-kafka undeploy-kafka deploy-venice undeploy-venice build-zeppelin run-zeppelin integration-tests integration-tests-kind deploy-dev-environment undeploy-dev-environment generate-models release

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Once the Flink deployment pod has STATUS 'Running', you can forward port 8081 an
8383
to access the Flink dashboard.
8484

8585
```
86-
$ kubectl port-forward basic-session-deployment-7b94b98b6b-d6jt5 8081 &
86+
$ kubectl port-forward svc/basic-session-deployment-rest 8081 &
8787
```
8888

8989
See the [Flink SQL Gateway Documentation](https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql-gateway/overview/)

deploy/docker/flink/docker-compose-sql-gateway.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ services:
33
image: flink:1.18.1
44
restart: unless-stopped
55
entrypoint: >
6-
/bin/sh -c "./bin/sql-gateway.sh start-foreground -Dsql-gateway.endpoint.rest.address=localhost"
6+
/bin/sh -c "./bin/sql-gateway.sh start-foreground -Dsql-gateway.endpoint.rest.address=localhost -Drest.address=host.docker.internal"
77
ports:
88
- 8083:8083
99
deploy:
1010
resources:
1111
limits:
1212
memory: 1024M
13+
extra_hosts:
14+
- "host.docker.internal:host-gateway"

deploy/docker/zeppelin/Dockerfile-zeppelin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM apache/zeppelin:0.11.2
33

44
# Add hoptimator fat jar to jdbc interpreter directory
5-
ADD ./hoptimator-jdbc-driver/build/libs/hoptimator-jdbc-driver-all.jar /opt/zeppelin/interpreter/jdbc/hoptimator-jdbc-driver-all.jar
5+
ADD ./hoptimator-jdbc-driver-int/build/libs/hoptimator-jdbc-driver-int-all.jar /opt/zeppelin/interpreter/jdbc/hoptimator-jdbc-driver-int-all.jar
66

77
# local copy of hoptimator-cli (for debugging)
88
ADD ./hoptimator-cli/build/install/hoptimator-cli /opt/hoptimator/hoptimator-cli/build/install/hoptimator-cli/

deploy/docker/zeppelin/interpreter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@
541541
],
542542
"dependencies": [
543543
{
544-
"groupArtifactVersion": "/opt/zeppelin/interpreter/jdbc/hoptimator-jdbc-driver-all.jar",
544+
"groupArtifactVersion": "/opt/zeppelin/interpreter/jdbc/hoptimator-jdbc-driver-int-all.jar",
545545
"local": false
546546
}
547547
],

deploy/samples/demodb.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,29 @@ spec:
2323
apiVersion: hoptimator.linkedin.com/v1alpha1
2424
kind: TableTemplate
2525
metadata:
26-
name: demodb-template
26+
name: demodb-read-template
2727
spec:
2828
databases:
2929
- profile-database
3030
- ads-database
31+
methods:
32+
- Scan
3133
connector: |
32-
connector = demo
33-
database = {{database}}
34-
table = {{table}}
34+
connector = datagen
35+
number-of-rows = 10
36+
37+
---
38+
39+
apiVersion: hoptimator.linkedin.com/v1alpha1
40+
kind: TableTemplate
41+
metadata:
42+
name: demodb-write-template
43+
spec:
44+
databases:
45+
- profile-database
46+
- ads-database
47+
methods:
48+
- Modify
49+
connector: |
50+
connector = blackhole
3551

deploy/samples/flinkDeployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
imagePullPolicy: Never
88
flinkVersion: v1_18
99
flinkConfiguration:
10-
taskmanager.numberOfTaskSlots: "3"
10+
taskmanager.numberOfTaskSlots: "6"
1111
serviceAccount: flink
1212
jobManager:
1313
resource:

deploy/samples/flinkengine.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: hoptimator.linkedin.com/v1alpha1
2+
kind: Engine
3+
metadata:
4+
name: flink-engine
5+
spec:
6+
url: jdbc:flink://localhost:8083
7+
dialect: Flink
8+

generate-models.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ docker run \
1616
-u "$(pwd)/hoptimator-k8s/src/main/resources/tabletemplates.crd.yaml" \
1717
-u "$(pwd)/hoptimator-k8s/src/main/resources/views.crd.yaml" \
1818
-u "$(pwd)/hoptimator-k8s/src/main/resources/subscriptions.crd.yaml" \
19+
-u "$(pwd)/hoptimator-k8s/src/main/resources/engines.crd.yaml" \
1920
&& echo "done."

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ flink-clients = "org.apache.flink:flink-clients:1.18.1"
88
flink-connector-base = "org.apache.flink:flink-connector-base:1.18.1"
99
flink-core = "org.apache.flink:flink-core:1.18.1"
1010
flink-csv = "org.apache.flink:flink-csv:1.18.1"
11+
flink-jdbc = "org.apache.flink:flink-sql-jdbc-driver-bundle:1.18.1"
1112
flink-streaming-java = "org.apache.flink:flink-streaming-java:1.18.1"
1213
flink-table-api-java = "org.apache.flink:flink-table-api-java:1.18.1"
1314
flink-table-api-java-bridge = "org.apache.flink:flink-table-api-java-bridge:1.18.1"

0 commit comments

Comments
 (0)