Skip to content

Commit

Permalink
chore(demo/nifi-kafka-druid-earthquake-data): Improve initialization …
Browse files Browse the repository at this point in the history
…jobs
  • Loading branch information
NickLarsenNZ committed Feb 27, 2025
1 parent de4ae6a commit 117fd66
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 3 deletions.
1 change: 1 addition & 0 deletions demos/demos-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ demos:
- s3
- earthquakes
manifests:
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/serviceaccount.yaml
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/create-nifi-ingestion-job.yaml
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/create-druid-ingestion-job.yaml
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/setup-superset.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@ metadata:
spec:
template:
spec:
serviceAccountName: demo-serviceaccount
initContainers:
- name: wait-for-druid-coordinator
image: oci.stackable.tech/sdp/tools:1.0.0-stackable0.0.0-dev
command:
- bash
- -euo
- pipefail
- -c
- |
echo 'Waiting for Druid Coordinator to be created'
kubectl wait --for=create pod/druid-coordinator-default-0
echo 'Waiting for Druid Coordinator to be ready'
kubectl wait --for=condition=Ready pod/druid-coordinator-default-0 --timeout=30m
containers:
- name: create-druid-ingestion-job
image: oci.stackable.tech/sdp/testing-tools:0.2.0-stackable0.0.0-dev
command: ["bash", "-c", "curl -X POST --insecure -H 'Content-Type: application/json' -d @/tmp/ingestion-job-spec/ingestion-job-spec.json https://druid-coordinator:8281/druid/indexer/v1/supervisor"]
command:
- bash
- -euo
- pipefail
- -c
- |
curl -X POST --insecure -H 'Content-Type: application/json' -d @/tmp/ingestion-job-spec/ingestion-job-spec.json https://druid-coordinator:8281/druid/indexer/v1/supervisor
volumeMounts:
- name: ingestion-job-spec
mountPath: /tmp/ingestion-job-spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,31 @@ metadata:
spec:
template:
spec:
serviceAccountName: demo-serviceaccount
initContainers:
- name: wait-for-nifi
image: oci.stackable.tech/sdp/tools:1.0.0-stackable0.0.0-dev
command:
- bash
- -euo
- pipefail
- -c
- |
echo 'Waiting for NiFi to be created'
kubectl wait --for=create pod/nifi-node-default-0 --timeout=30m
echo 'Waiting for NiFi to be ready'
kubectl wait --for=condition=Ready pod/nifi-node-default-0 --timeout=30m
containers:
- name: create-nifi-ingestion-job
image: oci.stackable.tech/sdp/testing-tools:0.2.0-stackable0.0.0-dev
command: ["bash", "-c", "curl -O https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/IngestEarthquakesToKafka.xml && python -u /tmp/script/script.py"]
command:
- bash
- -euo
- pipefail
- -c
- |
curl -O https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/IngestEarthquakesToKafka.xml
python -u /tmp/script/script.py
volumeMounts:
- name: script
mountPath: /tmp/script
Expand Down
47 changes: 47 additions & 0 deletions demos/nifi-kafka-druid-earthquake-data/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: demo-serviceaccount
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: demo-clusterrolebinding
subjects:
- kind: ServiceAccount
name: demo-serviceaccount
namespace: default
roleRef:
kind: ClusterRole
name: demo-clusterrole
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: demo-clusterrole
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
23 changes: 22 additions & 1 deletion demos/nifi-kafka-druid-earthquake-data/setup-superset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,31 @@ metadata:
spec:
template:
spec:
serviceAccountName: demo-serviceaccount
initContainers:
- name: wait-for-superset
image: oci.stackable.tech/sdp/tools:1.0.0-stackable0.0.0-dev
command:
- bash
- -euo
- pipefail
- -c
- |
echo 'Waiting for Superset to be created'
kubectl wait --for=create pod/superset-node-default-0 --timeout=30m
echo 'Waiting for Superset to be ready'
kubectl wait --for=condition=Ready pod/superset-node-default-0 --timeout=30m
containers:
- name: setup-superset
image: oci.stackable.tech/sdp/testing-tools:0.2.0-stackable0.0.0-dev
command: ["bash", "-c", "curl -o superset-assets.zip https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/superset-assets.zip && python -u /tmp/script/script.py"]
command:
- bash
- -euo
- pipefail
- -c
- |
curl -o superset-assets.zip https://raw.githubusercontent.com/stackabletech/demos/main/demos/nifi-kafka-druid-earthquake-data/superset-assets.zip
python -u /tmp/script/script.py
volumeMounts:
- name: script
mountPath: /tmp/script
Expand Down

0 comments on commit 117fd66

Please sign in to comment.