Last active
October 30, 2018 17:47
-
-
Save ll911/2804196ed8b9e6f0c6a93a7f4bab6ffa to your computer and use it in GitHub Desktop.
rocketchat-k8s-stateful.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Template | |
| labels: | |
| template: rocketchat | |
| metadata: | |
| annotations: | |
| description: Template to deploy the RocketChat platform to OpenShift or K8S | |
| iconClass: icon-shadowman | |
| tags: quickstart,rocketchat | |
| name: rocketchat-k8s-mongodb | |
| objects: | |
| - apiVersion: v1 | |
| kind: Route | |
| metadata: | |
| annotations: | |
| description: Route for application's http service. | |
| labels: | |
| application: ${APPLICATION_NAME} | |
| name: ${APPLICATION_NAME} | |
| spec: | |
| host: "${HOSTNAME_HTTP}" | |
| to: | |
| name: ${APPLICATION_NAME} | |
| - apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| labels: | |
| application: ${APPLICATION_NAME} | |
| name: ${APPLICATION_NAME} | |
| spec: | |
| ports: | |
| - name: 3000-tcp | |
| port: 3000 | |
| protocol: TCP | |
| targetPort: 3000 | |
| selector: | |
| application: ${APPLICATION_NAME} | |
| deployment: ${APPLICATION_NAME} | |
| type: ClusterIP | |
| - apiVersion: v1 | |
| kind: Deployment | |
| metadata: | |
| labels: | |
| application: ${APPLICATION_NAME} | |
| name: ${APPLICATION_NAME} | |
| spec: | |
| replicas: 1 | |
| selector: | |
| application: ${APPLICATION_NAME} | |
| deployment: ${APPLICATION_NAME} | |
| template: | |
| metadata: | |
| labels: | |
| application: ${APPLICATION_NAME} | |
| deployment: ${APPLICATION_NAME} | |
| spec: | |
| containers: | |
| - env: | |
| - name: KUBERNETES_NAMESPACE | |
| valueFrom: | |
| fieldRef: | |
| fieldPath: metadata.namespace | |
| - name: Accounts_UseDNSDomainCheck | |
| value: "${ACCOUNT_DNS_DOMAIN_CHECK}" | |
| - name: ROOT_URL | |
| value: "http://${HOSTNAME_HTTP}" | |
| - name: MONGODB_USERNAME | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_USERNAME_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| - name: MONGODB_PASSWORD | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_PASSWORD_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| - name: MONGODB_ADMIN_USERNAME | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_ADMIN_USERNAME_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| - name: MONGODB_ADMIN_PASSWORD | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_ADMIN_PASSWORD_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| - name: MONGODB_DATABASE | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_DATABASE_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| - name: MONGODB_REPLICA_NAME | |
| valueFrom: | |
| secretKeyRef: | |
| key: ${MONGODB_REPLICA_NAME_SECRET_KEY} | |
| name: "${MONGODB_SECRET_NAME}" | |
| image: "${ROCKETCHAT_IMAGE_REGISTRY}:${ROCKETCHAT_IMAGE_TAG}" | |
| name: ${APPLICATION_NAME} | |
| command: | |
| - "/bin/bash" | |
| - "-c" | |
| - | | |
| # Set Environment Variables Required by RocketChat | |
| export MONGO_URL="mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_SERVICE}-0.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017,${MONGODB_SERVICE}-1.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017,${MONGODB_SERVICE}-2.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017/${MONGODB_DATABASE}?replicaSet=${MONGODB_REPLICA_NAME}" | |
| export MONGO_OPLOG_URL="mongodb://${MONGODB_ADMIN_USERNAME}:${MONGODB_ADMIN_PASSWORD}@${MONGODB_SERVICE}-0.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017,${MONGODB_SERVICE}-1.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017,${MONGODB_SERVICE}-2.${MONGODB_SERVICE}-internal.${KUBERNETES_NAMESPACE}.svc.cluster.local:27017/local?authSource=admin&replicaSet=${MONGODB_REPLICA_NAME}" | |
| # Run Application | |
| node main.js | |
| ports: | |
| - containerPort: 3000 | |
| protocol: TCP | |
| terminationMessagePath: /dev/termination-log | |
| livenessProbe: | |
| tcpSocket: | |
| port: 3000 | |
| initialDelaySeconds: 30 | |
| readinessProbe: | |
| tcpSocket: | |
| port: 3000 | |
| initialDelaySeconds: 10 | |
| resources: | |
| limits: | |
| memory: ${MEMORY_LIMIT} | |
| requests: | |
| memory: ${MEMORY_REQUEST} | |
| triggers: | |
| - type: ConfigChange | |
| status: {} | |
| parameters: | |
| - description: The name assigned to the application. | |
| displayName: Application Name | |
| name: APPLICATION_NAME | |
| required: true | |
| value: rocketchat | |
| - description: Hostname serving the application. | |
| displayName: Application Hostname | |
| name: HOSTNAME_HTTP | |
| required: true | |
| - description: Location of the RocketChat Image | |
| displayName: RocketChat Image | |
| name: ROCKETCHAT_IMAGE_REGISTRY | |
| value: rocket.chat | |
| required: true | |
| - description: Name of the RocketChat tag that should be used. | |
| displayName: RocketChat Tag | |
| name: ROCKETCHAT_IMAGE_TAG | |
| value: "latest" | |
| required: true | |
| - description: Name of the MongoDB Service. | |
| displayName: MongoDB Service Name | |
| name: MONGODB_SERVICE | |
| value: "mongodb" | |
| required: true | |
| - description: Amount of Memory to Request. | |
| displayName: Memory Request | |
| name: MEMORY_REQUEST | |
| value: "3Gi" | |
| required: true | |
| - description: Amount of Memory to Limit. | |
| displayName: Memory Limit | |
| name: MEMORY_LIMIT | |
| value: "4Gi" | |
| required: true | |
| - description: Account DNS Domain Check. | |
| displayName: Validate DNS of newly created users (true/false) | |
| name: ACCOUNT_DNS_DOMAIN_CHECK | |
| value: "true" | |
| required: true | |
| - displayName: MongoDB Secret. | |
| description: Name of the Secret containing MongoDB Assets | |
| name: MONGODB_SECRET_NAME | |
| value: "mongodb" | |
| required: true | |
| - displayName: MongoDB Username secret key. | |
| description: Name of the secret key containing the MongoDB username | |
| name: MONGODB_USERNAME_SECRET_KEY | |
| value: "username" | |
| required: true | |
| - displayName: MongoDB Password secret key. | |
| description: Name of the secret key containing the MongoDB password | |
| name: MONGODB_PASSWORD_SECRET_KEY | |
| value: "password" | |
| required: true | |
| - displayName: MongoDB Admin Username secret key. | |
| description: Name of the secret key containing the MongoDB admin username | |
| name: MONGODB_ADMIN_USERNAME_SECRET_KEY | |
| value: "admin-username" | |
| required: true | |
| - displayName: MongoDB Admin Password secret key. | |
| description: Name of the secret key containing the MongoDB admin password | |
| name: MONGODB_ADMIN_PASSWORD_SECRET_KEY | |
| value: "admin-password" | |
| required: true | |
| - displayName: MongoDB Database secret key. | |
| description: Name of the secret key containing the MongoDB database | |
| name: MONGODB_DATABASE_SECRET_KEY | |
| value: "database" | |
| required: true | |
| - displayName: MongoDB Replica Name secret key. | |
| description: Name of the secret key containing the MongoDB replica name | |
| name: MONGODB_REPLICA_NAME_SECRET_KEY | |
| value: "replica-name" | |
| required: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment