mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 18:08:47 +02:00
[UI] support Postgres version and pod resource changes + adding IOPS and throughput config options (#1824)
This commit is contained in:
+11
-2
@@ -126,6 +126,7 @@ edit
|
||||
if (i.metadata.selfLink) { delete i.metadata.selfLink }
|
||||
if (i.metadata.uid) { delete i.metadata.uid }
|
||||
if (i.metadata.resourceVersion) { delete i.metadata.resourceVersion }
|
||||
if (i.metadata.managedFields) { delete i.metadata.managedFields }
|
||||
|
||||
this.update()
|
||||
this.refs.yamlNice.innerHTML = yamlParser.safeDump(i.postgresql, {sortKeys: true})
|
||||
@@ -138,7 +139,15 @@ edit
|
||||
o.spec.enableMasterLoadBalancer = i.spec.enableMasterLoadBalancer || false
|
||||
o.spec.enableReplicaLoadBalancer = i.spec.enableReplicaLoadBalancer || false
|
||||
o.spec.enableConnectionPooler = i.spec.enableConnectionPooler || false
|
||||
o.spec.volume = { size: i.spec.volume.size }
|
||||
|
||||
o.spec.volume = {
|
||||
size: i.spec.volume.size,
|
||||
throughput: i.spec.volume.throughput || 125,
|
||||
iops: i.spec.volume.iops || 3000
|
||||
}
|
||||
|
||||
o.spec.postgresql = {}
|
||||
o.spec.postgresql.version = i.spec.postgresql.version
|
||||
|
||||
if ('users' in i.spec && typeof i.spec.users === 'object') {
|
||||
o.spec.users = Object.mapValues(i.spec.users, roleFlags =>
|
||||
@@ -166,7 +175,7 @@ edit
|
||||
].forEach(resourceType => {
|
||||
if (resourceType in resources) {
|
||||
const resourceClaim = resources[resourceType]
|
||||
if (typeof resourceClaim === '') {
|
||||
if (typeof resourceClaim === 'string') {
|
||||
o.spec.resources[section][resourceType] = resources[resourceType]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ help-general
|
||||
h3 Basics
|
||||
|
||||
p.
|
||||
The PostgreSQL operator will use your definition to create a new
|
||||
The Postgres Operator will use your definition to create a new
|
||||
PostgreSQL cluster for you. You can either copy the yaml definition
|
||||
to the repositiory or you can just hit create cluster.
|
||||
to a repositiory or hit create cluster (not available in prod).
|
||||
|
||||
+44
-1
@@ -266,6 +266,37 @@ new
|
||||
)
|
||||
.input-group-addon
|
||||
.input-units Gi
|
||||
tr
|
||||
td
|
||||
td Specify Iops and Throughput only if you need more than the default 3000 Iops and 125Mb/s EBS provides.
|
||||
|
||||
tr
|
||||
td Iops
|
||||
td
|
||||
.input-group
|
||||
input.form-control(
|
||||
ref='iops'
|
||||
type='number'
|
||||
value='{ iops }'
|
||||
onchange='{ iopsChange }'
|
||||
onkeyup='{ iopsChange }'
|
||||
)
|
||||
.input-group-addon
|
||||
.input-units
|
||||
|
||||
tr
|
||||
td Througput
|
||||
td
|
||||
.input-group
|
||||
input.form-control(
|
||||
ref='throughput'
|
||||
type='number'
|
||||
value='{ throughput }'
|
||||
onchange='{ throughputChange }'
|
||||
onkeyup='{ throughputChange }'
|
||||
)
|
||||
.input-group-addon
|
||||
.input-units MB/s
|
||||
|
||||
tr(if='{ config.users_visible }')
|
||||
td
|
||||
@@ -509,7 +540,9 @@ new
|
||||
enableConnectionPooler: true
|
||||
{{/if}}
|
||||
volume:
|
||||
size: "{{ volumeSize }}Gi"
|
||||
size: "{{ volumeSize }}Gi"{{#if iops}}
|
||||
iops: {{ iops }}{{/if}}{{#if throughput}}
|
||||
throughput: {{ throughput }}{{/if}}
|
||||
{{#if users}}
|
||||
users:{{#each users}}
|
||||
{{ state }}: []{{/each}}{{/if}}
|
||||
@@ -560,6 +593,8 @@ new
|
||||
enableReplicaLoadBalancer: this.enableReplicaLoadBalancer,
|
||||
enableConnectionPooler: this.enableConnectionPooler,
|
||||
volumeSize: this.volumeSize,
|
||||
iops: this.iops,
|
||||
throughput: this.throughput,
|
||||
users: this.users.valids,
|
||||
databases: this.databases.valids,
|
||||
ranges: this.ranges,
|
||||
@@ -624,6 +659,14 @@ new
|
||||
this.volumeSize = +e.target.value
|
||||
}
|
||||
|
||||
this.iopsChange = e => {
|
||||
this.iops = +e.target.value
|
||||
}
|
||||
|
||||
this.throughputChange = e => {
|
||||
this.throughput = +e.target.value
|
||||
}
|
||||
|
||||
this.updateDNSName = () => {
|
||||
this.dnsName = this.config.dns_format_string.format(
|
||||
this.name,
|
||||
|
||||
@@ -69,7 +69,7 @@ postgresqls
|
||||
td { cpu } / { cpu_limit }
|
||||
td { memory } / { memory_limit }
|
||||
td { volume_size }
|
||||
td { calcCosts(nodes, cpu, memory, volume_size) }$
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput) }$
|
||||
|
||||
td
|
||||
|
||||
@@ -152,7 +152,7 @@ postgresqls
|
||||
td { cpu } / { cpu_limit }
|
||||
td { memory } / { memory_limit }
|
||||
td { volume_size }
|
||||
td { calcCosts(nodes, cpu, memory, volume_size) }$
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput) }$
|
||||
|
||||
td
|
||||
|
||||
@@ -227,9 +227,22 @@ postgresqls
|
||||
+ '/' + encodeURI(cluster.name)
|
||||
)
|
||||
|
||||
const calcCosts = this.calcCosts = (nodes, cpu, memory, disk) => {
|
||||
costs = Math.max(nodes, opts.config.min_pods) * (toCores(cpu) * opts.config.cost_core + toMemory(memory) * opts.config.cost_memory + toDisk(disk) * opts.config.cost_ebs)
|
||||
return costs.toFixed(2)
|
||||
const calcCosts = this.calcCosts = (nodes, cpu, memory, disk, iops, throughput) => {
|
||||
podcount = Math.max(nodes, opts.config.min_pods)
|
||||
corecost = toCores(cpu) * opts.config.cost_core
|
||||
memorycost = toMemory(memory) * opts.config.cost_memory
|
||||
diskcost = toDisk(disk) * opts.config.cost_ebs
|
||||
iopscost = 0
|
||||
if (iops !== undefined && iops > 3000) {
|
||||
iopscost = (iops - 3000) * opts.config.cost_iops
|
||||
}
|
||||
throughputcost = 0
|
||||
if (throughput !== undefined && throughput > 125) {
|
||||
throughputcost = (throughput - 125) * opts.config.cost_throughput
|
||||
}
|
||||
|
||||
costs = podcount * (corecost + memorycost + diskcost + iopscost + throughputcost)
|
||||
return costs.toFixed(2)
|
||||
}
|
||||
|
||||
const toDisk = this.toDisk = value => {
|
||||
@@ -253,6 +266,11 @@ postgresqls
|
||||
value = Number(value)
|
||||
return value
|
||||
}
|
||||
else if(value.endsWith("Ti")) {
|
||||
value = value.substring(0, value.length-2)
|
||||
value = Number(value) * 1000
|
||||
return value
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user