kind: Template apiVersion: v1 metadata: name: startx-postgres-deploy-template annotations: openshift.io/display-name: Startx PostgreSQL Server (ephemeral deploy workflow) description: Deployement workflow of a PostgreSQL database using ephemeral storage for data and logs records. Use postgres with various underlying linux distribution. See https://hub.docker.com/r/startx/sv-postgres iconClass: icon-postgresql tags: startx,os,fedora,postgres,sql openshift.io/provider-display-name: STARTX openshift.io/documentation-url: https://hub.docker.com/r/startx/sv-postgres openshift.io/support-url: https://gitlab.com/startx1/containers/issues/new message: |- Your ephemeral database ${APP_NAME} will be soon deployed. Monitor the deployement for database availability Database : ${APP_NAME} Stage : ${APP_STAGE} Image : startx/sv-postgres:${BUILDER_TAG} Volumes : ${APP_NAME}-data (E) Username : ${PGSQL_USER} Password : ${PGSQL_PASSWORD} Database : ${PGSQL_DATABASE} Connection : pgsql://${APP_NAME}:5432 labels: template: startx-postgres-deploy-template provider: startx objects: - kind: ImageStream apiVersion: v1 metadata: name: "${APP_NAME}" annotations: openshift.io/display-name: Database ${APP_NAME} openshift.io/generated-by: STARTX labels: app: "${APP_NAME}" stage: "${APP_STAGE}" spec: tags: - name: ${APP_STAGE} annotations: openshift.io/display-name: Database ${APP_NAME} version ${APP_STAGE} description: ${APP_STAGE} image for the database ${APP_NAME} based on ${BUILDER_TAG} iconClass: icon-postgresql tags: startx,fedora,postgres,sql,database,${APP_NAME},${APP_STAGE},${BUILDER_TAG} supports: pgsql version: ${APP_STAGE} from: kind: DockerImage name: startx/sv-postgres:${BUILDER_TAG} - kind: ConfigMap apiVersion: v1 metadata: name: "${APP_NAME}-config" annotations: openshift.io/display-name: Database ${APP_NAME} configuration openshift.io/generated-by: STARTX labels: app: "${APP_NAME}" stage: "${APP_STAGE}" data: SX_ID: ${APP_NAME}/${APP_STAGE} SX_TYPE: ${APP_STAGE} SX_SERVICE: ${APP_NAME} SX_NAME: PostgreSQL database ${APP_NAME} SX_SUMMARY: PostgreSQL database ${APP_NAME} based on ${BUILDER_TAG} container SX_VERSION: 0.0.1 - kind: Secret apiVersion: v1 metadata: name: "${APP_NAME}-auth" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: template.openshift.io/expose-username: "{.data['PGSQL_USER']}" template.openshift.io/expose-password: "{.data['PGSQL_PASSWORD']}" template.openshift.io/expose-root_password: "{.data['PGSQL_PASSWORD']}" stringData: PGSQL_ROOT_PASSWORD: "${PGSQL_ROOT_PASSWORD}" PGSQL_USER: "${PGSQL_USER}" PGSQL_PASSWORD: "${PGSQL_PASSWORD}" - kind: DeploymentConfig apiVersion: v1 metadata: name: "${APP_NAME}" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: openshift.io/generated-by: STARTX spec: strategy: type: Recreate recreateParams: timeoutSeconds: 90 triggers: - type: ImageChange imageChangeParams: automatic: true containerNames: - "${APP_NAME}" from: kind: ImageStreamTag name: "${APP_NAME}:${APP_STAGE}" - type: ConfigChange postCommit: script: "/bin/sx-postgres info" replicas: 1 test: false selector: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" template: metadata: labels: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" annotations: openshift.io/generated-by: STARTX spec: containers: - name: "${APP_NAME}" image: " " env: - name: SX_VERBOSE value: "true" - name: PGSQL_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: PGSQL_USER - name: PGSQL_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: PGSQL_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config command: - "/bin/sx-postgres" args: - run resources: limits: cpu: 8000m memory: 1024Mi requests: cpu: 200m memory: 256Mi ports: - containerPort: 5432 protocol: TCP livenessProbe: exec: command: - "/bin/sx-postgres" - isLive initialDelaySeconds: 10 timeoutSeconds: 2 periodSeconds: 10 successThreshold: 1 failureThreshold: 4 readinessProbe: exec: command: - "/bin/sx-postgres" - isReady initialDelaySeconds: 10 timeoutSeconds: 2 periodSeconds: 10 successThreshold: 1 failureThreshold: 4 terminationMessagePath: "/dev/termination-log" imagePullPolicy: Always volumeMounts: - name: "${APP_NAME}-data" mountPath: "/data" volumes: - name: "${APP_NAME}-data" emptyDir: medium: "" restartPolicy: Always terminationGracePeriodSeconds: 30 securityContext: {} dnsPolicy: ClusterFirst - kind: Service apiVersion: v1 metadata: name: "${APP_NAME}" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: openshift.io/generated-by: STARTX spec: ports: - protocol: TCP port: 5432 targetPort: 5432 selector: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" type: ClusterIP sessionAffinity: None parameters: - name: APP_NAME displayName: Database name description: The name of the created database value: postgres required: true - name: APP_STAGE displayName: Database stage description: "Stage of the database deployed (ex: dev, test, prod, example, demo, poc, ...)" value: example required: true - name: BUILDER_TAG displayName: Startx image release description: "Image tag of the startx postgres image used. Could be : latest, fc34, fc33, fc32, fc31, fc30, fc29, fc28, alpine3, ubi8, centos8, centos7, centos6, alma8, rocky8" value: latest required: true - name: PGSQL_ROOT_PASSWORD displayName: Postgres root password description: The postgresql root password to use. Generated if not provided from: "[A-Z0-9]{16}" generate: expression - name: PGSQL_USER displayName: Postgres user description: Default user to create value: demo from: "[A-Z0-9]{8}" generate: expression - name: PGSQL_PASSWORD displayName: Postgres password description: Password of the default user value: demo from: "[A-Z0-9]{16}" generate: expression - name: PGSQL_DATABASE displayName: Postgres database description: name of the default database to create value: example