From 6a5adf3bd8c433b046692a871a85dbdcbc47ee77 Mon Sep 17 00:00:00 2001 From: Igor Koshchyts <125358482+igorchyts@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:15:52 -0800 Subject: [PATCH] single replica mongodb example (#65) --- examples/mongodb/{ => helm}/Chart.yaml | 0 examples/mongodb/{ => helm}/README.md | 2 +- .../{ => helm}/scripts/mongodb-start.sh | 0 .../{ => helm}/templates/mongodb-config.yaml | 0 .../{ => helm}/templates/mongodb-start.yaml | 0 .../mongodb/{ => helm}/templates/mongodb.yaml | 0 examples/mongodb/{ => helm}/values.yaml | 0 examples/mongodb/single-replica/manifest.yaml | 101 ++++++++++++++++++ 8 files changed, 102 insertions(+), 1 deletion(-) rename examples/mongodb/{ => helm}/Chart.yaml (100%) rename examples/mongodb/{ => helm}/README.md (96%) rename examples/mongodb/{ => helm}/scripts/mongodb-start.sh (100%) rename examples/mongodb/{ => helm}/templates/mongodb-config.yaml (100%) rename examples/mongodb/{ => helm}/templates/mongodb-start.yaml (100%) rename examples/mongodb/{ => helm}/templates/mongodb.yaml (100%) rename examples/mongodb/{ => helm}/values.yaml (100%) create mode 100644 examples/mongodb/single-replica/manifest.yaml diff --git a/examples/mongodb/Chart.yaml b/examples/mongodb/helm/Chart.yaml similarity index 100% rename from examples/mongodb/Chart.yaml rename to examples/mongodb/helm/Chart.yaml diff --git a/examples/mongodb/README.md b/examples/mongodb/helm/README.md similarity index 96% rename from examples/mongodb/README.md rename to examples/mongodb/helm/README.md index e7cad69..a7babdc 100644 --- a/examples/mongodb/README.md +++ b/examples/mongodb/helm/README.md @@ -9,7 +9,7 @@ Supported MongoDB versions for the chart: 4.4.29, 5, 6, 7 The [Helm CLI](https://helm.sh/docs/intro/install/#through-package-managers) and [Control Plane CLI](https://docs.controlplane.com/reference/cli#install-npm) must be installed. -1. Clone this repo and update the [values.yaml](./values.yaml) file as needed. +1. Clone this repo and update the [values.yaml](helm/values.yaml) file as needed. 2. If advanced replica-set configuration is required, make sure to edit [mongodb-config.yaml](./templates/mongodb-config.yaml) file in templates directory. Please refer to [MongoDB documentation](https://www.mongodb.com/docs/v7.0/reference/replica-configuration/#replica-set-configuration-document) for further instructions. diff --git a/examples/mongodb/scripts/mongodb-start.sh b/examples/mongodb/helm/scripts/mongodb-start.sh similarity index 100% rename from examples/mongodb/scripts/mongodb-start.sh rename to examples/mongodb/helm/scripts/mongodb-start.sh diff --git a/examples/mongodb/templates/mongodb-config.yaml b/examples/mongodb/helm/templates/mongodb-config.yaml similarity index 100% rename from examples/mongodb/templates/mongodb-config.yaml rename to examples/mongodb/helm/templates/mongodb-config.yaml diff --git a/examples/mongodb/templates/mongodb-start.yaml b/examples/mongodb/helm/templates/mongodb-start.yaml similarity index 100% rename from examples/mongodb/templates/mongodb-start.yaml rename to examples/mongodb/helm/templates/mongodb-start.yaml diff --git a/examples/mongodb/templates/mongodb.yaml b/examples/mongodb/helm/templates/mongodb.yaml similarity index 100% rename from examples/mongodb/templates/mongodb.yaml rename to examples/mongodb/helm/templates/mongodb.yaml diff --git a/examples/mongodb/values.yaml b/examples/mongodb/helm/values.yaml similarity index 100% rename from examples/mongodb/values.yaml rename to examples/mongodb/helm/values.yaml diff --git a/examples/mongodb/single-replica/manifest.yaml b/examples/mongodb/single-replica/manifest.yaml new file mode 100644 index 0000000..f01eb58 --- /dev/null +++ b/examples/mongodb/single-replica/manifest.yaml @@ -0,0 +1,101 @@ +kind: secret +name: mongodb-development-secret +description: mongodb-development-secret +tags: {} +type: dictionary +data: + password: mongodbsecret1 + username: mongodb +--- +kind: identity +name: mongodb +description: mongodb +tags: {} +--- +kind: policy +name: mongodb-development-policy +description: mongodb-development-policy +tags: {} +bindings: + - permissions: + - reveal + principalLinks: + - //gvc/development/identity/mongodb +targetKind: secret +targetLinks: + - //secret/mongodb-development-secret +--- +kind: volumeset +name: mongodb +description: mongodb +tags: {} +spec: + fileSystemType: ext4 + initialCapacity: 50 + performanceClass: general-purpose-ssd + snapshots: + createFinalSnapshot: true + retentionDuration: 7d +--- +kind: workload +name: mongodb +description: mongodb +tags: {} +spec: + type: stateful + containers: + - name: mongo + cpu: 200m + env: + - name: MONGO_INITDB_DATABASE + value: exampledb1 + - name: MONGO_INITDB_PWD + value: cpln://secret/mongodb-development-secret.password + - name: MONGO_INITDB_ROOT_PASSWORD + value: cpln://secret/mongodb-development-secret.password + - name: MONGO_INITDB_ROOT_USERNAME + value: cpln://secret/mongodb-development-secret.username + - name: MONGO_INITDB_USER + value: cpln://secret/mongodb-development-secret.username + image: mongo:6.0 + inheritEnv: false + memory: 250Mi + ports: + - number: 27017 + protocol: tcp + volumes: + - path: /data/db + recoveryPolicy: retain + uri: cpln://volumeset/mongodb + defaultOptions: + autoscaling: + maxConcurrency: 0 + maxScale: 3 + metric: cpu + minScale: 1 + scaleToZeroDelay: 300 + target: 100 + capacityAI: false + debug: false + suspend: false + timeoutSeconds: 60 + firewallConfig: + external: + inboundAllowCIDR: [] + outboundAllowCIDR: + - 0.0.0.0/0 + outboundAllowHostname: [] + outboundAllowPort: [] + internal: + inboundAllowType: same-gvc + inboundAllowWorkload: [] + identityLink: //gvc/development/identity/mongodb + loadBalancer: + direct: + enabled: true + ports: + - containerPort: 27017 + externalPort: 27017 + protocol: TCP + scheme: tcp + supportDynamicTags: false \ No newline at end of file