From 5a6f8b11fd14cadfe1fd73651f7c3d7955dee6d7 Mon Sep 17 00:00:00 2001 From: Mikael Saarinen Date: Tue, 25 Jan 2022 13:59:56 +0200 Subject: [PATCH] Persistent mongo-devicereg Signed-off-by: Mikael Saarinen --- 02_deployHono/modules/hono/main.tf | 12 ++++++------ 02_deployHono/modules/hono/mongo_values.yaml | 14 +++++++++++--- 02_deployHono/modules/hono/values.yaml | 2 +- 02_deployHono/modules/kafka/values.yaml | 2 +- 02_deployHono/modules/mongodb/values.yaml | 4 ++-- 02_deployHono/modules/persistent_storage/main.tf | 6 ++++++ 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/02_deployHono/modules/hono/main.tf b/02_deployHono/modules/hono/main.tf index 20b4cbe..580b25a 100644 --- a/02_deployHono/modules/hono/main.tf +++ b/02_deployHono/modules/hono/main.tf @@ -1,10 +1,10 @@ -# https://github.com/bitnami/azure-marketplace-charts/tree/a2342181bacffa6d27d265db187dcc938af1c3f0/bitnami/mongodb -resource "helm_release" "mongodb" { - name = "mongodb" +# https://github.com/bitnami/charts/tree/ac496766e033c7d068094122164ef318c46fba15/bitnami/mongodb +resource "helm_release" "mongodb-devicereg" { + name = "mongodb-devicereg" - repository = "https://marketplace.azurecr.io/helm/v1/repo" + repository = "https://charts.bitnami.com/bitnami" chart = "mongodb" - version = "~> 10.7.1" + version = "~> 10.31.3" cleanup_on_fail = "true" values = [ file("${path.module}/mongo_values.yaml") @@ -32,7 +32,7 @@ resource "helm_release" "hono" { chart = "hono" version = "1.9.8" cleanup_on_fail = "true" - depends_on = [helm_release.mongodb] + depends_on = [helm_release.mongodb-devicereg] values = [ file("${path.module}/values.yaml") ] diff --git a/02_deployHono/modules/hono/mongo_values.yaml b/02_deployHono/modules/hono/mongo_values.yaml index ff59239..5303931 100644 --- a/02_deployHono/modules/hono/mongo_values.yaml +++ b/02_deployHono/modules/hono/mongo_values.yaml @@ -1,12 +1,20 @@ architecture: "standalone" persistence: - existingClaim: "mongodb-data" -useStatefulSet: true + enabled: true + existingClaim: "mongopvc" + mountPath: /bitnami/mongodb + subPath: device-reg + accessModes: "ReadWriteMany" +#useStatefulSet: true metrics: enabled: true -replicaCount: 2 auth: database: "honodb" +volumePermissions: + enabled: true +service: + nameOverride: "mongodb-devicereg" + port: 27017 #architecture: "standalone" #useStatefulSet: true diff --git a/02_deployHono/modules/hono/values.yaml b/02_deployHono/modules/hono/values.yaml index 6342019..c248405 100644 --- a/02_deployHono/modules/hono/values.yaml +++ b/02_deployHono/modules/hono/values.yaml @@ -13,7 +13,7 @@ deviceRegistryExample: addExampleData: false mongoDBBasedDeviceRegistry: mongodb: - host: "mongodb" + host: "mongodb-devicereg" port: 27017 dbName: "honodb" adapters: diff --git a/02_deployHono/modules/kafka/values.yaml b/02_deployHono/modules/kafka/values.yaml index 7e2edc6..43bc06d 100644 --- a/02_deployHono/modules/kafka/values.yaml +++ b/02_deployHono/modules/kafka/values.yaml @@ -2,7 +2,7 @@ livenessProbe: initialDelaySeconds: 700 readinessProbe: initialDelaySeconds: 20 -logsDirs: /bitnami/kafka/data1 +logsDirs: /bitnami/kafka/data persistence: existingClaim: "kafkapvc" size: 5Gi diff --git a/02_deployHono/modules/mongodb/values.yaml b/02_deployHono/modules/mongodb/values.yaml index 2059c20..7e98d93 100644 --- a/02_deployHono/modules/mongodb/values.yaml +++ b/02_deployHono/modules/mongodb/values.yaml @@ -1,7 +1,7 @@ architecture: "replicaset" persistence: - enabled: true - existingClaim: "mongopvc" + enabled: false +# existingClaim: "mongopvc" useStatefulSet: true metrics: enabled: true diff --git a/02_deployHono/modules/persistent_storage/main.tf b/02_deployHono/modules/persistent_storage/main.tf index af22a1f..0a460bf 100644 --- a/02_deployHono/modules/persistent_storage/main.tf +++ b/02_deployHono/modules/persistent_storage/main.tf @@ -124,6 +124,12 @@ resource "kubernetes_persistent_volume" "mongo_volume" { access_modes = ["ReadWriteMany"] storage_class_name = kubernetes_storage_class.azure_file_retain.metadata.0.name persistent_volume_reclaim_policy = "Retain" + mount_options = ["dir_mode=0777", + "file_mode=0777", + "uid=1001", + "gid=1001", + "mfsymlinks", + "nobrl"] persistent_volume_source { azure_file { secret_name = kubernetes_secret.storage_secret.metadata.0.name