From 440edef90eceefd896c2db55d9e52dbc139d1aea Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 31 Oct 2023 15:19:40 -0400 Subject: [PATCH 01/11] chore(db): update references to split-out database container --- db/Dockerfile | 8 -------- db/build.sh | 10 ---------- db/entrypoint.bash | 9 --------- db/include/postgresql-cfg/pgcrypto.conf | 1 - db/include/postgresql-init/pgcrypto.sh | 3 --- smoketest/compose/db.yml | 3 +-- smoketest/compose/db_k8s.yml | 3 +-- smoketest/k8s/db-deployment.yaml | 2 +- smoketest/k8s/smoketest.bash | 4 ++-- src/main/resources/application-dev.properties | 2 +- src/main/resources/application-test.properties | 2 +- 11 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 db/Dockerfile delete mode 100755 db/build.sh delete mode 100755 db/entrypoint.bash delete mode 100644 db/include/postgresql-cfg/pgcrypto.conf delete mode 100755 db/include/postgresql-init/pgcrypto.sh diff --git a/db/Dockerfile b/db/Dockerfile deleted file mode 100644 index d9b41142e..000000000 --- a/db/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM quay.io/sclorg/postgresql-15-c8s:latest - -ENTRYPOINT ["/usr/local/bin/cryostat-db-entrypoint.bash"] - -ENV POSTGRESQL_LOG_DESTINATION=/dev/stderr - -COPY ./entrypoint.bash /usr/local/bin/cryostat-db-entrypoint.bash -COPY ./include /opt/app-root/src/ diff --git a/db/build.sh b/db/build.sh deleted file mode 100755 index a01439def..000000000 --- a/db/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -DIR="$(dirname "$(readlink -f "$0")")" - -if [ -z "${BUILDER}" ]; then - BUILDER=podman -fi - -${BUILDER} build --pull -t quay.io/cryostat/cryostat3-db:latest -f "${DIR}/Dockerfile" "${DIR}" -${BUILDER} tag quay.io/cryostat/cryostat3-db:latest quay.io/cryostat/cryostat3-db:dev diff --git a/db/entrypoint.bash b/db/entrypoint.bash deleted file mode 100755 index 1806c58d2..000000000 --- a/db/entrypoint.bash +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -if [ "$1" = "postgres" ]; then - shift -fi - -exec /usr/bin/run-postgresql \ - -c encrypt.key="${PG_ENCRYPT_KEY?:\$PG_ENCRYPT_KEY must be set and non-empty}" \ - "$@" diff --git a/db/include/postgresql-cfg/pgcrypto.conf b/db/include/postgresql-cfg/pgcrypto.conf deleted file mode 100644 index 47109c0c9..000000000 --- a/db/include/postgresql-cfg/pgcrypto.conf +++ /dev/null @@ -1 +0,0 @@ -shared_preload_libraries='pgcrypto' diff --git a/db/include/postgresql-init/pgcrypto.sh b/db/include/postgresql-init/pgcrypto.sh deleted file mode 100755 index b549fe51a..000000000 --- a/db/include/postgresql-init/pgcrypto.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public CASCADE;" diff --git a/smoketest/compose/db.yml b/smoketest/compose/db.yml index 33bd8ed58..e28579e63 100644 --- a/smoketest/compose/db.yml +++ b/smoketest/compose/db.yml @@ -7,8 +7,7 @@ services: QUARKUS_DATASOURCE_PASSWORD: cryostat3 QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3 db: - image: quay.io/cryostat/cryostat3-db:dev - build: ../../db + image: quay.io/andrewazores/cryostat-db:latest hostname: db expose: - "5432" diff --git a/smoketest/compose/db_k8s.yml b/smoketest/compose/db_k8s.yml index 63c9b0df6..e7cd0550b 100644 --- a/smoketest/compose/db_k8s.yml +++ b/smoketest/compose/db_k8s.yml @@ -8,8 +8,7 @@ services: QUARKUS_DATASOURCE_PASSWORD: cryostat3 QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3 db: - image: quay.io/cryostat/cryostat3-db:dev - build: ../../db + image: quay.io/cryostat/cryostat-db:latest entrypoint: - /usr/local/bin/docker-entrypoint.sh command: diff --git a/smoketest/k8s/db-deployment.yaml b/smoketest/k8s/db-deployment.yaml index fbdced1bc..8aa99dc21 100644 --- a/smoketest/k8s/db-deployment.yaml +++ b/smoketest/k8s/db-deployment.yaml @@ -34,7 +34,7 @@ spec: value: cryostat3 - name: POSTGRES_USER value: cryostat3 - image: quay.io/cryostat/cryostat3-db:dev + image: quay.io/cryostat/cryostat-db:latest livenessProbe: exec: command: diff --git a/smoketest/k8s/smoketest.bash b/smoketest/k8s/smoketest.bash index da42928e0..18a59e63b 100755 --- a/smoketest/k8s/smoketest.bash +++ b/smoketest/k8s/smoketest.bash @@ -18,7 +18,7 @@ while [ "$#" -ne 0 ]; do cleanKind kind create cluster kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat3:dev" - kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat3-db:dev" + kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat-db:latest" ;; unkind) cleanKind @@ -37,7 +37,7 @@ while [ "$#" -ne 0 ]; do ;; apply) kubectl apply -f "./*.yaml" - kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"\$setElementOrder/containers\":[{\"name\":\"db\"}],\"containers\":[{\"image\":\"quay.io/$IMAGE_REPOSITORY/cryostat3-db:dev\",\"name\":\"db\"}]}}}}" deployment/db + kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"\$setElementOrder/containers\":[{\"name\":\"db\"}],\"containers\":[{\"image\":\"quay.io/$IMAGE_REPOSITORY/cryostat-db:latest\",\"name\":\"db\"}]}}}}" deployment/db kubectl wait \ --for condition=available \ --timeout=5m \ diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 87642863f..08e564fbe 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -19,7 +19,7 @@ cryostat.discovery.podman.enabled=true cryostat.discovery.docker.enabled=true quarkus.datasource.devservices.enabled=true -quarkus.datasource.devservices.image-name=quay.io/cryostat/cryostat3-db +quarkus.datasource.devservices.image-name=quay.io/cryostat/cryostat-db # !!! prod databases must set this configuration parameter some other way via a secret !!! quarkus.datasource.devservices.container-env.PG_ENCRYPT_KEY=examplekey diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index d2fc74d6b..ac558246d 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -11,7 +11,7 @@ grafana-datasource.url=http://jfr-datasource:8080 quarkus.test.env.JAVA_OPTS_APPEND=-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dcom.sun.management.jmxremote.autodiscovery=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9091 -Dcom.sun.management.jmxremote.rmi.port=9091 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false quarkus.datasource.devservices.enabled=true -quarkus.datasource.devservices.image-name=quay.io/cryostat/cryostat3-db +quarkus.datasource.devservices.image-name=quay.io/cryostat/cryostat-db # !!! prod databases must set this configuration parameter some other way via a secret !!! quarkus.datasource.devservices.container-env.PG_ENCRYPT_KEY=examplekey From adfbd80ad00ce1969dd288d6a9d35513d81912c3 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 31 Oct 2023 15:31:26 -0400 Subject: [PATCH 02/11] remove references to old database build script --- .github/workflows/ci.yaml | 2 -- README.md | 6 ------ smoketest.bash | 1 - smoketest/k8s/smoketest.bash | 1 - 4 files changed, 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8b40b89dc..fa9e45aba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -95,8 +95,6 @@ jobs: run: systemctl --user enable --now podman.socket - name: Set DOCKER_HOST environment variable run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV" - - name: Build db image - run: sh db/build.sh - name: Run tests run: ./mvnw -B -U clean verify continue-on-error: ${{ matrix.java != '17' }} diff --git a/README.md b/README.md index ab82d47ac..e650e2ce4 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,6 @@ $ yarn install && yarn yarn:frzinstall $ cd - ``` -### Build the custom database container image - -```bash -$ sh db/build.sh -``` - ### Build the application container image The application image can be created using: diff --git a/smoketest.bash b/smoketest.bash index d8fa29650..88da3de28 100755 --- a/smoketest.bash +++ b/smoketest.bash @@ -118,7 +118,6 @@ setupUserHosts() { setupUserHosts if [ "${PULL_IMAGES}" = "true" ]; then - sh db/build.sh IMAGES=() for file in "${FILES[@]}" ; do images="$(yq '.services.*.image' "${file}" | grep -v null)" diff --git a/smoketest/k8s/smoketest.bash b/smoketest/k8s/smoketest.bash index 18a59e63b..3b4c3145f 100755 --- a/smoketest/k8s/smoketest.bash +++ b/smoketest/k8s/smoketest.bash @@ -24,7 +24,6 @@ while [ "$#" -ne 0 ]; do cleanKind ;; generate) - sh "${DIR}/../../db/build.sh" kompose convert \ --with-kompose-annotation=false \ -o "${DIR}" \ From ab65fa7cd53b24f5d3d17c612b4f0f389eada87e Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 31 Oct 2023 15:32:25 -0400 Subject: [PATCH 03/11] cleanup --- smoketest.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/smoketest.bash b/smoketest.bash index 88da3de28..7bc15962b 100755 --- a/smoketest.bash +++ b/smoketest.bash @@ -82,6 +82,8 @@ for file in "${FILES[@]}"; do CMD+=(-f "${file}") done +HOSTSFILE="${HOSTSFILE:-~/.hosts}" + cleanup() { DOWN_FLAGS=('--remove-orphans') if [ "${KEEP_VOLUMES}" != "true" ]; then @@ -91,7 +93,7 @@ cleanup() { "${CMD[@]}" \ down "${DOWN_FLAGS[@]}" # podman kill hoster || true - > ~/.hosts + truncate -s 0 "${HOSTSFILE}" } trap cleanup EXIT cleanup @@ -109,7 +111,7 @@ setupUserHosts() { # -v "${XDG_RUNTIME_DIR}/podman/podman.sock:/tmp/docker.sock:Z" \ # -v "${HOME}/.hosts:/tmp/hosts" \ # dvdarias/docker-hoster - > ~/.hosts + truncate -s 0 "${HOSTSFILE}" for file in "${FILES[@]}" ; do hosts="$(yq '.services.*.hostname' "${file}" | grep -v null | sed -e 's/^/localhost /')" echo "${hosts}" >> ~/.hosts From ceb37d5f2f05487085506fc436b0bf78df843bfa Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 10:18:04 -0400 Subject: [PATCH 04/11] correct k8s db service definition for new image --- smoketest/compose/db_k8s.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/smoketest/compose/db_k8s.yml b/smoketest/compose/db_k8s.yml index e7cd0550b..0fc25b7c8 100644 --- a/smoketest/compose/db_k8s.yml +++ b/smoketest/compose/db_k8s.yml @@ -9,21 +9,16 @@ services: QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3 db: image: quay.io/cryostat/cryostat-db:latest - entrypoint: - - /usr/local/bin/docker-entrypoint.sh - command: - - postgres - - -c - - encrypt.key=REPLACEME hostname: db expose: - "5432" environment: - POSTGRES_USER: cryostat3 - POSTGRES_PASSWORD: cryostat3 + POSTGRESQL_USER: cryostat3 + POSTGRESQL_PASSWORD: cryostat3 + POSTGRESQL_DATABASE: cryostat3 PG_ENCRYPT_KEY: REPLACEME volumes: - - postgresql:/var/lib/postgresql/data + - postgresql:/var/lib/pgsql/data restart: always healthcheck: test: pg_isready -U cryostat3 -d cryostat3 || exit 1 From 5ddb71b4627b3560612ad3f75c726195fdb658bc Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 11:27:29 -0400 Subject: [PATCH 05/11] regenerate --- .../k8s/compose-default-networkpolicy.yaml | 14 ++++++++++++++ smoketest/k8s/cryostat-deployment.yaml | 5 ----- smoketest/k8s/cryostat-ingress.yaml | 1 - smoketest/k8s/cryostat-service.yaml | 1 - smoketest/k8s/db-deployment.yaml | 19 ++++++------------- smoketest/k8s/db-service.yaml | 1 - smoketest/k8s/db-viewer-deployment.yaml | 3 --- smoketest/k8s/db-viewer-ingress.yaml | 1 - smoketest/k8s/db-viewer-service.yaml | 1 - .../minio-certs-persistentvolumeclaim.yaml | 1 - .../k8s/minio-data-persistentvolumeclaim.yaml | 1 - .../k8s/pgadmin-persistentvolumeclaim.yaml | 1 - .../k8s/postgresql-persistentvolumeclaim.yaml | 1 - .../k8s/quarkus-test-agent-deployment.yaml | 5 ----- smoketest/k8s/quarkus-test-agent-service.yaml | 1 - smoketest/k8s/s3-deployment.yaml | 5 ----- smoketest/k8s/s3-ingress.yaml | 1 - smoketest/k8s/s3-service.yaml | 1 - smoketest/k8s/sample-app-deployment.yaml | 3 --- smoketest/k8s/sample-app-service.yaml | 1 - 20 files changed, 20 insertions(+), 47 deletions(-) create mode 100644 smoketest/k8s/compose-default-networkpolicy.yaml diff --git a/smoketest/k8s/compose-default-networkpolicy.yaml b/smoketest/k8s/compose-default-networkpolicy.yaml new file mode 100644 index 000000000..d78a9fa1a --- /dev/null +++ b/smoketest/k8s/compose-default-networkpolicy.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + creationTimestamp: null + name: compose-default +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/compose-default: "true" + podSelector: + matchLabels: + io.kompose.network/compose-default: "true" diff --git a/smoketest/k8s/cryostat-deployment.yaml b/smoketest/k8s/cryostat-deployment.yaml index 45bad93f1..cff060195 100644 --- a/smoketest/k8s/cryostat-deployment.yaml +++ b/smoketest/k8s/cryostat-deployment.yaml @@ -11,7 +11,6 @@ metadata: labels: io.kompose.service: cryostat name: cryostat - namespace: default spec: replicas: 1 selector: @@ -79,11 +78,7 @@ spec: name: cryostat ports: - containerPort: 8181 - hostPort: 8181 - protocol: TCP - containerPort: 9091 - hostPort: 9091 - protocol: TCP resources: {} securityContext: runAsUser: 0 diff --git a/smoketest/k8s/cryostat-ingress.yaml b/smoketest/k8s/cryostat-ingress.yaml index 38104f835..a750c23bf 100644 --- a/smoketest/k8s/cryostat-ingress.yaml +++ b/smoketest/k8s/cryostat-ingress.yaml @@ -11,7 +11,6 @@ metadata: labels: io.kompose.service: cryostat name: cryostat - namespace: default spec: rules: - host: cryostat3 diff --git a/smoketest/k8s/cryostat-service.yaml b/smoketest/k8s/cryostat-service.yaml index bb7c3d2df..ba686ca30 100644 --- a/smoketest/k8s/cryostat-service.yaml +++ b/smoketest/k8s/cryostat-service.yaml @@ -11,7 +11,6 @@ metadata: labels: io.kompose.service: cryostat name: cryostat - namespace: default spec: ports: - name: "8181" diff --git a/smoketest/k8s/db-deployment.yaml b/smoketest/k8s/db-deployment.yaml index 8aa99dc21..7acf97e45 100644 --- a/smoketest/k8s/db-deployment.yaml +++ b/smoketest/k8s/db-deployment.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: db name: db - namespace: default spec: replicas: 1 selector: @@ -21,18 +20,14 @@ spec: io.kompose.service: db spec: containers: - - args: - - postgres - - -c - - encrypt.key=REPLACEME - command: - - /usr/local/bin/docker-entrypoint.sh - env: + - env: - name: PG_ENCRYPT_KEY value: REPLACEME - - name: POSTGRES_PASSWORD + - name: POSTGRESQL_DATABASE value: cryostat3 - - name: POSTGRES_USER + - name: POSTGRESQL_PASSWORD + value: cryostat3 + - name: POSTGRESQL_USER value: cryostat3 image: quay.io/cryostat/cryostat-db:latest livenessProbe: @@ -46,11 +41,9 @@ spec: name: db ports: - containerPort: 5432 - hostPort: 5432 - protocol: TCP resources: {} volumeMounts: - - mountPath: /var/lib/postgresql/data + - mountPath: /var/lib/pgsql/data name: postgresql hostname: db restartPolicy: Always diff --git a/smoketest/k8s/db-service.yaml b/smoketest/k8s/db-service.yaml index 43f49d892..f80320777 100644 --- a/smoketest/k8s/db-service.yaml +++ b/smoketest/k8s/db-service.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: db name: db - namespace: default spec: ports: - name: "5432" diff --git a/smoketest/k8s/db-viewer-deployment.yaml b/smoketest/k8s/db-viewer-deployment.yaml index 2c35dcbda..ea8a0a93d 100644 --- a/smoketest/k8s/db-viewer-deployment.yaml +++ b/smoketest/k8s/db-viewer-deployment.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: db-viewer name: db-viewer - namespace: default spec: replicas: 1 selector: @@ -44,8 +43,6 @@ spec: name: db-viewer ports: - containerPort: 8989 - hostPort: 8989 - protocol: TCP resources: {} volumeMounts: - mountPath: /var/lib/pgadmin diff --git a/smoketest/k8s/db-viewer-ingress.yaml b/smoketest/k8s/db-viewer-ingress.yaml index eecacffc4..7be901f0c 100644 --- a/smoketest/k8s/db-viewer-ingress.yaml +++ b/smoketest/k8s/db-viewer-ingress.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: db-viewer name: db-viewer - namespace: default spec: rules: - host: pgadmin diff --git a/smoketest/k8s/db-viewer-service.yaml b/smoketest/k8s/db-viewer-service.yaml index 4ea3da961..4e2e3fddc 100644 --- a/smoketest/k8s/db-viewer-service.yaml +++ b/smoketest/k8s/db-viewer-service.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: db-viewer name: db-viewer - namespace: default spec: ports: - name: "8989" diff --git a/smoketest/k8s/minio-certs-persistentvolumeclaim.yaml b/smoketest/k8s/minio-certs-persistentvolumeclaim.yaml index 0076ff3b8..64974d8f2 100644 --- a/smoketest/k8s/minio-certs-persistentvolumeclaim.yaml +++ b/smoketest/k8s/minio-certs-persistentvolumeclaim.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: minio-certs name: minio-certs - namespace: default spec: accessModes: - ReadWriteOnce diff --git a/smoketest/k8s/minio-data-persistentvolumeclaim.yaml b/smoketest/k8s/minio-data-persistentvolumeclaim.yaml index 5489b68f7..75ade51f7 100644 --- a/smoketest/k8s/minio-data-persistentvolumeclaim.yaml +++ b/smoketest/k8s/minio-data-persistentvolumeclaim.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: minio-data name: minio-data - namespace: default spec: accessModes: - ReadWriteOnce diff --git a/smoketest/k8s/pgadmin-persistentvolumeclaim.yaml b/smoketest/k8s/pgadmin-persistentvolumeclaim.yaml index b84cb1446..e97ee87fb 100644 --- a/smoketest/k8s/pgadmin-persistentvolumeclaim.yaml +++ b/smoketest/k8s/pgadmin-persistentvolumeclaim.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: pgadmin name: pgadmin - namespace: default spec: accessModes: - ReadWriteOnce diff --git a/smoketest/k8s/postgresql-persistentvolumeclaim.yaml b/smoketest/k8s/postgresql-persistentvolumeclaim.yaml index 7430c131a..39c8e7e10 100644 --- a/smoketest/k8s/postgresql-persistentvolumeclaim.yaml +++ b/smoketest/k8s/postgresql-persistentvolumeclaim.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: postgresql name: postgresql - namespace: default spec: accessModes: - ReadWriteOnce diff --git a/smoketest/k8s/quarkus-test-agent-deployment.yaml b/smoketest/k8s/quarkus-test-agent-deployment.yaml index 4f6daca45..0a0a14614 100644 --- a/smoketest/k8s/quarkus-test-agent-deployment.yaml +++ b/smoketest/k8s/quarkus-test-agent-deployment.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: quarkus-test-agent name: quarkus-test-agent - namespace: default spec: replicas: 1 selector: @@ -63,11 +62,7 @@ spec: name: quarkus-test-agent ports: - containerPort: 9977 - hostPort: 9977 - protocol: TCP - containerPort: 10010 - hostPort: 10010 - protocol: TCP resources: {} hostname: quarkus-test-agent restartPolicy: Always diff --git a/smoketest/k8s/quarkus-test-agent-service.yaml b/smoketest/k8s/quarkus-test-agent-service.yaml index 051c16298..16c319579 100644 --- a/smoketest/k8s/quarkus-test-agent-service.yaml +++ b/smoketest/k8s/quarkus-test-agent-service.yaml @@ -5,7 +5,6 @@ metadata: labels: io.kompose.service: quarkus-test-agent name: quarkus-test-agent - namespace: default spec: ports: - name: "9977" diff --git a/smoketest/k8s/s3-deployment.yaml b/smoketest/k8s/s3-deployment.yaml index a6ebdc8b9..e36a4b389 100644 --- a/smoketest/k8s/s3-deployment.yaml +++ b/smoketest/k8s/s3-deployment.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: s3 name: s3 - namespace: default spec: replicas: 1 selector: @@ -51,11 +50,7 @@ spec: name: s3 ports: - containerPort: 9001 - hostPort: 9001 - protocol: TCP - containerPort: 9000 - hostPort: 9000 - protocol: TCP resources: {} volumeMounts: - mountPath: /data diff --git a/smoketest/k8s/s3-ingress.yaml b/smoketest/k8s/s3-ingress.yaml index c2958931f..dad6f969f 100644 --- a/smoketest/k8s/s3-ingress.yaml +++ b/smoketest/k8s/s3-ingress.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: s3 name: s3 - namespace: default spec: rules: - host: minio diff --git a/smoketest/k8s/s3-service.yaml b/smoketest/k8s/s3-service.yaml index aa9a2ff03..befd770da 100644 --- a/smoketest/k8s/s3-service.yaml +++ b/smoketest/k8s/s3-service.yaml @@ -7,7 +7,6 @@ metadata: labels: io.kompose.service: s3 name: s3 - namespace: default spec: ports: - name: "9001" diff --git a/smoketest/k8s/sample-app-deployment.yaml b/smoketest/k8s/sample-app-deployment.yaml index bddac5667..7770d5106 100644 --- a/smoketest/k8s/sample-app-deployment.yaml +++ b/smoketest/k8s/sample-app-deployment.yaml @@ -9,7 +9,6 @@ metadata: labels: io.kompose.service: sample-app name: sample-app - namespace: default spec: replicas: 1 selector: @@ -63,8 +62,6 @@ spec: name: sample-app ports: - containerPort: 8081 - hostPort: 8081 - protocol: TCP resources: {} hostname: vertx-fib-demo-1 restartPolicy: Always diff --git a/smoketest/k8s/sample-app-service.yaml b/smoketest/k8s/sample-app-service.yaml index ed342d863..323741f45 100644 --- a/smoketest/k8s/sample-app-service.yaml +++ b/smoketest/k8s/sample-app-service.yaml @@ -9,7 +9,6 @@ metadata: labels: io.kompose.service: sample-app name: sample-app - namespace: default spec: ports: - name: "8081" From 8bed92103a55be04de63501d6d5da086825a2383 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 11:40:30 -0400 Subject: [PATCH 06/11] replace tilde with $HOME --- smoketest.bash | 4 ++-- smoketest/containers/smoketest_pod.bash | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/smoketest.bash b/smoketest.bash index 7bc15962b..ab0245d90 100755 --- a/smoketest.bash +++ b/smoketest.bash @@ -82,7 +82,7 @@ for file in "${FILES[@]}"; do CMD+=(-f "${file}") done -HOSTSFILE="${HOSTSFILE:-~/.hosts}" +HOSTSFILE="${HOSTSFILE:-$HOME/.hosts}" cleanup() { DOWN_FLAGS=('--remove-orphans') @@ -114,7 +114,7 @@ setupUserHosts() { truncate -s 0 "${HOSTSFILE}" for file in "${FILES[@]}" ; do hosts="$(yq '.services.*.hostname' "${file}" | grep -v null | sed -e 's/^/localhost /')" - echo "${hosts}" >> ~/.hosts + echo "${hosts}" >> "${HOSTSFILE}" done } setupUserHosts diff --git a/smoketest/containers/smoketest_pod.bash b/smoketest/containers/smoketest_pod.bash index eea4fcdaf..4bddfe954 100755 --- a/smoketest/containers/smoketest_pod.bash +++ b/smoketest/containers/smoketest_pod.bash @@ -3,7 +3,7 @@ set -x set -e -HOSTSFILE="${HOSTSFILE:-~/.hosts}" +HOSTSFILE="${HOSTSFILE:-$HOME/.hosts}" cleanup() { podman-compose --in-pod=1 \ @@ -30,7 +30,7 @@ cleanup # --user=0 \ # --security-opt label=disable \ # -v "${XDG_RUNTIME_DIR}/podman/podman.sock:/tmp/docker.sock:Z" \ -# -v "${HOME}/.hosts:/tmp/hosts" \ +# -v "${HOSTSFILE}:/tmp/hosts" \ # dvdarias/docker-hoster setupUserHosts() { From 86e34080eb5703f30a5af9722452867ebe42e4c2 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 15:11:01 -0400 Subject: [PATCH 07/11] regenerate with newer kompose --- smoketest/k8s/cryostat-deployment.yaml | 3 +++ smoketest/k8s/db-deployment.yaml | 1 + smoketest/k8s/db-viewer-deployment.yaml | 2 ++ smoketest/k8s/quarkus-test-agent-deployment.yaml | 4 ++++ smoketest/k8s/s3-deployment.yaml | 4 ++++ smoketest/k8s/sample-app-deployment.yaml | 2 ++ 6 files changed, 16 insertions(+) diff --git a/smoketest/k8s/cryostat-deployment.yaml b/smoketest/k8s/cryostat-deployment.yaml index cff060195..2db623091 100644 --- a/smoketest/k8s/cryostat-deployment.yaml +++ b/smoketest/k8s/cryostat-deployment.yaml @@ -78,7 +78,10 @@ spec: name: cryostat ports: - containerPort: 8181 + hostPort: 8181 + protocol: TCP - containerPort: 9091 + protocol: TCP resources: {} securityContext: runAsUser: 0 diff --git a/smoketest/k8s/db-deployment.yaml b/smoketest/k8s/db-deployment.yaml index 7acf97e45..28e82c4b7 100644 --- a/smoketest/k8s/db-deployment.yaml +++ b/smoketest/k8s/db-deployment.yaml @@ -41,6 +41,7 @@ spec: name: db ports: - containerPort: 5432 + protocol: TCP resources: {} volumeMounts: - mountPath: /var/lib/pgsql/data diff --git a/smoketest/k8s/db-viewer-deployment.yaml b/smoketest/k8s/db-viewer-deployment.yaml index ea8a0a93d..957149891 100644 --- a/smoketest/k8s/db-viewer-deployment.yaml +++ b/smoketest/k8s/db-viewer-deployment.yaml @@ -43,6 +43,8 @@ spec: name: db-viewer ports: - containerPort: 8989 + hostPort: 8989 + protocol: TCP resources: {} volumeMounts: - mountPath: /var/lib/pgadmin diff --git a/smoketest/k8s/quarkus-test-agent-deployment.yaml b/smoketest/k8s/quarkus-test-agent-deployment.yaml index 0a0a14614..9007361b8 100644 --- a/smoketest/k8s/quarkus-test-agent-deployment.yaml +++ b/smoketest/k8s/quarkus-test-agent-deployment.yaml @@ -62,7 +62,11 @@ spec: name: quarkus-test-agent ports: - containerPort: 9977 + hostPort: 9977 + protocol: TCP - containerPort: 10010 + hostPort: 10010 + protocol: TCP resources: {} hostname: quarkus-test-agent restartPolicy: Always diff --git a/smoketest/k8s/s3-deployment.yaml b/smoketest/k8s/s3-deployment.yaml index e36a4b389..fb76382ed 100644 --- a/smoketest/k8s/s3-deployment.yaml +++ b/smoketest/k8s/s3-deployment.yaml @@ -50,7 +50,11 @@ spec: name: s3 ports: - containerPort: 9001 + hostPort: 9001 + protocol: TCP - containerPort: 9000 + hostPort: 9000 + protocol: TCP resources: {} volumeMounts: - mountPath: /data diff --git a/smoketest/k8s/sample-app-deployment.yaml b/smoketest/k8s/sample-app-deployment.yaml index 7770d5106..53c2baf3c 100644 --- a/smoketest/k8s/sample-app-deployment.yaml +++ b/smoketest/k8s/sample-app-deployment.yaml @@ -62,6 +62,8 @@ spec: name: sample-app ports: - containerPort: 8081 + hostPort: 8081 + protocol: TCP resources: {} hostname: vertx-fib-demo-1 restartPolicy: Always From 6e2b82f3630260920c88b4bdda70c0438719eb8e Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 15:42:38 -0400 Subject: [PATCH 08/11] document newer kompose version requirement --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e650e2ce4..a6b025cf1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Build Requirements: Run Requirements: - [`yq`](https://github.com/mikefarah/yq) v4.35.1+ -- [`kompose`](https://kompose.io/installation/) v1.30.0+ +- [`kompose`](https://kompose.io/installation/) v1.31.2+ - [docker-compose](https://docs.docker.com/compose/install/) v1.29.2 - [podman-docker](https://packages.fedoraproject.org/pkgs/podman/podman-docker/) (Optional) - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) / [oc](https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html) From dba3c3e300dbd8ac5951bb20924c99da41371a44 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 15:49:27 -0400 Subject: [PATCH 09/11] correct a relative path --- smoketest/k8s/smoketest.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoketest/k8s/smoketest.bash b/smoketest/k8s/smoketest.bash index 3b4c3145f..83d495c4c 100755 --- a/smoketest/k8s/smoketest.bash +++ b/smoketest/k8s/smoketest.bash @@ -35,7 +35,7 @@ while [ "$#" -ne 0 ]; do bash "${DIR}/generate.bash" ;; apply) - kubectl apply -f "./*.yaml" + kubectl apply -f "${DIR}/*.yaml" kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"\$setElementOrder/containers\":[{\"name\":\"db\"}],\"containers\":[{\"image\":\"quay.io/$IMAGE_REPOSITORY/cryostat-db:latest\",\"name\":\"db\"}]}}}}" deployment/db kubectl wait \ --for condition=available \ From 14354c0a3079888c62e465814708febfc06f9388 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 1 Nov 2023 15:55:06 -0400 Subject: [PATCH 10/11] work around kubectl multiforward relative config path usage --- smoketest/k8s/smoketest.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoketest/k8s/smoketest.bash b/smoketest/k8s/smoketest.bash index 83d495c4c..5b7cb2199 100755 --- a/smoketest/k8s/smoketest.bash +++ b/smoketest/k8s/smoketest.bash @@ -52,7 +52,7 @@ while [ "$#" -ne 0 ]; do ;; forward) sh -c '(sleep 1 ; xdg-open http://localhost:9001 ; xdg-open http://localhost:8181 ; xdg-open http://localhost:8989)&' - if ! kubectl multiforward smoketest; then + if ! ( pushd "${DIR}" ; sc=$(kubectl multiforward smoketest) ; popd ; exit "${sc}" ); then echo "Run the following to expose the applications:" echo "kubectl port-forward svc/cryostat 8181" echo "kubectl port-forward svc/s3 9001" From 25fa8f23e7b6db376e8a17b00e4636dd50e63442 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 2 Nov 2023 15:29:20 -0400 Subject: [PATCH 11/11] don't explicitly load db image to kind, allow it to pull it on its own --- smoketest/k8s/smoketest.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/smoketest/k8s/smoketest.bash b/smoketest/k8s/smoketest.bash index 5b7cb2199..641a3a478 100755 --- a/smoketest/k8s/smoketest.bash +++ b/smoketest/k8s/smoketest.bash @@ -18,7 +18,6 @@ while [ "$#" -ne 0 ]; do cleanKind kind create cluster kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat3:dev" - kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat-db:latest" ;; unkind) cleanKind