-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apepg prestart crash in 0.9 (#1117)
- Loading branch information
1 parent
e56f9bb
commit 982e119
Showing
6 changed files
with
245 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
apiVersion: apps.kubeblocks.io/v1alpha1 | ||
kind: ComponentDefinition | ||
metadata: | ||
name: {{ include "apecloud-postgresql.compDefApecloudPostgresql14" . }} | ||
labels: | ||
{{- include "apecloud-postgresql.labels" . | nindent 4 }} | ||
spec: | ||
provider: kubeblocks | ||
description: ApeCloud PostgreSQL is a database that is compatible with PostgreSQL syntax and achieves high availability through the utilization of the RAFT consensus protocol. | ||
serviceKind: postgresql | ||
serviceVersion: {{ .Values.componentServiceVersion.apecloudPostgresql14 }} | ||
services: | ||
- name: default | ||
spec: | ||
ports: | ||
- name: postgresql | ||
port: 3306 | ||
targetPort: postgresql | ||
roleSelector: leader | ||
- name: replication | ||
serviceName: replication | ||
spec: | ||
ports: | ||
- name: raft | ||
port: 13306 | ||
targetPort: raft | ||
podService: true | ||
disableAutoProvision: true | ||
volumes: | ||
- highWatermark: 0 | ||
name: data | ||
needSnapshot: false | ||
roles: | ||
- name: leader | ||
serviceable: true | ||
writable: true | ||
votable: true | ||
- name: follower | ||
serviceable: true | ||
writable: false | ||
votable: true | ||
- name: learner | ||
serviceable: false | ||
writable: false | ||
votable: false | ||
configs: | ||
- name: postgresql-consensusset-configuration | ||
templateRef: apecloud-postgresql14-configuration | ||
constraintRef: apecloud-postgresql14-cc | ||
keys: | ||
- postgresql.conf | ||
namespace: {{ .Release.Namespace }} | ||
volumeName: postgresql-config | ||
defaultMode: 0444 | ||
scripts: | ||
- name: apecloud-postgresql-scripts | ||
templateRef: apecloud-postgresql-scripts | ||
namespace: {{ .Release.Namespace }} | ||
volumeName: scripts | ||
defaultMode: 0555 | ||
vars: | ||
- name: POSTGRES_USER | ||
valueFrom: | ||
credentialVarRef: | ||
compDef: {{ include "apecloud-postgresql.compDefApecloudPostgresql14" . }} | ||
name: postgres | ||
optional: false | ||
username: Required | ||
- name: POSTGRES_PASSWORD | ||
valueFrom: | ||
credentialVarRef: | ||
compDef: {{ include "apecloud-postgresql.compDefApecloudPostgresql14" . }} | ||
name: postgres | ||
optional: false | ||
password: Required | ||
systemAccounts: | ||
- name: postgres | ||
initAccount: true | ||
passwordGenerationPolicy: | ||
length: 10 | ||
numDigits: 5 | ||
numSymbols: 0 | ||
letterCase: MixedCases | ||
- name: kbadmin | ||
passwordGenerationPolicy: | ||
length: 10 | ||
letterCase: MixedCases | ||
numDigits: 5 | ||
numSymbols: 0 | ||
statement: CREATE USER $(USERNAME) SUPERUSER PASSWORD '$(PASSWD)'; | ||
lifecycleActions: | ||
roleProbe: | ||
builtinHandler: apecloud-postgresql | ||
periodSeconds: 1 | ||
timeoutSeconds: 1 | ||
accountProvision: | ||
customHandler: | ||
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
exec: | ||
command: | ||
- psql | ||
args: | ||
- -h$(KB_ACCOUNT_ENDPOINT) | ||
- -c | ||
- $(KB_ACCOUNT_STATEMENT) | ||
env: | ||
- name: PGUSER | ||
value: $(POSTGRES_USER) | ||
- name: PGPASSWORD | ||
value: $(POSTGRES_PASSWORD) | ||
runtime: | ||
initContainers: | ||
- command: | ||
- sh | ||
- -c | ||
- cp -r /bin/syncer /tools/ | ||
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.syncer.repository }}:{{ .Values.image.syncer.tag }} | ||
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }} | ||
name: init-syncer | ||
volumeMounts: | ||
- mountPath: /tools | ||
name: tools | ||
containers: | ||
- command: | ||
- /tools/syncer | ||
- --port | ||
- '3601' | ||
- -- | ||
- docker-entrypoint.sh | ||
- postgres | ||
env: | ||
- name: ALLOW_NOSSL | ||
value: 'true' | ||
- name: POD_IP | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.podIP | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
- name: PGUSER | ||
value: $(POSTGRES_USER) | ||
- name: PGPASSWORD | ||
value: $(POSTGRES_PASSWORD) | ||
- name: KB_SERVICE_CHARACTER_TYPE | ||
value: apecloud-postgresql | ||
- name: POSTGRESQL_PORT_NUMBER | ||
value: '5432' | ||
- name: PGDATA | ||
value: {{ .Values.dataPath }} | ||
- name: PGCONF | ||
value: {{ .Values.confPath }} | ||
- name: POSTGRESQL_MOUNTED_CONF_DIR | ||
value: {{ .Values.confMountPath }} | ||
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
imagePullPolicy: IfNotPresent | ||
name: postgresql | ||
ports: | ||
- containerPort: 5432 | ||
name: tcp-postgresql | ||
- containerPort: 15432 | ||
name: raft | ||
securityContext: | ||
runAsUser: 0 | ||
volumeMounts: | ||
- mountPath: /dev/shm | ||
name: dshm | ||
- mountPath: {{ .Values.dataMountPath }} | ||
name: data | ||
- mountPath: {{ .Values.confMountPath }} | ||
name: postgresql-config | ||
- mountPath: /kb-scripts | ||
name: scripts | ||
- mountPath: /tools | ||
name: tools | ||
volumes: | ||
- emptyDir: | ||
medium: Memory | ||
name: dshm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: apps.kubeblocks.io/v1alpha1 | ||
kind: ComponentVersion | ||
metadata: | ||
name: apecloud-postgresql | ||
labels: | ||
{{- include "apecloud-postgresql.labels" . | nindent 4 }} | ||
spec: | ||
compatibilityRules: | ||
- compDefs: | ||
- {{ include "apecloud-postgresql.compDefApecloudPostgresql14" . }} | ||
releases: | ||
- 14.11.0 | ||
releases: | ||
- name: 14.11.0 | ||
serviceVersion: 14.11.0 | ||
images: | ||
postgresql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters