Skip to content

Commit 6463a02

Browse files
FayKnCopilot
andauthored
RRR: Refactor, RabbitMQ and Redis (#36)
* Feat/schema (#31) * inited extra controller and added extra CRD * sample config * Major refactor to allow for code reuse with the rabbitMQ controller * RabbitMQ code writen and some refactors * rabbitmq tests and refactor of tests + excluded users in rabbitMQ and better permissions check * requeue interval globalized and added for rmq * refactor of reconciliation logic and sync signal is given off for rbmq permissions * Moved permission granting to reconcile functions to avoid a loop * added deletion of stale vhosts * Moved reasons to a const, condition state in shared logic * Added finalizer * removed multi group layout from agents.md and tightened up tests from agent.md * tests fixed * workflows updated version * Native builds for images * Update build actions to latest * Remove old sample Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix nitpick from copilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Removed a useless emit function and error on multiple secrets * don't reque on error and use right priviliege drift interval * fmt * Run tests in paralel & cleanup tests (#38) * First pass from Codex, test speed halved on my laptop; needs review * cleanup run * Squashed commit of the following: commit 66d2121 Author: Fay <61050421+FayKn@users.noreply.github.com> Date: Tue Mar 17 08:45:09 2026 +0100 don't reque on error and use right priviliege drift interval commit f1330c9 Author: Fay <61050421+FayKn@users.noreply.github.com> Date: Tue Mar 17 08:27:02 2026 +0100 Removed a useless emit function and error on multiple secrets commit 4ce8a32 Author: Fay <61050421+FayKn@users.noreply.github.com> Date: Mon Mar 16 15:53:52 2026 +0100 Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> commit ed02322 Author: Fay <61050421+FayKn@users.noreply.github.com> Date: Mon Mar 16 15:53:03 2026 +0100 fix nitpick from copilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fixed race condition and new line bug * run only certain contexts * updated postrges and rabbitmq * reduce image pulls * e2e arm runner * back to x86 * namespace block operator controller * Developer and ops person docs * Create CONTRIBUTING.md * Use array of digest sources * Update README.md * Feat/plugin like refactor (#40) * Move functions to own packages * tests fixed * moved a bit of code * Fix tests not running * Share reconcile logic and make e2e tests less flakey * instructions for adding new controller * Feat/redis (#39) * First pass by the gpt * Split files by concern * added redis mod test and fixed CNPG race condition. * docker compose CRs and fixed postgres to work in k8s * share test suite logic * fixed Copilot nits * fix lint * add Redis sample for readme cluster * Update DEVELOPER.md * fixed stuck e2e test * poll later action runners are not so fast so start polling later to clutter logs less --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent bfbacdc commit 6463a02

82 files changed

Lines changed: 11022 additions & 2799 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker-publish.yml

Lines changed: 98 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,30 @@ on:
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: ${{ github.repository }}
12-
PLATFORMS: linux/amd64,linux/arm64
1312

1413
jobs:
1514
build:
16-
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- platform: linux/amd64
20+
arch: amd64
21+
runner: ubuntu-latest
22+
- platform: linux/arm64
23+
arch: arm64
24+
runner: ubuntu-24.04-arm
25+
runs-on: ${{ matrix.runner }}
1726
permissions:
1827
contents: read
1928
packages: write
20-
id-token: write
2129

2230
steps:
2331
- name: Checkout repository
24-
uses: actions/checkout@v4
25-
26-
- name: Install cosign
27-
if: github.event_name != 'pull_request'
28-
uses: sigstore/cosign-installer@v3.10.0
32+
uses: actions/checkout@v6
2933

3034
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v3
35+
uses: docker/setup-buildx-action@v4
3236

3337
- name: Log into registry ${{ env.REGISTRY }}
3438
if: github.event_name != 'pull_request'
@@ -40,25 +44,98 @@ jobs:
4044

4145
- name: Extract Docker metadata
4246
id: meta
43-
uses: docker/metadata-action@v5
47+
uses: docker/metadata-action@v6
4448
with:
4549
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4650

47-
- name: Build and push Docker image
48-
id: build-and-push
49-
uses: docker/build-push-action@v6
51+
- name: Build Docker image
52+
if: github.event_name == 'pull_request'
53+
uses: docker/build-push-action@v7
5054
with:
5155
context: .
52-
platforms: ${{ env.PLATFORMS }}
53-
push: ${{ github.event_name != 'pull_request' }}
54-
tags: ${{ steps.meta.outputs.tags }}
56+
platforms: ${{ matrix.platform }}
5557
labels: ${{ steps.meta.outputs.labels }}
56-
cache-from: type=gha
57-
cache-to: type=gha,mode=max
58+
cache-from: type=gha,scope=${{ matrix.arch }}
59+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
5860

59-
- name: Sign the published Docker image
61+
- name: Build and push Docker image by digest
62+
if: github.event_name != 'pull_request'
63+
id: build
64+
uses: docker/build-push-action@v7
65+
with:
66+
context: .
67+
platforms: ${{ matrix.platform }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
70+
cache-from: type=gha,scope=${{ matrix.arch }}
71+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
72+
73+
- name: Export image digest
6074
if: github.event_name != 'pull_request'
75+
run: |
76+
mkdir -p "$RUNNER_TEMP/digests"
77+
digest="${{ steps.build.outputs.digest }}"
78+
touch "$RUNNER_TEMP/digests/${digest#sha256:}"
79+
80+
- name: Upload image digest
81+
if: github.event_name != 'pull_request'
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: digests-${{ matrix.arch }}
85+
path: ${{ runner.temp }}/digests/*
86+
if-no-files-found: error
87+
retention-days: 1
88+
89+
merge:
90+
if: github.event_name != 'pull_request'
91+
needs: build
92+
runs-on: ubuntu-latest
93+
permissions:
94+
contents: read
95+
packages: write
96+
id-token: write
97+
98+
steps:
99+
- name: Install cosign
100+
uses: sigstore/cosign-installer@v3.10.0
101+
102+
- name: Set up Docker Buildx
103+
uses: docker/setup-buildx-action@v4
104+
105+
- name: Log into registry ${{ env.REGISTRY }}
106+
uses: docker/login-action@v3
107+
with:
108+
registry: ${{ env.REGISTRY }}
109+
username: ${{ github.actor }}
110+
password: ${{ secrets.GITHUB_TOKEN }}
111+
112+
- name: Extract Docker metadata
113+
id: meta
114+
uses: docker/metadata-action@v6
115+
with:
116+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
117+
118+
- name: Download image digests
119+
uses: actions/download-artifact@v4
120+
with:
121+
path: ${{ runner.temp }}/digests
122+
pattern: digests-*
123+
merge-multiple: true
124+
125+
- name: Create multi-arch manifest
126+
working-directory: ${{ runner.temp }}/digests
127+
env:
128+
DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta.outputs.json }}
129+
run: |
130+
sources=()
131+
for digest_file in *; do
132+
sources+=("${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:${digest_file}")
133+
done
134+
docker buildx imagetools create \
135+
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
136+
"${sources[@]}"
137+
138+
- name: Sign the published Docker image
61139
env:
62140
TAGS: ${{ steps.meta.outputs.tags }}
63-
DIGEST: ${{ steps.build-and-push.outputs.digest }}
64-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
141+
run: echo "${TAGS}" | xargs -r -I {} cosign sign --yes {}

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Clone the code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v6
1414

1515
- name: Setup Go
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@v6
1717
with:
1818
go-version-file: go.mod
1919

.github/workflows/release-setup-file.yml

Lines changed: 77 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,74 @@ permissions:
1111
env:
1212
REGISTRY: ghcr.io
1313
IMAGE_NAME: ${{ github.repository }}
14-
PLATFORMS: linux/amd64,linux/arm64
1514

1615
jobs:
16+
build:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- platform: linux/amd64
22+
arch: amd64
23+
runner: ubuntu-latest
24+
- platform: linux/arm64
25+
arch: arm64
26+
runner: ubuntu-24.04-arm
27+
runs-on: ${{ matrix.runner }}
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v6
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v4
35+
36+
- name: Log into registry ${{ env.REGISTRY }}
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Build and push release image by digest
44+
id: build
45+
uses: docker/build-push-action@v7
46+
with:
47+
context: .
48+
platforms: ${{ matrix.platform }}
49+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
50+
cache-from: type=gha,scope=${{ matrix.arch }}
51+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
52+
53+
- name: Export image digest
54+
run: |
55+
mkdir -p "$RUNNER_TEMP/digests"
56+
digest="${{ steps.build.outputs.digest }}"
57+
touch "$RUNNER_TEMP/digests/${digest#sha256:}"
58+
59+
- name: Upload image digest
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: digests-${{ matrix.arch }}
63+
path: ${{ runner.temp }}/digests/*
64+
if-no-files-found: error
65+
retention-days: 1
66+
1767
release:
68+
needs: build
1869
runs-on: ubuntu-latest
1970

2071
steps:
2172
- name: Checkout
22-
uses: actions/checkout@v4
73+
uses: actions/checkout@v6
2374

2475
- name: Setup Go
25-
uses: actions/setup-go@v5
76+
uses: actions/setup-go@v6
2677
with:
2778
go-version-file: go.mod
2879

2980
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
81+
uses: docker/setup-buildx-action@v4
3182

3283
- name: Log into registry ${{ env.REGISTRY }}
3384
uses: docker/login-action@v3
@@ -36,20 +87,32 @@ jobs:
3687
username: ${{ github.actor }}
3788
password: ${{ secrets.GITHUB_TOKEN }}
3889

39-
- name: Build and push release image
40-
id: build-and-push
41-
uses: docker/build-push-action@v6
90+
- name: Download image digests
91+
uses: actions/download-artifact@v4
4292
with:
43-
context: .
44-
platforms: ${{ env.PLATFORMS }}
45-
push: true
46-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
47-
cache-from: type=gha
48-
cache-to: type=gha,mode=max
93+
path: ${{ runner.temp }}/digests
94+
pattern: digests-*
95+
merge-multiple: true
96+
97+
- name: Create multi-arch release image
98+
id: merge
99+
working-directory: ${{ runner.temp }}/digests
100+
run: |
101+
image="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
102+
tag="${{ github.ref_name }}"
103+
sources=()
104+
for digest_file in *; do
105+
sources+=("${image}@sha256:${digest_file}")
106+
done
107+
docker buildx imagetools create \
108+
-t "${image}:${tag}" \
109+
"${sources[@]}"
110+
digest="$(docker buildx imagetools inspect "${image}:${tag}" --format '{{json .Manifest}}' | jq -r '.digest')"
111+
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
49112
50113
- name: Build installer manifest pinned to release image digest
51114
run: |
52-
make build-installer IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
115+
make build-installer IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.merge.outputs.digest }}
53116
54117
- name: Publish GitHub release with install.yaml
55118
uses: softprops/action-gh-release@v2

.github/workflows/test-e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Clone the code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v6
1414

1515
- name: Setup Go
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@v6
1717
with:
1818
go-version-file: go.mod
1919

@@ -35,4 +35,4 @@ jobs:
3535
POSTGRES_DB: testdb
3636
run: |
3737
go mod tidy
38-
CERT_MANAGER_INSTALL_SKIP=true make test-e2e
38+
make test-e2e

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Clone the code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v6
1414

1515
- name: Setup Go
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@v6
1717
with:
1818
go-version-file: go.mod
1919

AGENTS.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ Makefile Build/test/deploy commands
1616
PROJECT Kubebuilder metadata Auto-generated (DO NOT EDIT)
1717
```
1818

19-
**Multi-group layout** (for projects with multiple API groups):
20-
```
21-
api/<group>/<version>/*_types.go CRD schemas by group
22-
internal/controller/<group>/* Controllers by group
23-
internal/webhook/<group>/<version>/* Webhooks by group and version (if present)
24-
```
25-
26-
Multi-group layout organizes APIs by group name (e.g., `batch`, `apps`). Check the `PROJECT` file for `multigroup: true`.
27-
28-
**To convert to multi-group layout:**
29-
1. Run: `kubebuilder edit --multigroup=true`
30-
2. Move APIs: `mkdir -p api/<group> && mv api/<version> api/<group>/`
31-
3. Move controllers: `mkdir -p internal/controller/<group> && mv internal/controller/*.go internal/controller/<group>/`
32-
4. Move webhooks (if present): `mkdir -p internal/webhook/<group> && mv internal/webhook/<version> internal/webhook/<group>/`
33-
5. Update import paths in all files
34-
6. Fix `path` in `PROJECT` file for each resource
35-
7. Update test suite CRD paths (add one more `..` to relative paths)
36-
3719
## Critical Rules
3820

3921
### Never Edit These (Auto-Generated)
@@ -52,9 +34,9 @@ Do not move files around. The CLI expects files in specific locations.
5234
### Always Use CLI Commands
5335
Always use `kubebuilder create api` and `kubebuilder create webhook` to scaffold. Do NOT create files manually.
5436

55-
### E2E Tests Require an Isolated Kind Cluster
56-
The e2e tests are designed to validate the solution in an isolated environment (similar to GitHub Actions CI).
57-
Ensure you run them against a dedicated [Kind](https://kind.sigs.k8s.io/) cluster (not your “real” dev/prod cluster).
37+
### E2E Tests
38+
- E2E test should be added for most major features, run with `make test-e2e`.
39+
- tests should be run on a kind cluster; this will be created by the test command.
5840

5941
## After Making Changes
6042

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Contributing
2+
3+
We – [Delta10 B.V.](https://www.delta10.nl/) and the maintainers of this project – know we can only build together with you. Thus we appreciate your input, enjoy feedback and welcome improvements to this project and are very open to collaboration.
4+
5+
By contributing to this project, you accept and agree the the terms and conditions as specified in the [Contributor Licence Agreement](CLA.md).
6+
7+
## Problems, suggestions and questions in Issues
8+
9+
You don't need to change any of our code or documentation to be a contributor. Please help development by reporting problems, suggesting changes and asking questions. To do this, you can [create a GitLab Issue](https://docs.gitlab.com/ee/user/project/issues/index.html#issues) for this project in the [issues section](https://gitlab.com/delta10/project-template/issues).
10+
11+
## Documentation and code in Merge Requests
12+
13+
If you want to add to the documentation or code of one of our projects you should push a branch and make a Merge Request. If you never used GitLab, get up to speed by reading about the [GitLab Flow](https://about.gitlab.com/2014/09/29/gitlab-flow/).
14+
15+
### 1. Make your changes
16+
17+
This project uses the **OneFlow branching model** and workflow. When you've forked this repository, please make sure to create a feature branch following the OneFlow model. Read this [short blogpost](http://endoflineblog.com/oneflow-a-git-branching-model-and-workflow) when you're not yet familiar with OneFlow.
18+
19+
Add your changes in commits [with a message that explains them](https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message). Document choices or decisions you make in the commit message, this will enable everyone to be informed of your choices in the future.
20+
21+
If you are adding code, make sure you've added and updated the relevant documentation and tests before you submit your Merge Request. Make sure to write tests that show the behaviour of the newly added or changed code.
22+
23+
### 2. Merge Request
24+
25+
When submitting the Merge Request, please accompany it with a description of the problem you are trying to address and the issue numbers that this Merge Request fixes/addresses.
26+
27+
### 3. Improve
28+
29+
All contributions have to be reviewed by someone.
30+
31+
It could be that your contribution can be merged immediately by a maintainer. However, usually, a new Merge Request needs some improvements before it can be merged. Other contributors (or our automatic testing system) might have feedback. If this is the case the reviewing maintainer will help you improve your documentation and code.
32+
33+
If your documentation and code have passed human review and have passed the automated tests, it is merged.
34+
35+
### 4. Celebrate
36+
37+
Your ideas, documentation and code have become an integral part of this project.
38+
39+
---
40+
41+
For more information on how to use and contribute to this project, please read the [`README`](README.md).

0 commit comments

Comments
 (0)