Skip to content

Commit ceb9cce

Browse files
authored
Fix rolereconciler-cluster-role ClusterRole rule workaround (#32)
* fix `rolereconciler-cluster-role` ClusterRole rule workaround * remove obsolete GitHub release workflow post-processing step
1 parent 0de9578 commit ceb9cce

5 files changed

Lines changed: 14 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ jobs:
4747
env:
4848
GITHUB_USER_NAME: ${{ github.actor }}
4949
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
- name: Patch ClusterRole rolereconciler-cluster-role with secrets permission as the RoleReconciler is watching referenced Secrets
51-
run: |
52-
yq -i 'select(.metadata.name == "rolereconciler-cluster-role").rules += [{"apiGroups": [""], "resources": ["secrets"], "verbs": ["get", "list", "watch"]}]' operator/build/helm/kubernetes/postgresql-operator/templates/clusterrole.yaml
53-
shell: bash
5450
- name: Package Helm chart
5551
run: |
5652
tar -czf operator/build/helm/kubernetes/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz -C operator/build/helm/kubernetes postgresql-operator

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AboutBits PostgreSQL Operator
22

3-
AboutBits PostgreSQL Operator is a Kubernetes operator that helps you manage PostgreSQL databases, roles (users), and privileges in a declarative way using Custom Resource Definitions (CRDs).
3+
AboutBits PostgreSQL Operator is a Kubernetes operator that helps you manage PostgreSQL databases, schemas, roles (users), and privileges in a declarative way using Custom Resource Definitions (CRDs).
44

55
## Architecture
66

@@ -130,6 +130,7 @@ metadata:
130130
spec:
131131
clusterRef:
132132
name: my-postgres-connection
133+
database: my_app_db
133134
name: my_app_schema
134135
reclaimPolicy: Retain
135136
owner: dba_user
@@ -208,7 +209,7 @@ To build the project, the following prerequisites must be met:
208209
209210
### Setup
210211
211-
To get started, you first need to configure the GitHub Maven Package registry to be able to pull the [AbouBits Java Checkstyle Config](https://github.com/aboutbits/java-checkstyle-config) from the GitHub Gradle registry.
212+
To get started, you first need to configure the GitHub Gradle Packages registry to be able to pull the [AbouBits Java Checkstyle Config](https://github.com/aboutbits/java-checkstyle-config) from the GitHub Packages registry.
212213
213214
Follow https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry
214215
The guide basically tells you to click on `Generate new token (classic)` on https://github.com/settings/tokens, add the permission `read:packages` and copy the token which we need below.

operator/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ dependencies {
99
implementation("io.quarkus:quarkus-arc")
1010
implementation("io.quarkus:quarkus-config-yaml")
1111
implementation("io.quarkus:quarkus-jackson")
12+
implementation("io.quarkus:quarkus-jdbc-postgresql")
1213
implementation("io.quarkus:quarkus-kubernetes-client")
1314
implementation("io.quarkus:quarkus-logging-json")
1415
implementation("io.quarkus:quarkus-micrometer")
1516
implementation("io.quarkus:quarkus-micrometer-registry-prometheus")
16-
implementation("io.quarkus:quarkus-jdbc-postgresql")
1717
implementation("io.quarkus:quarkus-smallrye-health")
1818

1919
/**
@@ -49,6 +49,7 @@ dependencies {
4949
* Quarkiverse Operator SDK
5050
*/
5151
implementation("io.quarkiverse.operatorsdk:quarkus-operator-sdk")
52+
implementation("io.quarkiverse.operatorsdk:quarkus-operator-sdk-annotations")
5253

5354
/**
5455
* SCRAM

operator/src/main/java/it/aboutbits/postgresql/crd/role/RoleReconciler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import io.javaoperatorsdk.operator.processing.event.source.EventSource;
1414
import io.javaoperatorsdk.operator.processing.event.source.SecondaryToPrimaryMapper;
1515
import io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource;
16+
import io.quarkiverse.operatorsdk.annotations.AdditionalRBACRules;
17+
import io.quarkiverse.operatorsdk.annotations.RBACRule;
1618
import it.aboutbits.postgresql.core.BaseReconciler;
1719
import it.aboutbits.postgresql.core.CRPhase;
1820
import it.aboutbits.postgresql.core.CRStatus;
@@ -32,6 +34,13 @@
3234

3335
@NullMarked
3436
@Slf4j
37+
@AdditionalRBACRules({
38+
@RBACRule(
39+
apiGroups = {""},
40+
resources = {"secrets"},
41+
verbs = {"get", "list", "watch"}
42+
)
43+
})
3544
@RequiredArgsConstructor
3645
public class RoleReconciler
3746
extends BaseReconciler<Role, CRStatus>

operator/src/main/resources/application.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ quarkus:
162162
memory: 512Mi
163163
prometheus:
164164
generate-service-monitor: false
165-
# Report bug as this or adding the ClusterRole and ClusterRoleBinding in operator/src/main/kubernetes/kubernetes.yml does not work, JOSDK simply ignores the ClusterRoleBinding
166-
#rbac:
167-
# cluster-roles:
168-
# "rolereconciler-cluster-role":
169-
# name: rolereconciler-cluster-role
170-
# policy-rules:
171-
# "secrets":
172-
# api-groups: [""]
173-
# resources: ["secrets"]
174-
# verbs: ["get", "list", "watch"]
175165
startup-probe:
176166
http-action-port-name: http
177167
initial-delay: PT2S

0 commit comments

Comments
 (0)