@@ -60,43 +60,15 @@ jobs:
6060 - uses : actions/setup-go@v3
6161 with : { go-version: 1.x }
6262
63- - name : Install k3d
64- # Git tag from https://github.com/rancher/k3d/releases or "latest"
65- env : { K3D_TAG: latest }
66- run : |
67- curl --fail --silent https://raw.githubusercontent.com/rancher/k3d/main/install.sh |
68- TAG="${K3D_TAG#latest}" bash && k3d version | head -n1
69-
7063 - name : Start k3s
71- # https://rancher.com/docs/k3s/latest/en/upgrades/basic/#release-channels
72- env : { K3S_CHANNEL: "${{ matrix.kubernetes }}" }
73- run : k3d cluster create --image="+${K3S_CHANNEL}" --no-lb --timeout=2m --wait
64+ uses : ./.github/actions/k3d
65+ with :
66+ k3s-channel : " ${{ matrix.kubernetes }}"
67+ prefetch-images : |
68+ registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.41-2
69+ registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.17-5
70+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.9-2
7471
75- - name : Prefetch container images
76- run : |
77- {
78- echo '"registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.6-1"'
79- echo '"registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0"'
80- echo '"registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.16-2"'
81- } |
82- jq --slurp --arg name 'image-prefetch' --argjson labels '{"name":"image-prefetch"}' '{
83- apiVersion: "apps/v1", kind: "DaemonSet",
84- metadata: { name: $name, labels: $labels },
85- spec: {
86- selector: { matchLabels: $labels },
87- template: {
88- metadata: { labels: $labels },
89- spec: {
90- initContainers: to_entries | map({ name: "c\(.key)", command: ["true"], image: .value }),
91- containers: [{ name: "pause", image: "k8s.gcr.io/pause:3.5" }]
92- }
93- }
94- }
95- }' |
96- kubectl create --filename=- && {
97- kubectl rollout status daemonset.apps/image-prefetch --timeout=90s ||
98- kubectl describe daemonset.apps/image-prefetch
99- }
10072 - run : make createnamespaces check-envtest-existing
10173 env :
10274 PGO_TEST_TIMEOUT_SCALE : 1.2
@@ -110,6 +82,78 @@ jobs:
11082 path : envtest-existing.coverage.gz
11183 retention-days : 1
11284
85+ kuttl-k3d :
86+ runs-on : ubuntu-20.04
87+ needs : [go-test]
88+ strategy :
89+ fail-fast : false
90+ matrix :
91+ kubernetes : [v1.25, v1.24, v1.23, v1.22, v1.21]
92+ steps :
93+ - uses : actions/checkout@v3
94+ - uses : actions/setup-go@v3
95+ with : { go-version: 1.x }
96+
97+ - name : Start k3s
98+ uses : ./.github/actions/k3d
99+ with :
100+ k3s-channel : " ${{ matrix.kubernetes }}"
101+ prefetch-images : |
102+ registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-8
103+ registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.41-2
104+ registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.17-5
105+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.3.0-0
106+ registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.0-0
107+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.9-2
108+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-13.9-3.1-2
109+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2
110+ registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.6-3.1-2
111+ - run : go mod download
112+ - name : Build executable
113+ run : PGO_VERSION='${{ github.sha }}' make build-postgres-operator
114+
115+ # Start a Docker container with the working directory mounted.
116+ - name : Start PGO
117+ run : |
118+ kubectl apply --server-side -k ./config/namespace
119+ kubectl apply --server-side -k ./config/dev
120+ hack/create-kubeconfig.sh postgres-operator pgo
121+ docker run --detach --network host --read-only \
122+ --volume "$(pwd):/mnt" --workdir '/mnt' --env 'PATH=/mnt/bin' \
123+ --env 'KUBECONFIG=hack/.kube/postgres-operator/pgo' \
124+ --env 'RELATED_IMAGE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-8' \
125+ --env 'RELATED_IMAGE_PGBACKREST=registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.41-2' \
126+ --env 'RELATED_IMAGE_PGBOUNCER=registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.17-5' \
127+ --env 'RELATED_IMAGE_PGEXPORTER=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.3.0-0' \
128+ --env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.0-0' \
129+ --env 'RELATED_IMAGE_POSTGRES_13=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.9-2' \
130+ --env 'RELATED_IMAGE_POSTGRES_13_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-13.9-3.1-2' \
131+ --env 'RELATED_IMAGE_POSTGRES_14=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2' \
132+ --env 'RELATED_IMAGE_POSTGRES_14_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.6-3.1-2' \
133+ --name 'postgres-operator' ubuntu \
134+ postgres-operator
135+ - name : Install kuttl
136+ run : |
137+ curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
138+ chmod +x /usr/local/bin/kubectl-kuttl
139+
140+ - run : make generate-kuttl
141+ env :
142+ KUTTL_PG_UPGRADE_FROM_VERSION : ' 13'
143+ KUTTL_PG_UPGRADE_TO_VERSION : ' 14'
144+ KUTTL_PG_VERSION : ' 14'
145+ KUTTL_POSTGIS_VERSION : ' 3.1'
146+ KUTTL_PSQL_IMAGE : ' registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2'
147+ - run : |
148+ make check-kuttl && exit
149+ failed=$?
150+ echo '::group::PGO logs'; docker logs 'postgres-operator'; echo '::endgroup::'
151+ exit $failed
152+ env:
153+ KUTTL_TEST: kubectl-kuttl test
154+ - name : Stop PGO
155+ run : docker stop 'postgres-operator' || true
156+
113157 coverage-report :
114158 if : ${{ success() || contains(needs.*.result, 'success') }}
115159 runs-on : ubuntu-latest
0 commit comments