Skip to content

Commit eb9baf2

Browse files
committed
Add workflow to validate deployment methods
1 parent 75f47df commit eb9baf2

File tree

8 files changed

+74
-17
lines changed

8 files changed

+74
-17
lines changed

.github/workflows/e2e-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ jobs:
3333
- name: Install KUTTL
3434
run: kubectl krew install kuttl
3535
- name: Run tests
36-
run: kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres.yaml
36+
run: |
37+
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-helm.yaml
38+
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-kustomize.yaml
3739
- name: Upload test artifacts
3840
if: always() # Run even if tests fail
3941
uses: actions/upload-artifact@v4
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Validate Deployment methods
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "charts/ext-postgres-operator/**"
9+
- "config/**"
10+
pull_request:
11+
branches:
12+
- master
13+
paths:
14+
- "charts/ext-postgres-operator/**"
15+
- "config/**"
16+
17+
jobs:
18+
validate-helm:
19+
name: Validate Helm Chart
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Helm
26+
uses: azure/setup-helm@v3
27+
with:
28+
version: "latest"
29+
30+
- name: Lint Helm chart
31+
run: helm lint ./charts/ext-postgres-operator
32+
33+
- name: Template Helm chart
34+
run: helm template ext-postgres-operator ./charts/ext-postgres-operator > /dev/null
35+
36+
validate-kustomize:
37+
name: Validate Kustomize Configuration
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Validate Kustomize configuration
44+
run: kustomize build ./config/default > /dev/null

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,5 @@ catalog-push: ## Push a catalog image.
305305

306306
.PHONY: e2e
307307
e2e:
308-
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres.yaml
308+
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-helm.yaml
309+
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-kustomize.yaml

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,9 @@ data:
118118
119119
To install the operator using Kustomize, follow these steps:
120120
121-
1. Configure Postgres credentials for the operator in `config/secret.yaml`.
121+
1. Configure Postgres credentials for the operator in `config/default/secret.yaml`.
122122

123-
2. Create the namespace if needed:
124-
```bash
125-
kubectl apply -f config/namespace.yaml
126-
```
127-
128-
3. Apply the secret:
129-
```bash
130-
kubectl apply -f deploy/secret.yaml
131-
```
132-
133-
4. Deploy the operator:
123+
2. Deploy the operator:
134124
```bash
135125
kubectl kustomize config/default/ | kubectl apply -f -
136126
```

config/default/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace: operators
22

33
resources:
44
- namespace.yaml
5+
- secret.yaml
56
- ../crd
67
- ../rbac
78
- ../manager

config/secret.yaml renamed to config/default/secret.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
name: ext-postgres-operator
55
type: Opaque
66
data:
7-
POSTGRES_HOST: cG9zdGdyZXMuZGF0YWJhc2Vz
7+
POSTGRES_HOST: cG9zdGdyZXNxbA==
88
POSTGRES_USER: cG9zdGdyZXM=
9-
POSTGRES_PASS: YWRtaW4xMjM=
9+
POSTGRES_PASS: cG9zdGdyZXM=
1010
POSTGRES_URI_ARGS: c3NsbW9kZT1kaXNhYmxl

tests/kuttl-test-self-hosted-postgres.yaml renamed to tests/kuttl-test-self-hosted-postgres-helm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: kuttl.dev/v1beta1
22
kind: TestSuite
33
testDirs:
44
- ./tests/e2e/
5-
# crdDir: ./deploy/crds/
65
startKIND: true
76
kindContext: self-hosted-postgres
87
kindContainers:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestSuite
3+
testDirs:
4+
- ./tests/e2e/
5+
startKIND: true
6+
kindContext: self-hosted-postgres
7+
kindContainers:
8+
- postgres-operator:build
9+
artifactsDir: ./tests/
10+
commands:
11+
- command: >-
12+
helm install -n operators postgresql oci://registry-1.docker.io/bitnamicharts/postgresql
13+
--version 16.6.0
14+
--set global.postgresql.auth.password=postgres
15+
--set global.postgresql.auth.username=postgres
16+
--create-namespace
17+
--wait
18+
timeout: 120
19+
- command: >-
20+
kubectl apply -n operators -k config/default/

0 commit comments

Comments
 (0)