Skip to content
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

feat: create pg4k lts helm chart as subchart of pg4k-pgd #175

Merged
merged 14 commits into from
Nov 28, 2024
24 changes: 24 additions & 0 deletions .github/actions/setup-kind/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup Kind
description: Sets up a kind cluster and installs Helm and kubectl
outputs:
helm-path:
description: The path to the Helm binary
value: ${{ steps.helm.outputs.helm-path }}
kubectl-path:
description: The path to the kubectl binary
value: ${{ steps.kubectl.outputs.kubectl-path }}
runs:
using: composite
steps:
- id: helm
name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.16.2

- id: kubectl
name: Install kubectl
uses: azure/setup-kubectl@v4

- name: Create kind cluster
uses: helm/[email protected]
109 changes: 78 additions & 31 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
outputs:
pg4k-pgd-changed: ${{ steps.filter.outputs.pg4k-pgd-changed }}
ep4k-changed: ${{ steps.filter.outputs.ep4k-changed }}
ep4k-lts-changed: ${{ steps.filter.outputs.ep4k-lts-changed }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -26,6 +27,8 @@ jobs:
- 'charts/edb-postgres-distributed-for-kubernetes/**'
ep4k-changed:
- 'charts/edb-postgres-for-kubernetes/**'
ep4k-lts-changed:
- 'charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/**'

deploy-ep4k:
runs-on: ubuntu-22.04
Expand All @@ -38,13 +41,8 @@ jobs:
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.11.3

- name: Create kind cluster
uses: helm/[email protected]
- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy using helm chart
run: |
Expand All @@ -54,8 +52,35 @@ jobs:
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Deploy a cluster
run: |
kubectl apply -f hack/samples/ep4k-cluster.yaml

PHASE="Cluster in healthy state"
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example

deploy-ep4k-subcharts:
runs-on: ubuntu-22.04
needs:
- change-triage
if: needs.change-triage.outputs.ep4k-lts-changed == 'true'
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy using helm chart
run: |
helm upgrade --install edb-pg4k-lts --namespace postgresql-operator-system \
--create-namespace charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts \
--set image.imageCredentials.create=true \
--set image.imageCredentials.username=${{ secrets.CS_USER }} \
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Deploy a cluster
run: |
Expand All @@ -75,35 +100,28 @@ jobs:
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.11.3

- name: Create kind cluster
uses: helm/[email protected]
- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy using helm chart
run: |
helm dependency build charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts
helm dependency build charts/edb-postgres-distributed-for-kubernetes
helm upgrade --install edb-pg4k-pgd --namespace pgd-operator-system \
--create-namespace charts/edb-postgres-distributed-for-kubernetes \
--set image.imageCredentials.username=${{ secrets.CS_USER }} \
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Install kubectl
uses: azure/setup-kubectl@v4

- name: Deploy a cluster
run: |
kubectl apply -f hack/samples/issuer-selfsigned.yaml
kubectl apply -f hack/samples/pg4k-pgd-cluster.yaml

PHASE="PGDGroup - Healthy"
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-a
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-b
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-c
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-a
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-b
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-c

deploy-ep4k-single-namespace:
runs-on: ubuntu-22.04
Expand All @@ -116,13 +134,8 @@ jobs:
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.11.3

- name: Create kind cluster
uses: helm/[email protected]
- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy in single-namespace mode using helm chart
run: |
Expand All @@ -133,8 +146,42 @@ jobs:
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Deploy a cluster in the watched namespace
run: |
kubectl -n single-install apply -f hack/samples/ep4k-cluster.yaml
PHASE="Cluster in healthy state"
kubectl -n single-install wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example

- name: Ignore deploying a cluster in another namespace
run: |
kubectl create ns test-ignore
kubectl -n test-ignore apply -f hack/samples/ep4k-cluster.yaml
kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found'

deploy-ep4k-subcharts-single-namespace:
runs-on: ubuntu-22.04
needs:
- change-triage
if: needs.change-triage.outputs.ep4k-lts-changed == 'true'
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy in single-namespace mode using helm chart use different namespace
run: |
helm upgrade --install edb-pg4k-lts --namespace single-install \
--set config.clusterWide=false \
--create-namespace charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts \
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd \
--set image.imageCredentials.create=true \
--set image.imageCredentials.username=${{ secrets.CS_USER }} \
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Deploy a cluster in the watched namespace
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*~

# Charts Dependency files
/charts/*/charts/
/charts/*/charts/*.tgz
/charts/*/Chart.lock
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ ifndef SCHEMA-GEN
$(error "Please, run: helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git first")
endif
helm schema-gen charts/edb-postgres-for-kubernetes/values.yaml > charts/edb-postgres-for-kubernetes/values.schema.json
helm schema-gen charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml \
> charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.schema.json
helm schema-gen charts/edb-postgres-distributed-for-kubernetes/values.yaml > charts/edb-postgres-distributed-for-kubernetes/values.schema.json
Loading