Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP hack-week #80

Draft
wants to merge 1 commit into
base: multi-region-active-active
Choose a base branch
from
Draft
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
33 changes: 33 additions & 0 deletions google/multi-region/active-active/firewall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

gcloud compute instances describe $(kubectl get nodes -o name --output jsonpath="{.items[0].metadata.name}") --zone europe-west1-b --format="get(tags.items)"

gcloud compute instances describe $(kubectl get nodes -o name --output jsonpath="{.items[0].metadata.name}") --zone us-east1-b --format="get(tags.items)"

gcloud compute firewall-rules create camunda-multi-region \
--allow=tcp:9600,tcp:26501,tcp:26502,tcp:9300,tcp:9200,udp:26502,udp:9200,udp:9300 \
--source-ranges="10.56.0.0/14,10.16.0.0/14" \
--target-tags="gke-falko-region-0-7218183c-node,gke-falko-region-1-01ced8cf-node" \
--description="Camunda cross-cluster TCP and UDP traffic" \
--project infrastructure-experience

# ---

gcloud storage buckets create gs://camunda-hackweek-elasticsearch-backup --project infrastructure-experience

gcloud iam service-accounts create camunda-hackweek-es-backup \
--description="Service account for camunda-hackweek-elasticsearch-backup bucket" \
--project infrastructure-experience


gcloud projects add-iam-policy-binding infrastructure-experience \
--member="serviceAccount:camunda-hackweek-es-backup@infrastructure-experience.iam.gserviceaccount.com" \
--role="roles/storage.admin"

gcloud iam service-accounts keys create ~/Downloads/camunda-hackweek-es-backup-key.json \
--iam-account=camunda-hackweek-es-backup@infrastructure-experience.iam.gserviceaccount.com

gcloud compute firewall-rules delete camunda-multi-region \
--project infrastructure-experience


kubectl exec camunda-elasticsearch-master-0 -n us-east1 -c elasticsearch -- curl -i camunda-zeebe-0:9600/actuator/exporting/pause -XPOST
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
namespace: kube-system
data:
stubDomains: |
{"us-east1.svc.cluster.local": ["35.243.201.145"], "us-east1-failover.svc.cluster.local": ["35.243.201.145"]}
{"us-east1.svc.cluster.local": ["34.148.175.163"], "us-east1-failover.svc.cluster.local": ["34.148.175.163"]}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
namespace: kube-system
data:
stubDomains: |
{"europe-west1.svc.cluster.local": ["8.34.209.179"], "europe-west1-failover.svc.cluster.local": ["8.34.209.179"]}
{"europe-west1.svc.cluster.local": ["34.38.191.213"], "europe-west1-failover.svc.cluster.local": ["34.38.191.213"]}
8 changes: 5 additions & 3 deletions google/multi-region/active-active/region0/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# Otherwise, these values will be used to create a new Cluster

# GCP project
project ?= camunda-researchanddevelopment
project ?= infrastructure-experience
# GCP region (see: https://cloud.withgoogle.com/region-picker/)
region ?= us-east1
# GKE cluster name
clusterName ?= falko-region-0
# GCP machine type
machineType ?= n2-standard-2
# GCP bucket name
backupBackupName ?= camunda-hackweek-elasticsearch-backup
minSize ?= 1
maxSize ?= 24

Expand Down Expand Up @@ -93,15 +95,15 @@ include $(root)/connectors/connectors.mk

.PHONY: elastic-nodes
elastic-nodes: use-kube
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -s http://localhost:9200/_nodes | python -m json.tool
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -s http://localhost:9200/_nodes | python3 -m json.tool

.PHONY: prepare-elastic-backup-key
prepare-elastic-backup-key: use-kube
kubectl create secret generic gcs-backup-key --from-file=gcs_backup_key.json=gcs_backup_key.json

.PHONY: prepare-elastic-backup-repo
prepare-elastic-backup-repo: use-kube
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -XPUT http://localhost:9200/_snapshot/camunda_backup -H 'Content-Type: application/json' -d'{"type": "gcs","settings":{"bucket": "falko-elasticsearch-backup", "base_path": "backups"}}'
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -XPUT http://localhost:9200/_snapshot/camunda_backup -H 'Content-Type: application/json' -d'{"type": "gcs","settings":{"bucket": "$(backupBackupName)", "base_path": "backups"}}'

.PHONY: operate-snapshot
operate-snapshot: use-kube
Expand Down
8 changes: 5 additions & 3 deletions google/multi-region/active-active/region1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# Otherwise, these values will be used to create a new Cluster

# GCP project
project ?= camunda-researchanddevelopment
project ?= infrastructure-experience
# GCP region (see: https://cloud.withgoogle.com/region-picker/)
region ?= europe-west1
# GKE cluster name
clusterName ?= falko-region-1
# GCP machine type
machineType ?= n2-standard-2
# GCP bucket name
backupBackupName ?= camunda-hackweek-elasticsearch-backup
minSize ?= 1
maxSize ?= 24

Expand Down Expand Up @@ -93,15 +95,15 @@ include $(root)/connectors/connectors.mk

.PHONY: elastic-nodes
elastic-nodes: use-kube
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -s http://localhost:9200/_nodes | python -m json.tool
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -s http://localhost:9200/_nodes | python3 -m json.tool

.PHONY: prepare-elastic-backup-key
prepare-elastic-backup-key: use-kube
kubectl create secret generic gcs-backup-key --from-file=gcs_backup_key.json=gcs_backup_key.json

.PHONY: prepare-elastic-backup-repo
prepare-elastic-backup-repo: use-kube
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -XPUT http://localhost:9200/_snapshot/camunda_backup -H 'Content-Type: application/json' -d'{"type": "gcs","settings":{"bucket": "falko-elasticsearch-backup", "base_path": "backups"}}'
kubectl exec camunda-elasticsearch-master-0 -n $(namespace) -c elasticsearch -- curl -XPUT http://localhost:9200/_snapshot/camunda_backup -H 'Content-Type: application/json' -d'{"type": "gcs","settings":{"bucket": "$(backupBackupName)", "base_path": "backups"}}'

.PHONY: operate-snapshot
operate-snapshot: use-kube
Expand Down
6 changes: 3 additions & 3 deletions google/multi-region/active-active/setup-dns-chaining.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import distutils.spawn
import json
Expand Down Expand Up @@ -28,8 +28,8 @@
# }
# TODO generate kubectl contexts via make using pattern: gke_$(project)_$(region)_$(clusterName)
contexts = {
'us-east1': 'gke_camunda-researchanddevelopment_us-east1_falko-region-0',
'europe-west1': 'gke_camunda-researchanddevelopment_europe-west1_falko-region-1',
'us-east1': 'gke_infrastructure-experience_us-east1_falko-region-0',
'europe-west1': 'gke_infrastructure-experience_europe-west1_falko-region-1',
}

# Fill in the number of Zeebe brokers per region,
Expand Down
4 changes: 2 additions & 2 deletions google/multi-region/active-active/teardown-dns-chaining.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# To get the names of your kubectl "contexts" for each of your clusters, run:
# kubectl config get-contexts
contexts = {
'us-east1': 'gke_camunda-researchanddevelopment_us-east1_falko-region-0',
'europe-west1': 'gke_camunda-researchanddevelopment_europe-west1_falko-region-1',
'us-east1': 'gke_infrastructure-experience_us-east1_falko-region-0',
'europe-west1': 'gke_infrastructure-experience_europe-west1_falko-region-1',
}

certs_dir = './certs'
Expand Down