You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`path`|`string`| The absolute path inside the operator Pod to the file containing the admin credentials. | Yes |
35
37
36
-
Use this option when the credentials are mounted as a file instead of a Kubernetes Secret.
37
38
38
39
#### File format
39
40
@@ -51,33 +52,93 @@ The file must contain JSON with the following fields:
51
52
52
53
#### Mount the credentials file
53
54
54
-
The file must be accessible inside the operator pod at the path specified in `adminSecretFileRef.path`. Mount it using a Volume and VolumeMount on the operator Deployment:
55
+
The file must be accessible inside the operator Pod at the path in `adminSecretFileRef.path`.
56
+
57
+
The Helm chart exposes the `app.volumes` and `app.volumeMounts` values for this.
58
+
Both take the raw Kubernetes syntax, so any volume source that provides a file works.
59
+
60
+
The value of `adminSecretFileRef.path` is the `mountPath` plus the name of the file. The volume source decides the file name:
|`csi` (Secrets Store CSI driver) | the `objectAlias` of the object |
66
+
67
+
See [Using a file reference](#using-a-file-reference-adminsecretfileref) in the examples for a complete setup with each volume source.
68
+
69
+
## Examples
70
+
71
+
### Using a Kubernetes Secret (`adminSecretRef`)
55
72
56
73
```yaml
57
-
apiVersion: apps/v1
58
-
kind: Deployment
74
+
apiVersion: v1
75
+
kind: Secret
59
76
metadata:
60
-
name: postgresql-operator
77
+
name: my-db-secret
78
+
type: kubernetes.io/basic-auth
79
+
stringData:
80
+
username: postgres
81
+
password: password
82
+
```
83
+
84
+
```yaml
85
+
apiVersion: postgresql.aboutbits.it/v1
86
+
kind: ClusterConnection
87
+
metadata:
88
+
name: my-postgres-connection
61
89
spec:
62
-
template:
63
-
spec:
64
-
containers:
65
-
- name: postgresql-operator
66
-
volumeMounts:
67
-
- name: db-credentials
68
-
mountPath: /mnt/secrets
69
-
readOnly: true
70
-
volumes:
71
-
- name: db-credentials
72
-
secret:
73
-
secretName: db-credentials-secret
90
+
adminSecretRef:
91
+
name: my-db-secret
92
+
host: localhost
93
+
port: 5432
94
+
database: postgres
95
+
# Example parameters
96
+
parameters:
97
+
ApplicationName: "k8s-operator"# Helps identify this connection in Postgres logs
98
+
#sslmode: "require" # Enforce SSL encryption
99
+
#connectTimeout: "10" # Timeout in seconds for connection attempts
74
100
```
75
101
76
-
> **Note:** The volume source can be any type that provides a file.
102
+
### Using a file reference (`adminSecretFileRef`)
77
103
78
-
##### With the Helm chart
104
+
```yaml
105
+
apiVersion: postgresql.aboutbits.it/v1
106
+
kind: ClusterConnection
107
+
metadata:
108
+
name: my-postgres-connection
109
+
spec:
110
+
adminSecretFileRef:
111
+
path: "/mnt/secrets/db-credentials.json"
112
+
host: localhost
113
+
port: 5432
114
+
database: postgres
115
+
# Example parameters
116
+
parameters:
117
+
ApplicationName: "k8s-operator"# Helps identify this connection in Postgres logs
118
+
#sslmode: "require" # Enforce SSL encryption
119
+
#connectTimeout: "10" # Timeout in seconds for connection attempts
120
+
```
121
+
122
+
The mount that creates `/mnt/secrets/db-credentials.json` depends on the volume source.
79
123
80
-
The chart exposes the `app.volumes` and `app.volumeMounts` values. Both take the raw Kubernetes syntax, so any volume source works. Pass them in your own values file:
See the [installation section](../README.md#helm-chart) of the README for the chart URL.
157
+
Use this option to read the credentials from an external secret store, for example AWS Secrets Manager.
99
158
100
-
##### With the Secrets Store CSI driver
159
+
> **Note:** Install the [Secrets Store CSI driver](https://secrets-store-csi-driver.sigs.k8s.io/getting-started/installation) and the [provider](https://secrets-store-csi-driver.sigs.k8s.io/providers) for your secret store first. Neither the operator nor the chart installs them. Without the driver, the operator Pod stays in `ContainerCreating` and reports a failed mount.
101
160
102
-
Use this option to read the credentials from an external secret store, for example AWS Secrets Manager. The chart does not create the `SecretProviderClass`, so you have to apply it yourself:
161
+
The chart does not create the `SecretProviderClass`, so you have to apply it yourself. Its `objectAlias` becomes the file name:
103
162
104
163
```yaml
105
164
apiVersion: secrets-store.csi.x-k8s.io/v1
@@ -114,7 +173,9 @@ spec:
114
173
objectAlias: "db-credentials.json"
115
174
```
116
175
117
-
Then reference it from the chart values:
176
+
> **Note:** The `SecretProviderClass` must live in the namespace of the operator.
177
+
178
+
Then mount it through the chart values:
118
179
119
180
```yaml
120
181
app:
@@ -131,53 +192,26 @@ app:
131
192
readOnly: true
132
193
```
133
194
134
-
> **Note:** The `SecretProviderClass` must live in the namespace of the operator.
135
-
136
-
### Examples
195
+
#### Without the Helm chart
137
196
138
-
#### Using a Kubernetes Secret (`adminSecretRef`)
197
+
If you deploy the operator directly from the OCI image, set the same `volumes` and `volumeMounts` fields on the Deployment:
139
198
140
199
```yaml
141
-
apiVersion: v1
142
-
kind: Secret
143
-
metadata:
144
-
name: my-db-secret
145
-
type: kubernetes.io/basic-auth
146
-
stringData:
147
-
username: postgres
148
-
password: password
149
-
```
150
-
151
-
```yaml
152
-
apiVersion: postgresql.aboutbits.it/v1
153
-
kind: ClusterConnection
154
-
metadata:
155
-
name: my-postgres-connection
156
-
spec:
157
-
adminSecretRef:
158
-
name: my-db-secret
159
-
host: localhost
160
-
port: 5432
161
-
database: postgres
162
-
# Example parameters
163
-
parameters:
164
-
ApplicationName: "k8s-operator" # Helps identify this connection in Postgres logs
165
-
#sslmode: "require" # Enforce SSL encryption
166
-
#connectTimeout: "10" # Timeout in seconds for connection attempts
167
-
```
168
-
169
-
#### Using a file reference (`adminSecretFileRef`)
0 commit comments