diff --git a/deployments/mongo-deployment.yaml b/deployments/mongo-deployment.yaml index 4cc51d5..d9f32d5 100644 --- a/deployments/mongo-deployment.yaml +++ b/deployments/mongo-deployment.yaml @@ -4,6 +4,8 @@ metadata: labels: name: mongo name: mongo + annotations: + source: "https://github.com/saintdle/pacman-tanzu" spec: replicas: 1 selector: @@ -14,20 +16,56 @@ spec: labels: name: mongo spec: + initContainers: + - args: + - | + mkdir -p /bitnami/mongodb + chown -R "1001:1001" "/bitnami/mongodb" + command: + - /bin/bash + - -ec + image: docker.io/bitnami/bitnami-shell:10-debian-10-r158 + imagePullPolicy: Always + name: volume-permissions + resources: {} + securityContext: + runAsUser: 0 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /bitnami/mongodb + name: mongo-db + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + fsGroup: 1001 + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + volumes: + - name: mongo-db + persistentVolumeClaim: + claimName: mongo-storage containers: - - image: centos/mongodb-36-centos7 + - image: bitnami/mongodb:4.4.8 name: mongo env: - - name: MONGODB_ADMIN_PASSWORD - value: clyde + - name: MONGODB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: database-admin-password + name: mongodb-users-secret - name: MONGODB_DATABASE - value: pacman + valueFrom: + secretKeyRef: + key: database-name + name: mongodb-users-secret - name: MONGODB_PASSWORD valueFrom: secretKeyRef: key: database-password name: mongodb-users-secret - - name: MONGODB_USER + - name: MONGODB_USERNAME valueFrom: secretKeyRef: key: database-user @@ -38,16 +76,15 @@ spec: - /bin/sh - -i - -c - - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD + - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USERNAME -p $MONGODB_PASSWORD --eval="quit()" ports: - name: mongo containerPort: 27017 volumeMounts: - name: mongo-db - mountPath: /data/db + mountPath: /bitnami/mongodb/ volumes: - name: mongo-db persistentVolumeClaim: - claimName: mongo-storage - + claimName: mongo-storage \ No newline at end of file diff --git a/deployments/pacman-deployment.yaml b/deployments/pacman-deployment.yaml index 2c50044..fb60230 100644 --- a/deployments/pacman-deployment.yaml +++ b/deployments/pacman-deployment.yaml @@ -4,6 +4,8 @@ metadata: labels: name: pacman name: pacman + annotations: + source: "https://github.com/saintdle/pacman-tanzu" spec: replicas: 1 selector: @@ -46,4 +48,4 @@ spec: valueFrom: fieldRef: apiVersion: v1 - fieldPath: spec.nodeName + fieldPath: spec.nodeName diff --git a/persistentvolumeclaim/mongo-pvc.yaml b/persistentvolumeclaim/mongo-pvc.yaml index 6eb17da..cfeb0c4 100644 --- a/persistentvolumeclaim/mongo-pvc.yaml +++ b/persistentvolumeclaim/mongo-pvc.yaml @@ -2,6 +2,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: mongo-storage + namespace: pacman spec: accessModes: - ReadWriteOnce diff --git a/security/secret.yaml b/security/secret.yaml index 44cfe1d..57544b0 100644 --- a/security/secret.yaml +++ b/security/secret.yaml @@ -3,9 +3,10 @@ apiVersion: v1 kind: Secret metadata: name: mongodb-users-secret - namespace: pacman + namespace: pacman-052 type: Opaque data: + database-admin-name: Y2x5ZGU= database-admin-password: Y2x5ZGU= database-name: cGFjbWFu database-password: cGlua3k=