From a88cc49ae2fd1493592ae00e3a9b5abfea41274c Mon Sep 17 00:00:00 2001 From: Tiago Alves Macambira Date: Mon, 18 Sep 2023 11:55:07 -0700 Subject: [PATCH] Also deploy workflow-gen with bicep template. Current bicep template does not register or deploys the workflow-gen app. This fixes that. Signed-off-by: Tiago Alves Macambira --- deploy/aks/apps/workflow-gen-deploy.bicep | 80 +++++++++++++++++++++++ deploy/aks/main.bicep | 36 +++++++--- 2 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 deploy/aks/apps/workflow-gen-deploy.bicep diff --git a/deploy/aks/apps/workflow-gen-deploy.bicep b/deploy/aks/apps/workflow-gen-deploy.bicep new file mode 100644 index 00000000..c634ed19 --- /dev/null +++ b/deploy/aks/apps/workflow-gen-deploy.bicep @@ -0,0 +1,80 @@ +@secure() +param kubeConfig string +param kubernetesNamespace string + +import 'kubernetes@1.0.0' with { + namespace: 'default' + kubeConfig: kubeConfig +} + +resource coreService_workflowGen 'core/Service@v1' = { + metadata: { + name: 'workflow-gen' + labels: { + app: 'workflow-gen' + } + namespace: kubernetesNamespace + } + spec: { + selector: { + app: 'workflow-gen' + } + ports: [ + { + protocol: 'TCP' + port: 9988 + targetPort: 9988 + } + ] + type: 'ClusterIP' + } +} + +resource appsDeployment_workflowGenApp 'apps/Deployment@v1' = { + metadata: { + name: 'workflow-gen-app' + labels: { + app: 'workflow-gen' + } + namespace: kubernetesNamespace + } + spec: { + replicas: 1 + selector: { + matchLabels: { + app: 'workflow-gen' + } + } + template: { + metadata: { + labels: { + app: 'workflow-gen' + } + annotations: { + 'dapr.io/enabled': 'true' + 'dapr.io/app-id': 'workflow-gen' + 'dapr.io/log-as-json': 'true' + 'prometheus.io/scrape': 'true' + 'prometheus.io/port': '9988' + } + } + spec: { + containers: [ + { + name: 'workflow-gen' + image: 'daprtests.azurecr.io/workflow-gen:dev' + ports: [ + // This app does NOT expose an HTTP application port (so no 80 or 3000 port mapping here) + // This app exposes a Prometheus metrics endpoint on port 9988 + { + name: 'prom' + containerPort: 9988 + } + ] + imagePullPolicy: 'Always' + } + ] + } + } + } +} diff --git a/deploy/aks/main.bicep b/deploy/aks/main.bicep index 76793451..4436d5f1 100644 --- a/deploy/aks/main.bicep +++ b/deploy/aks/main.bicep @@ -284,10 +284,8 @@ module hashtagCounter 'apps/hashtag-counter-deploy.bicep' = { ] } - - -module pubsubWorkflowApp 'apps/pubsub-workflow-deploy.bicep' = { - name: '${clusterName}--app--pubsub-workflow' +module snapshotApp 'apps/snapshot-deploy.bicep' = { + name: '${clusterName}--app--snapshot' params: { kubeConfig: aks.listClusterAdminCredential().kubeconfigs[0].value kubernetesNamespace: longhaulNamespace.outputs.kubernetesNamespace @@ -296,11 +294,27 @@ module pubsubWorkflowApp 'apps/pubsub-workflow-deploy.bicep' = { daprExtension longhaulNamespace pubSubComponent + hashtagActor ] } -module snapshotApp 'apps/snapshot-deploy.bicep' = { - name: '${clusterName}--app--snapshot' +module validationWorker 'apps/validation-worker-deploy.bicep' = { + name: '${clusterName}--app--validation-worker' + params: { + kubeConfig: aks.listClusterAdminCredential().kubeconfigs[0].value + kubernetesNamespace: longhaulNamespace.outputs.kubernetesNamespace + } + dependsOn: [ + daprExtension + longhaulNamespace + snapshotApp + ] +} + +// The pub-sub workflow application is independent from the others + +module pubsubWorkflowApp 'apps/pubsub-workflow-deploy.bicep' = { + name: '${clusterName}--app--pubsub-workflow' params: { kubeConfig: aks.listClusterAdminCredential().kubeconfigs[0].value kubernetesNamespace: longhaulNamespace.outputs.kubernetesNamespace @@ -309,12 +323,14 @@ module snapshotApp 'apps/snapshot-deploy.bicep' = { daprExtension longhaulNamespace pubSubComponent - hashtagActor ] } -module validationWorker 'apps/validation-worker-deploy.bicep' = { - name: '${clusterName}--app--validation-worker' + +// The Workflow Generation application is independent from the others + +module workflowGenApp 'apps/workflow-gen-deploy.bicep' = { + name: '${clusterName}--app--workflow-gen' params: { kubeConfig: aks.listClusterAdminCredential().kubeconfigs[0].value kubernetesNamespace: longhaulNamespace.outputs.kubernetesNamespace @@ -322,6 +338,6 @@ module validationWorker 'apps/validation-worker-deploy.bicep' = { dependsOn: [ daprExtension longhaulNamespace - snapshotApp + statestoreComponent ] }