-
Notifications
You must be signed in to change notification settings - Fork 242
feat(plugins): allow plugin defintion #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3118f67
7782a65
b24dec1
0289e16
a4a30b7
f3a73a2
0b68ca7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -144,3 +144,19 @@ Postgres GID | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- 26 -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check if barman-cloud plugin exists and is enabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- define "cluster.useBarmanCloudPlugin" -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- $hasPlugin := false }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- if .Values.cluster.plugins }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- range .Values.cluster.plugins }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- if and (eq .name "barman-cloud.cloudnative-pg.io") .enabled }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- $hasPlugin = true }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- $hasPlugin }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+149
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the suggestion with the
Suggested change
Usage would then be as follows: {{ if include "cluster.findBarmanCloudPlugin" . | fromJson }}or: {{ include "cluster.findBarmanCloudPlugin" . | fromJson | .barmanObjectName | quote }} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,6 +67,10 @@ spec: | |||||||||||
| name: {{ . }} | ||||||||||||
| {{ end }} | ||||||||||||
| enablePDB: {{ .Values.cluster.enablePDB }} | ||||||||||||
| {{- with .Values.cluster.plugins }} | ||||||||||||
| plugins: | ||||||||||||
| {{- toYaml . | nindent 4}} | ||||||||||||
| {{- end }} | ||||||||||||
|
Comment on lines
+70
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the suggestion with the ObjectStore name and the corresponding change within the
Suggested change
|
||||||||||||
| postgresql: | ||||||||||||
| {{- if or (eq .Values.type "timescaledb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }} | ||||||||||||
| shared_preload_libraries: | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||
| {{ if and (eq (include "cluster.useBarmanCloudPlugin" .) "true") .Values.backups.enabled }} | ||||||
| apiVersion: barmancloud.cnpg.io/v1 | ||||||
| kind: ObjectStore | ||||||
| metadata: | ||||||
| name: {{ include "cluster.fullname" $ }}-object-store | ||||||
|
pha91 marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name is currently "hardcoded" but must also be specified within the plugin declaration. This creates the problem, that the user must know/predict the name to be used and if that ever changes (either by changing what
Suggested change
Possibly save the output of |
||||||
| spec: | ||||||
| configuration: | ||||||
| wal: | ||||||
| compression: {{ .Values.backups.wal.compression }} | ||||||
| {{- if .Values.backups.wal.encryption }} | ||||||
| encryption: {{ .Values.backups.wal.encryption }} | ||||||
| {{- end }} | ||||||
| maxParallel: {{ .Values.backups.wal.maxParallel }} | ||||||
| data: | ||||||
| compression: {{ .Values.backups.data.compression }} | ||||||
| {{- if .Values.backups.data.encryption }} | ||||||
| encryption: {{ .Values.backups.data.encryption }} | ||||||
| {{- end }} | ||||||
| jobs: {{ .Values.backups.data.jobs }} | ||||||
| {{- $d := dict "chartFullname" (include "cluster.fullname" .) "scope" .Values.backups "secretPrefix" "backup" -}} | ||||||
| {{- include "cluster.barmanObjectStoreConfig" $d | indent 2 }} | ||||||
| {{- end }} | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,9 +11,15 @@ metadata: | |||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||
| immediate: true | ||||||||||||||||||||||||||||||||||||||
| schedule: {{ .schedule | quote }} | ||||||||||||||||||||||||||||||||||||||
| method: {{ .method }} | ||||||||||||||||||||||||||||||||||||||
| backupOwnerReference: {{ .backupOwnerReference }} | ||||||||||||||||||||||||||||||||||||||
| cluster: | ||||||||||||||||||||||||||||||||||||||
| name: {{ include "cluster.fullname" $context }} | ||||||||||||||||||||||||||||||||||||||
| {{- if (eq (include "cluster.useBarmanCloudPlugin" $context ) "true") }} | ||||||||||||||||||||||||||||||||||||||
| pluginConfiguration: | ||||||||||||||||||||||||||||||||||||||
| name: barman-cloud.cloudnative-pg.io | ||||||||||||||||||||||||||||||||||||||
| method: plugin | ||||||||||||||||||||||||||||||||||||||
| {{ else }} | ||||||||||||||||||||||||||||||||||||||
| method: {{ .method }} | ||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this should be "hardcoded" in case the barman cloud plugin is enabled. In case it is possible to still use
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| {{ end -}} | ||||||||||||||||||||||||||||||||||||||
| {{ end }} | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,13 @@ spec: | |
| memory: 256Mi | ||
| limits: | ||
| cpu: 100m | ||
| memory: 256Mi | ||
| memory: 256Mi | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trailing spaces after |
||
| plugins: | ||
| - name: cnpg-i-plugin-example.my-org.io | ||
| enabled: true | ||
| parameters: | ||
| key1: value1 | ||
| key2: value2 | ||
| priorityClassName: mega-high | ||
| primaryUpdateStrategy: supervised | ||
| primaryUpdateMethod: restart | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the CRD
enabledis set totrueby default, thus this may be changed to something like this:Furthermore I guess this should also check if
isWALArchiveris true (but I am not sure):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending whether the first or no suggestion gets applied, the suggestion in #680 (comment) needs to get adapted (twice; in both nested template definitions).