Skip to content

Add workflow to validate deployment methods #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
- name: Install KUTTL
run: kubectl krew install kuttl
- name: Run tests
run: kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres.yaml
run: |
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-helm.yaml
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-kustomize.yaml
- name: Upload test artifacts
if: always() # Run even if tests fail
uses: actions/upload-artifact@v4
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/validate-deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Validate Deployment methods

on:
push:
branches:
- master
paths:
- "charts/ext-postgres-operator/**"
- "config/**"
pull_request:
branches:
- master
paths:
- "charts/ext-postgres-operator/**"
- "config/**"

jobs:
validate-helm:
name: Validate Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: "latest"

- name: Lint Helm chart
run: helm lint ./charts/ext-postgres-operator

- name: Template Helm chart
run: helm template ext-postgres-operator ./charts/ext-postgres-operator > /dev/null

validate-kustomize:
name: Validate Kustomize Configuration
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Validate Kustomize configuration
run: kustomize build ./config/default > /dev/null
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@ catalog-push: ## Push a catalog image.

.PHONY: e2e
e2e:
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres.yaml
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-helm.yaml
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres-kustomize.yaml
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,9 @@ data:

To install the operator using Kustomize, follow these steps:

1. Configure Postgres credentials for the operator in `config/secret.yaml`.
1. Configure Postgres credentials for the operator in `config/default/secret.yaml`.

2. Create the namespace if needed:
```bash
kubectl apply -f config/namespace.yaml
```

3. Apply the secret:
```bash
kubectl apply -f deploy/secret.yaml
```

4. Deploy the operator:
2. Deploy the operator:
```bash
kubectl kustomize config/default/ | kubectl apply -f -
```
Expand Down
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace: operators

resources:
- namespace.yaml
- secret.yaml
- ../crd
- ../rbac
- ../manager
4 changes: 2 additions & 2 deletions config/secret.yaml → config/default/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: ext-postgres-operator
type: Opaque
data:
POSTGRES_HOST: cG9zdGdyZXMuZGF0YWJhc2Vz
POSTGRES_HOST: cG9zdGdyZXNxbA==
POSTGRES_USER: cG9zdGdyZXM=
POSTGRES_PASS: YWRtaW4xMjM=
POSTGRES_PASS: cG9zdGdyZXM=
POSTGRES_URI_ARGS: c3NsbW9kZT1kaXNhYmxl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./tests/e2e/
# crdDir: ./deploy/crds/
startKIND: true
kindContext: self-hosted-postgres
kindContainers:
Expand Down
20 changes: 20 additions & 0 deletions tests/kuttl-test-self-hosted-postgres-kustomize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./tests/e2e/
startKIND: true
kindContext: self-hosted-postgres
kindContainers:
- postgres-operator:build
artifactsDir: ./tests/
commands:
- command: >-
helm install -n operators postgresql oci://registry-1.docker.io/bitnamicharts/postgresql
--version 16.6.0
--set global.postgresql.auth.password=postgres
--set global.postgresql.auth.username=postgres
--create-namespace
--wait
timeout: 120
- command: >-
kubectl apply -n operators -k config/default/
Loading