diff --git a/Makefile b/Makefile index 1266f05e..e9f0509e 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,9 @@ container_tool ?= podman # when it is accessed from outside the cluster and when it is accessed from # inside the cluster. We need the external name to push the image, and the # internal name to pull it. -external_image_registry:=default-route-openshift-image-registry.apps-crc.testing -internal_image_registry:=image-registry.openshift-image-registry.svc:5000 +external_apps_domain?=apps-crc.testing +external_image_registry?=default-route-openshift-image-registry.$(external_apps_domain) +internal_image_registry?=image-registry.openshift-image-registry.svc:5000 # The name of the image repository needs to start with the name of an existing # namespace because when the image is pushed to the internal registry of a diff --git a/templates/db-template.yml b/templates/db-template.yml index 828d5a47..7095964b 100644 --- a/templates/db-template.yml +++ b/templates/db-template.yml @@ -2,24 +2,19 @@ apiVersion: v1 kind: Template metadata: + name: trex-db annotations: - description: PostgreSQL database service for use with the rh-trex + description: PostgreSQL database service for use with the RH Trex service iconClass: icon-postgresql - openshift.io/display-name: Example Service PostgreSQL Database + openshift.io/display-name: RH Trex PostgreSQL Database tags: database,postgresql - name: trex-db parameters: - - name: POSTGRESQL_IMAGESTREAM_NAMESPACE - description: The OpenShift Namespace where the ImageStream resides. - displayName: Namespace - value: openshift - - name: DATABASE_SERVICE_NAME description: The name of the OpenShift Service exposed for the database. displayName: Database Service Name required: true - value: trex-db + value: trex-db - name: DATABASE_USER description: Username for PostgreSQL user that will be used for accessing the database. @@ -49,7 +44,7 @@ parameters: description: Version of PostgreSQL image to be used (10 or latest). displayName: Version of PostgreSQL Image required: true - value: "10" + value: "16.2" objects: @@ -72,6 +67,7 @@ objects: type: ClusterIP status: loadBalancer: {} + - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -82,8 +78,9 @@ objects: resources: requests: storage: ${DATABASE_VOLUME_CAPACITY} - - apiVersion: v1 - kind: DeploymentConfig + + - apiVersion: apps/v1 + kind: Deployment metadata: annotations: template.alpha.openshift.io/wait-for-ready: true @@ -91,7 +88,8 @@ objects: spec: replicas: 1 selector: - name: ${DATABASE_SERVICE_NAME} + matchLabels: + name: ${DATABASE_SERVICE_NAME} strategy: type: Recreate template: @@ -102,28 +100,28 @@ objects: containers: - capabilities: {} env: - - name: POSTGRESQL_USER + - name: POSTGRES_USER valueFrom: secretKeyRef: - key: database-user + key: db.user name: ${DATABASE_SERVICE_NAME} - - name: POSTGRESQL_PASSWORD + - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - key: database-password + key: db.password name: ${DATABASE_SERVICE_NAME} - - name: POSTGRESQL_DATABASE + - name: POSTGRES_DB valueFrom: secretKeyRef: - key: database-name + key: db.name name: ${DATABASE_SERVICE_NAME} - image: "" + - name: PGDATA + value: /var/lib/pgsql/data/pgdata + image: docker.io/library/postgres:${POSTGRESQL_VERSION} imagePullPolicy: IfNotPresent livenessProbe: - exec: - command: - - /usr/libexec/check-container - - --live + tcpSocket: + port: 5432 initialDelaySeconds: 120 timeoutSeconds: 10 name: postgresql @@ -133,12 +131,11 @@ objects: readinessProbe: exec: command: - - /usr/libexec/check-container + - /bin/sh + - -c + - exec /usr/bin/pg_isready -U $POSTGRES_USER -d $POSTGRES_DB -h localhost -p 5432 initialDelaySeconds: 5 timeoutSeconds: 1 - securityContext: - capabilities: {} - privileged: false terminationMessagePath: /dev/termination-log volumeMounts: - mountPath: /var/lib/pgsql/data @@ -147,31 +144,18 @@ objects: restartPolicy: Always volumes: - name: ${DATABASE_SERVICE_NAME}-data + #emptyDir: {} persistentVolumeClaim: claimName: ${DATABASE_SERVICE_NAME} - triggers: - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - postgresql - from: - kind: ImageStreamTag - name: postgresql:${POSTGRESQL_VERSION} - namespace: ${POSTGRESQL_IMAGESTREAM_NAMESPACE} - - type: ConfigChange status: {} - apiVersion: v1 kind: Secret metadata: - annotations: - template.openshift.io/expose-database_name: "{.data['database-name']}" - template.openshift.io/expose-password: "{.data['database-password']}" - template.openshift.io/expose-username: "{.data['database-user']}" name: ${DATABASE_SERVICE_NAME} stringData: - database-name: ${DATABASE_NAME} - database-password: ${DATABASE_PASSWORD} - database-user: ${DATABASE_USER} - + db.host: ${DATABASE_SERVICE_NAME} + db.name: ${DATABASE_NAME} + db.password: ${DATABASE_PASSWORD} + db.user: ${DATABASE_USER} + db.port: "5432" diff --git a/templates/route-template.yml b/templates/route-template.yml index b3006a8d..4e8fe634 100644 --- a/templates/route-template.yml +++ b/templates/route-template.yml @@ -1,7 +1,7 @@ --- apiVersion: v1 kind: Template -name: uhc-acct-mangr-routes +name: trex-routes metadata: name: route @@ -14,7 +14,8 @@ objects: labels: app: trex spec: - host: trex.apps-crc.testing +# The cluster should assign a suitable host. If using CRC, it may be necessary to define one manually: +# host: trex.apps-crc.testing to: kind: Service name: trex