Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
- name: Push tag to remote
run: ./gradlew --console=colored pushRelease
shell: bash
- uses: aboutbits/github-actions-base/github-create-release@v2
- name: Create GitHub Release
uses: aboutbits/github-actions-base/github-create-release@v2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Create GitHub Release
uses: aboutbits/github-actions-base/github-create-release@v2
- uses: aboutbits/github-actions-base/github-create-release@v2

Just a minor thing, but I had the rule of thumb that I only provide a message when I don't use another action. Because the action itself has then the different steps descriped. I would follow this rule. Can you please adjust it also for the other steps in this project?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't see why this should not work on other branches.
But we usually should only run the release.yml Workflow only against main.

We could add something like

    jobs:
      test:
        if: github.ref == 'refs/heads/main'
        uses: ./.github/workflows/test.yml
        secrets: inherit

so the release workflow only runs against main.

The build-and-release stage depends on test, so the whole build would fail.

image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

with:
tag-name: 'v${{ steps.nextVersion.outputs.version }}'
release-description: |
Expand All @@ -70,6 +71,9 @@ jobs:
helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz
```

With the Helm chart, the Custom Resource Definitions (CRDs) are installed automatically.
However, if you deploy the operator directly from the OCI image, the CRDs are not automatically applied and must be installed separately.

### Manual CRD Installation
```bash
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/clusterconnections.postgresql.aboutbits.it-v1.yml
Expand All @@ -86,3 +90,11 @@ jobs:
run: |
gh release upload v${{ steps.nextVersion.outputs.version }} operator/build/helm/kubernetes/*.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml
shell: bash
- name: Update README.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this also working as expected when the release is performed on another branch than the main branch?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #13 (comment)

Added the comment on the wrong review feedback comment.

run: |
sed -i "s|releases/download/v[0-9.]*/postgresql-operator-[0-9.]*.tgz|releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz|g" README.md
Comment thread
ThoSap marked this conversation as resolved.
git add README.md
# Guard against failing if there are no changes
git diff-index --quiet HEAD || git commit -m "Update README.md with version ${{ steps.nextVersion.outputs.version }}"
Comment thread
ThoSap marked this conversation as resolved.
Outdated
Comment thread
ThoSap marked this conversation as resolved.
Outdated
git push
Comment thread
ThoSap marked this conversation as resolved.
shell: bash
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ AboutBits PostgreSQL Operator is a Kubernetes operator that helps you manage Pos
└──────────────────────────────────────────────────────────────────────────┘
```

## Installation

### Helm Chart

```bash
helm install postgresql-operator https://github.com/AboutBits/postgresql-operator/releases/download/v0.1.1/postgresql-operator-0.1.1.tgz

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
helm install postgresql-operator https://github.com/AboutBits/postgresql-operator/releases/download/v0.1.1/postgresql-operator-0.1.1.tgz
helm install postgresql-operator https://github.com/aboutbits/postgresql-operator/releases/download/v0.1.1/postgresql-operator-0.1.1.tgz

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was technically right as the username is AboutBits, but URLs should preferably always be lowercase
https://github.com/AboutBits/

```

With the Helm chart, the Custom Resource Definitions (CRDs) are installed automatically.
However, if you deploy the operator directly from the OCI image, the CRDs are not automatically applied and must be installed separately.
See the release notes for the [latest version](https://github.com/AboutBits/postgresql-operator/releases/latest) for more information.
Comment thread
ThoSap marked this conversation as resolved.
Outdated

## Usage

This operator allows you to manage PostgreSQL resources using Kubernetes manifests.
Expand All @@ -43,6 +55,29 @@ Further documentation of each Custom Resource can be found here:
- [Grant](docs/grant.md) - Manage privileges.
- [DefaultPrivilege](docs/default-privilege.md) - Manage default privileges.

### Declarative Management

The Operator leverages the power of Kubernetes Custom Resource Definitions (CRDs) to manage PostgreSQL resources declaratively.
This means the Operator continuously reconciles the state of the cluster to match your desired state defined in the CRs.

**Updates**

If you modify a mutable field in a Custom Resource, the Operator automatically applies these changes to the PostgreSQL cluster. This includes:

- Changing a `Role` flags, password or comment.
Comment thread
ThoSap marked this conversation as resolved.
Outdated
- Updating `Grant` objects or privileges.
- Changing a `Schema` or `Database` owner.
- Updating the `Role` password if the password in the referenced Secret changes.

**Deletions**

Deleting a Custom Resource triggers the cleanup of the corresponding PostgreSQL object:

- For `Grant`, `DefaultPrivilege`, and `Role` resources, the operator revokes privileges or drops the role.
- For `Database` and `Schema` resources, the behavior depends on the `reclaimPolicy` (defaulting to `Retain` to prevent accidental data loss).

This ensures that your PostgreSQL cluster configuration always reflects your Kubernetes manifests, simplifying management and automation.

### Showcase

The following example shows how to set up a connection to a PostgreSQL cluster, create a database and schema, a login role (user), and configure permissions.
Expand Down Expand Up @@ -212,6 +247,28 @@ make test

Afterward, the project can be started in IntelliJ by navigating to `Run` -> `Run '...'`.

#### Generating jOOQ sources

To update the generated jOOQ sources from schema `pg_catalog`, you need to run the application in dev mode first to start the PostgreSQL Dev Service:

```bash
make run

# or

./gradlew :operator:quarkusDev
```

Once the application is running (and the database is available on port 5432), run the following command:

```bash
make generate-jooq

# or

./gradlew :generated:jooqCodegen
```

### Docker Environment

See [Docker Environment](docs/docker-environment.md) for setting up a local development environment using Quarkus Dev Services.
Expand Down