Skip to content

Commit

Permalink
Cluster Chart v0.0.1-alpha (#179)
Browse files Browse the repository at this point in the history
CNPG Cluster Chart v0.0.1

Initial prototype of the cluster chart that focuses in ease-of-use and a simple disaster recovery procedure. The objective of the chart is to provide a really easy to use interface for cluster recovery and a convention over configuration approach.

Closes: #178 

Signed-off-by: Itay Grudev [email protected]
  • Loading branch information
sxd authored Feb 16, 2024
1 parent 1ead2b2 commit c939e3e
Show file tree
Hide file tree
Showing 41 changed files with 1,516 additions and 83 deletions.
10 changes: 10 additions & 0 deletions .github/actions/deploy-operator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Deploy the CNPG Operator
description: Deploys the CNPG Operator to a Kubernetes cluster
runs:
using: composite
steps:
- name: Deploy the operator
shell: bash
run: |
helm upgrade --install cnpg --namespace cnpg-system \
--create-namespace charts/cloudnative-pg --wait
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@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.6.2

- id: kubectl
name: Install kubectl
uses: azure/setup-kubectl@901a10e89ea615cf61f57ac05cecdf23e7de06d8 # v3.2

- name: Create kind cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
32 changes: 32 additions & 0 deletions .github/actions/verify-ready-instances/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Verifies that a CNPG cluster has a certain amount of ready instances
description: Verifies that a CNPG cluster has a certain amount of ready instances
inputs:
cluster-name:
description: The name of the cluster to verify
required: true
default: database-cluster
ready-instances:
description: The amount of ready instances to wait for
required: true
default: "3"

runs:
using: composite
steps:
- name: Wait for cluster to become ready
shell: bash
run: |
ITER=0
while true; do
if [[ $ITER -ge 300 ]]; then
echo "Cluster not ready"
exit 1
fi
READY_INSTANCES=$(kubectl get cluster ${INPUT_CLUSTER_NAME} -o jsonpath='{.status.readyInstances}')
if [[ "$READY_INSTANCES" == ${INPUT_READY_INSTANCES} ]]; then
echo "Cluster up and running"
break
fi
sleep 1
(( ++ITER ))
done
60 changes: 0 additions & 60 deletions .github/workflows/continuous-delivery.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/tests-cluster-standalone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tests-cluster-standalone

on:
pull_request:
branches-ignore:
- 'gh-pages'

jobs:
test-cluster-standalone:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

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

- name: Deploy the operator
uses: ./.github/actions/deploy-operator

- name: Deploy a standalone cluster
run: |
helm upgrade --install \
--values charts/cluster/examples/basic.yaml \
--namespace database \
--create-namespace \
--wait \
database ./charts/cluster
- name: Verify that the cluster is ready
uses: ./.github/actions/verify-ready-instances
with:
cluster-name: database-cluster
ready-instances: 1
41 changes: 41 additions & 0 deletions .github/workflows/tests-operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: tests-operator

on:
pull_request:
branches-ignore:
- 'gh-pages'

jobs:
deploy_operator:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

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

- name: Deploy the operator
uses: ./.github/actions/deploy-operator

- name: Deploy a cluster
run: |
cat <<EOF | kubectl apply -f -
# Example of PostgreSQL cluster
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
storage:
size: 1Gi
EOF
- name: Verify that the cluster is ready
uses: ./.github/actions/verify-ready-instances
with:
cluster-name: cluster-example
ready-instances: 3
4 changes: 3 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# responsible for code in a repository. For details, please refer to
# https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners

* @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd
* @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd
/.github @fcanovai @gbartolini @leonardoce @mnencia @phisco @sxd @itay-grudev
/charts/cluster @itay-grudev
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# CloudNativePG Helm Chart
# CloudNativePG Helm Charts

## Operator chart

Helm chart to install the
[CloudNativePG operator](https://cloudnative-pg.io), originally created and sponsored by
[EDB](https://www.enterprisedb.com/) to manage PostgreSQL workloads on any supported Kubernetes cluster
running in private, public, or hybrid cloud environments.

**NOTE**: supports only the latest point release of the CloudNativePG operator.

## Deployment using the latest release

```console
helm repo add cnpg https://cloudnative-pg.github.io/charts
helm upgrade --install cnpg \
Expand All @@ -17,27 +16,21 @@ helm upgrade --install cnpg \
cnpg/cloudnative-pg
```

## Deployment using local chart
Refer to the [Operator Chart documentation](charts/cloudnative-pg/README.md) for advanced configuration and monitoring.

To deploy the operator from sources you can run the following command:
## Cluster chart

Helm chart to install a CloudNativePG database cluster.

```console
helm upgrade --install cnpg \
--namespace cnpg-system \
helm repo add cnpg https://cloudnative-pg.github.io/charts
helm upgrade --install database \
--namespace database \
--create-namespace \
charts/cloudnative-pg
cnpg/cluster
```

## Sandbox for CloudNativePG

CloudNativePG Sandbox, aka `cnpg-sandbox`, is now deprecated and has been removed from this project.

All its resources have been moved in the primary `cloudnativepg` repository, in the form of:

- documentation (["Quickstart"](https://cloudnative-pg.io/documentation/current/quickstart/)
and ["Monitoring"](https://cloudnative-pg.io/documentation/current/monitoring/) sections)
- plugin commands ([`pgbench`](https://cloudnative-pg.io/documentation/current/cnpg-plugin/#benchmarking-the-database-with-pgbench)
- manifests
Refer to the [Cluster Chart documentation](charts/cluster/README.md) for advanced configuration options.

## Contributing

Expand All @@ -46,4 +39,4 @@ Please read the [code of conduct](CODE-OF-CONDUCT.md) and the

## Copyright

Helm charts for CloudNativePG are distributed under Apache License 2.0.
Helm charts for CloudNativePG are distributed under [Apache License 2.0](LICENSE).
4 changes: 3 additions & 1 deletion charts/cloudnative-pg/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
apiVersion: v2
name: cloudnative-pg
description: CloudNativePG Helm Chart
description: CloudNativePG Operator Helm Chart
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
type: application
version: "0.20.1"
Expand All @@ -27,6 +27,8 @@ appVersion: "1.22.1"
sources:
- https://github.com/cloudnative-pg/charts
keywords:
- operator
- controller
- postgresql
- postgres
- database
Expand Down
2 changes: 1 addition & 1 deletion charts/cloudnative-pg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Version: 0.20.1](https://img.shields.io/badge/Version-0.20.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.22.1](https://img.shields.io/badge/AppVersion-1.22.1-informational?style=flat-square)

CloudNativePG Helm Chart
CloudNativePG Operator Helm Chart

**Homepage:** <https://cloudnative-pg.io>

Expand Down
1 change: 1 addition & 0 deletions charts/cluster/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples/*.test.yaml
23 changes: 23 additions & 0 deletions charts/cluster/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
31 changes: 31 additions & 0 deletions charts/cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright The CloudNativePG Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v2
name: cluster
description: Deploys and manages a CloudNativePG cluster and its associated resources.
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
type: application
version: 0.0.1
sources:
- https://github.com/cloudnative-pg/charts
keywords:
- postgresql
- postgres
- database
home: https://cloudnative-pg.io
maintainers:
- name: itay-grudev
email: [email protected]
Loading

0 comments on commit c939e3e

Please sign in to comment.