Skip to content

Commit 2121c85

Browse files
committed
feat: wip
1 parent 81c9d44 commit 2121c85

26 files changed

+170
-248
lines changed

.mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
go = '1.25.5'
55
golangci-lint = "2.7.2"
66
"aqua:operator-framework/operator-sdk" = "1.42.0"
7+
"aqua:kubernetes-sigs/kind" = "0.31.0"

config/crd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resources:
55
- bases/postgresql.easymile.com_postgresqlengineconfigurations.yaml
66
- bases/postgresql.easymile.com_postgresqldatabases.yaml
77
- bases/postgresql.easymile.com_postgresqluserroles.yaml
8-
- bases/postgresql.easymile.com_postgresqlpublications.yaml
8+
- bases/postgresql.easymile.com_postgresqlpublications.yaml
99
#+kubebuilder:scaffold:crdkustomizeresource
1010

1111
patchesStrategicMerge:

config/default/kustomization.yaml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ namePrefix: postgresql-operator-
1515
# someName: someValue
1616

1717
resources:
18-
- ../crd
19-
- ../rbac
20-
- ../manager
21-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
22-
# crd/kustomization.yaml
23-
#- ../webhook
24-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
25-
#- ../certmanager
26-
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
27-
#- ../prometheus
28-
# [METRICS] Expose the controller manager metrics service.
29-
- metrics_service.yaml
18+
# [METRICS] Expose the controller manager metrics service.
19+
- metrics_service.yaml
20+
- ../crd
21+
- ../rbac
22+
- ../manager
23+
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
24+
# crd/kustomization.yaml
25+
#- ../webhook
26+
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
27+
#- ../certmanager
28+
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
29+
#- ../prometheus
3030
# [NETWORK POLICY] Protect the /metrics endpoint and Webhook Server with NetworkPolicy.
3131
# Only Pod(s) running a namespace labeled with 'metrics: enabled' will be able to gather the metrics.
3232
# Only CR(s) which requires webhooks and are applied on namespaces labeled with 'webhooks: enabled' will
@@ -35,12 +35,11 @@ resources:
3535

3636
# Uncomment the patches line if you enable Metrics
3737
patches:
38-
# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443.
39-
# More info: https://book.kubebuilder.io/reference/metrics
40-
- path: manager_metrics_patch.yaml
41-
target:
42-
kind: Deployment
43-
38+
# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443.
39+
# More info: https://book.kubebuilder.io/reference/metrics
40+
- path: manager_metrics_patch.yaml
41+
target:
42+
kind: Deployment
4443
# Uncomment the patches line if you enable Metrics and CertManager
4544
# [METRICS-WITH-CERTS] To enable metrics protected with certManager, uncomment the following line.
4645
# This patch will protect the metrics with certManager self-signed certs.

config/default/manager_metrics_patch.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
- op: add
33
path: /spec/template/spec/containers/0/args/0
44
value: --metrics-bind-address=:8443
5+
- op: add
6+
path: /spec/template/spec/containers/0/ports/0
7+
value:
8+
name: https-metrics
9+
containerPort: 8443
10+
protocol: TCP

config/default/metrics_service.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ metadata:
99
namespace: system
1010
spec:
1111
ports:
12-
- name: https
13-
port: 8443
14-
protocol: TCP
15-
targetPort: 8443
12+
- name: https
13+
port: 8443
14+
protocol: TCP
15+
targetPort: 8443
1616
selector:
1717
control-plane: controller-manager
18-
app.kubernetes.io/name: postgresql-operator
18+
app.kubernetes.io/name: test

config/manager/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
resources:
22
- manager.yaml
3+
apiVersion: kustomize.config.k8s.io/v1beta1
4+
kind: Kustomization
5+
images:
6+
- name: controller
7+
newName: example.com/postgresql-operator
8+
newTag: v0.0.1

config/manager/manager.yaml

Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ kind: Namespace
33
metadata:
44
labels:
55
control-plane: controller-manager
6-
app.kubernetes.io/name: namespace
7-
app.kubernetes.io/instance: system
8-
app.kubernetes.io/component: manager
9-
app.kubernetes.io/created-by: postgresql-operator
10-
app.kubernetes.io/part-of: postgresql-operator
6+
app.kubernetes.io/name: test
117
app.kubernetes.io/managed-by: kustomize
128
name: system
139
---
@@ -18,23 +14,21 @@ metadata:
1814
namespace: system
1915
labels:
2016
control-plane: controller-manager
21-
app.kubernetes.io/name: deployment
22-
app.kubernetes.io/instance: controller-manager
23-
app.kubernetes.io/component: manager
24-
app.kubernetes.io/created-by: postgresql-operator
25-
app.kubernetes.io/part-of: postgresql-operator
17+
app.kubernetes.io/name: test
2618
app.kubernetes.io/managed-by: kustomize
2719
spec:
2820
selector:
2921
matchLabels:
3022
control-plane: controller-manager
23+
app.kubernetes.io/name: test
3124
replicas: 1
3225
template:
3326
metadata:
3427
annotations:
3528
kubectl.kubernetes.io/default-container: manager
3629
labels:
3730
control-plane: controller-manager
31+
app.kubernetes.io/name: test
3832
spec:
3933
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
4034
# according to the platforms which are supported by your solution.
@@ -57,46 +51,48 @@ spec:
5751
# values:
5852
# - linux
5953
securityContext:
54+
# Projects are configured by default to adhere to the "restricted" Pod Security Standards.
55+
# This ensures that deployments meet the highest security requirements for Kubernetes.
56+
# For more details, see: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
6057
runAsNonRoot: true
61-
# TODO(user): For common cases that do not require escalating privileges
62-
# it is recommended to ensure that all your Pods/Containers are restrictive.
63-
# More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
64-
# Please uncomment the following code if your project does NOT have to work on old Kubernetes
65-
# versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
66-
# seccompProfile:
67-
# type: RuntimeDefault
58+
seccompProfile:
59+
type: RuntimeDefault
6860
containers:
69-
- command:
70-
- /manager
71-
args:
72-
- --leader-elect
73-
image: controller:latest
74-
name: manager
75-
securityContext:
76-
allowPrivilegeEscalation: false
77-
capabilities:
78-
drop:
79-
- "ALL"
80-
livenessProbe:
81-
httpGet:
82-
path: /healthz
83-
port: 8081
84-
initialDelaySeconds: 15
85-
periodSeconds: 20
86-
readinessProbe:
87-
httpGet:
88-
path: /readyz
89-
port: 8081
90-
initialDelaySeconds: 5
91-
periodSeconds: 10
92-
# TODO(user): Configure the resources accordingly based on the project requirements.
93-
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
94-
resources:
95-
limits:
96-
cpu: 500m
97-
memory: 128Mi
98-
requests:
99-
cpu: 10m
100-
memory: 64Mi
61+
- command:
62+
- /manager
63+
args:
64+
- --leader-elect
65+
- --health-probe-bind-address=:8081
66+
image: controller:latest
67+
name: manager
68+
ports: []
69+
securityContext:
70+
allowPrivilegeEscalation: false
71+
capabilities:
72+
drop:
73+
- "ALL"
74+
livenessProbe:
75+
httpGet:
76+
path: /healthz
77+
port: 8081
78+
initialDelaySeconds: 15
79+
periodSeconds: 20
80+
readinessProbe:
81+
httpGet:
82+
path: /readyz
83+
port: 8081
84+
initialDelaySeconds: 5
85+
periodSeconds: 10
86+
# TODO(user): Configure the resources accordingly based on the project requirements.
87+
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
88+
resources:
89+
limits:
90+
cpu: 500m
91+
memory: 128Mi
92+
requests:
93+
cpu: 10m
94+
memory: 64Mi
95+
volumeMounts: []
96+
volumes: []
10197
serviceAccountName: controller-manager
10298
terminationGracePeriodSeconds: 10

config/rbac/auth_proxy_client_clusterrole.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

config/rbac/auth_proxy_role.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

config/rbac/auth_proxy_role_binding.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)