diff --git a/.github/workflows/helm_deploy_kafka.yaml b/.github/workflows/helm_deploy_kafka.yaml new file mode 100644 index 0000000..b168b8c --- /dev/null +++ b/.github/workflows/helm_deploy_kafka.yaml @@ -0,0 +1,54 @@ +name: Helm Kafka deployment + +on: + workflow_dispatch: + pull_request: + branches: + - main + paths: + - ".github/workflows/helm_deploy_kafka.yaml" + - "infra/helm/kafka/**" + +jobs: + helm_deploy: + name: "Deploy Kafka" + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + id: checkout_repo + uses: actions/checkout@v2 + + - name: Login to Azure + id: login_to_azure + run: | + az login \ + --service-principal \ + -u ${{ secrets.AZURE_SERVICE_PRINCIPAL_APP_ID }} \ + -p ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} \ + --tenant ${{ secrets.AZURE_TENANT_ID }} + + - name: Get AKS credentials + id: get_aks_credentials + run: | + az aks get-credentials \ + --resource-group "rg${{ secrets.PROJECT }}main${{ secrets.INSTANCE }}" \ + --name "aks${{ secrets.PROJECT }}main${{ secrets.INSTANCE }}" \ + --overwrite-existing + + - name: Install Helm + id: install_helm + uses: azure/setup-helm@v3 + with: + version: "v3.11.1" + + - name: Deploy Helm chart + id: deploy_helm_chart + run: | + bash ./infra/helm/kafka/deploy.sh + + - name: Logout of Azure + id: logout_from_azure + if: always() + run: | + az logout diff --git a/infra/helm/kafka/README.md b/infra/helm/kafka/README.md new file mode 100644 index 0000000..35712f2 --- /dev/null +++ b/infra/helm/kafka/README.md @@ -0,0 +1,3 @@ +# Kafka + +To be implemented... diff --git a/infra/helm/kafka/deploy.sh b/infra/helm/kafka/deploy.sh new file mode 100644 index 0000000..c3f66da --- /dev/null +++ b/infra/helm/kafka/deploy.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +### Set variables +declare -A kafka +kafka["name"]="kafka" +kafka["namespace"]="opsteam" + +################### +### Deploy Helm ### +################### + +# Add helm repos +helm repo add bitnami https://charts.bitnami.com/bitnami +helm repo update + +# kafka +helm upgrade ${kafka[name]} \ + --install \ + --wait \ + --debug \ + --create-namespace \ + --namespace=${kafka[namespace]} \ + --set listeners.client.protocol=PLAINTEXT \ + --set provisioning.enabled=true \ + --set provisioning.topics[0].name="dotnet" \ + --set provisioning.topics[0].partitions=3 \ + --set provisioning.topics[1].name="golang" \ + --set provisioning.topics[1].partitions=3 \ + --set provisioning.topics[2].name="java" \ + --set provisioning.topics[2].partitions=3 \ + --set provisioning.topics[3].name="javascript" \ + --set provisioning.topics[4].partitions=3 \ + --set provisioning.topics[5].name="python" \ + --set provisioning.topics[5].partitions=3 \ + --version "26.6.2" \ + "bitnami/kafka"