Skip to content

Commit abad468

Browse files
committed
make postgres HA
1 parent 841bb30 commit abad468

File tree

1 file changed

+66
-65
lines changed

1 file changed

+66
-65
lines changed

server/src/addons/plugins/kuberoaddonsPostgres.ts

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -37,67 +37,81 @@ export class KuberoAddonPostgres extends Plugin implements IPlugin {
3737
options: ['13', '14', '15', '16', '17', 'latest'], // TODO - load this dynamically
3838
name: 'spec.postgres.image.tag',
3939
required: true,
40-
default: '16',
41-
description: 'Version of the PostgreSQL version to use',
40+
default: '17.6',
41+
description: 'Version of the PostgreSQL image to use',
4242
},
43-
/*
44-
'KuberoAddonPostgres.spec.postgres.settings.superuser.value': {
45-
type: 'text',
46-
label: 'Postgres Superuser*',
47-
name: 'spec.postgres.settings.superuser.value',
48-
default: 'postgres',
43+
'KuberoAddonPostgres.spec.postgres.replicaCount': {
44+
type: 'number',
45+
label: 'Replica Count',
46+
name: 'spec.postgres.replicaCount',
4947
required: true,
50-
description: 'Username for the "postgres" admin user',
48+
default: 1,
49+
description: 'Number of PostgreSQL replicas',
50+
},
51+
'KuberoAddonPostgres.spec.postgres.auth.enablePostgresUser': {
52+
type: 'switch',
53+
label: 'Enable Postgres User',
54+
name: 'spec.postgres.auth.enablePostgresUser',
55+
required: false,
56+
default: true,
57+
description: 'Enable the default postgres user',
5158
},
52-
*/
53-
'KuberoAddonPostgres.spec.postgres.settings.superuserPassword.value': {
59+
'KuberoAddonPostgres.spec.postgres.auth.postgresPassword': {
5460
type: 'text',
55-
label: 'Postgres Superuser Password*',
56-
name: 'spec.postgres.settings.superuserPassword.value',
61+
label: 'Postgres Password',
62+
name: 'spec.postgres.auth.postgresPassword',
63+
required: false,
5764
default: '',
58-
required: true,
59-
description: 'Password for the "postgres" admin user',
65+
description: 'Password for the default postgres user',
6066
},
61-
'KuberoAddonPostgres.spec.postgres.userDatabase.user.value': {
67+
'KuberoAddonPostgres.spec.postgres.auth.username': {
6268
type: 'text',
63-
label: 'Username*',
64-
name: 'spec.postgres.userDatabase.user.value',
69+
label: 'Additional Username',
70+
name: 'spec.postgres.auth.username',
71+
required: false,
6572
default: '',
66-
required: true,
6773
description: 'Username for an additional user to create',
6874
},
69-
'KuberoAddonPostgres.spec.postgres.userDatabase.password.value': {
75+
'KuberoAddonPostgres.spec.postgres.auth.password': {
7076
type: 'text',
71-
label: 'User Password*',
72-
name: 'spec.postgres.userDatabase.password.value',
77+
label: 'Additional User Password',
78+
name: 'spec.postgres.auth.password',
79+
required: false,
7380
default: '',
74-
required: true,
7581
description: 'Password for an additional user to create',
7682
},
77-
'KuberoAddonPostgres.spec.postgres.userDatabase.name.value': {
83+
'KuberoAddonPostgres.spec.postgres.auth.database': {
7884
type: 'text',
79-
label: 'Database*',
80-
name: 'spec.postgres.userDatabase.name.value',
81-
default: 'postgresql',
82-
required: true,
85+
label: 'Database Name',
86+
name: 'spec.postgres.auth.database',
87+
required: false,
88+
default: '',
8389
description: 'Name for a custom database to create',
8490
},
85-
'KuberoAddonPostgres.spec.postgres.storage.className': {
91+
'KuberoAddonPostgres.spec.postgres.persistence.storageClass': {
8692
type: 'select-storageclass',
8793
label: 'Storage Class',
88-
// options: ['default', 'local-path', 'nfs-client', 'rook-ceph-block'],
89-
name: 'spec.postgres.storage.className',
90-
default: 'default',
91-
required: true,
94+
name: 'spec.postgres.persistence.storageClass',
95+
required: false,
96+
default: '',
97+
description: 'Kubernetes StorageClass to use',
9298
},
93-
'KuberoAddonPostgres.spec.postgres.storage.requestedSize': {
99+
'KuberoAddonPostgres.spec.postgres.persistence.size': {
94100
type: 'text',
95-
label: 'Storage Size*',
96-
name: 'spec.postgres.storage.requestedSize',
97-
default: '1Gi',
98-
required: true,
101+
label: 'Storage Size',
102+
name: 'spec.postgres.persistence.size',
103+
required: false,
104+
default: '8Gi',
99105
description: 'Size of the storage',
100106
},
107+
'KuberoAddonPostgres.spec.postgres.persistence.accessModes[0]': {
108+
type: 'text',
109+
label: 'Access Modes',
110+
name: 'spec.postgres.persistence.accessModes[0]',
111+
required: false,
112+
default: 'ReadWriteOnce',
113+
description: 'Access modes for the persistent volume',
114+
},
101115
};
102116

103117
public env: any[] = [];
@@ -112,41 +126,28 @@ export class KuberoAddonPostgres extends Plugin implements IPlugin {
112126
spec: {
113127
postgres: {
114128
image: {
115-
tag: ""
129+
tag: "17.6"
116130
},
117-
resources: {},
118-
useDeployment: true,
119-
settings: {
120-
superuser: {
121-
value: "postgres"
122-
},
123-
superuserPassword: {
124-
value: "changeme"
125-
}
126-
},
127-
userDatabase: {
128-
name: {
129-
value: "kubero_database"
130-
},
131-
user: {
132-
value: "kubero_user"
133-
},
134-
password: {
135-
value: "kubero_password"
136-
}
131+
replicaCount: 1,
132+
auth: {
133+
enablePostgresUser: true,
134+
postgresPassword: "",
135+
username: "",
136+
password: "",
137+
database: ""
137138
},
138-
storage: {
139-
volumeName: "postgres-data",
140-
requestedSize: "1Gi",
141-
className: null,
139+
resources: {},
140+
persistence: {
141+
enabled: true,
142+
storageClass: "",
143+
size: "8Gi",
142144
accessModes: [
143145
"ReadWriteOnce"
144146
],
145-
keepPvc: false
146147
}
147148
}
148149
}
149-
},
150+
}
150151
}
151152

152153
protected additionalResourceDefinitions: object = {};

0 commit comments

Comments
 (0)