mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-05 18:58:51 +02:00
[UI] include load balancer in the monthly cost calculation (#1977)
This commit is contained in:
@@ -139,6 +139,9 @@ edit
|
||||
o.spec.enableMasterLoadBalancer = i.spec.enableMasterLoadBalancer || false
|
||||
o.spec.enableReplicaLoadBalancer = i.spec.enableReplicaLoadBalancer || false
|
||||
o.spec.enableConnectionPooler = i.spec.enableConnectionPooler || false
|
||||
o.spec.enableReplicaConnectionPooler = i.spec.enableReplicaConnectionPooler || false
|
||||
o.spec.enableMasterPoolerLoadBalancer = i.spec.enableMasterPoolerLoadBalancer || false
|
||||
o.spec.enableReplicaPoolerLoadBalancer = i.spec.enableReplicaPoolerLoadBalancer || false
|
||||
|
||||
o.spec.volume = {
|
||||
size: i.spec.volume.size,
|
||||
|
||||
+95
-30
@@ -216,40 +216,73 @@ new
|
||||
)
|
||||
|
||||
tr(if='{ [undefined, true].includes(config.master_load_balancer_visible) }')
|
||||
td Master load balancer
|
||||
td Enable load balancer
|
||||
td
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableMasterLoadBalancer }'
|
||||
onchange='{ toggleEnableMasterLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Enable master ELB
|
||||
ul.ips
|
||||
li
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableMasterLoadBalancer }'
|
||||
onchange='{ toggleEnableMasterLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Master
|
||||
li(if='{ [undefined, true].includes(config.replica_load_balancer_visible) && instanceCount > 1 }')
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableReplicaLoadBalancer }'
|
||||
onchange='{ toggleEnableReplicaLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Replica
|
||||
|
||||
tr(if='{ [undefined, true].includes(config.replica_load_balancer_visible) }')
|
||||
td Replica load balancer
|
||||
tr(if='{ [undefined, true].includes(config.connection_pooler_visible) }')
|
||||
td Enable connection pooler
|
||||
td
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableReplicaLoadBalancer }'
|
||||
onchange='{ toggleEnableReplicaLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Enable replica ELB
|
||||
ul.ips
|
||||
li
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableConnectionPooler }'
|
||||
onchange='{ toggleEnableConnectionPooler }'
|
||||
)
|
||||
|
|
||||
| Master
|
||||
li(if='{ [undefined, true].includes(config.replica_connection_pooler_visible) && instanceCount > 1 }')
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableReplicaConnectionPooler }'
|
||||
onchange='{ toggleEnableReplicaConnectionPooler }'
|
||||
)
|
||||
|
|
||||
| Replica
|
||||
|
||||
tr
|
||||
td Enable Connection Pool
|
||||
tr(if='{ [undefined, true].includes(config.master_pooler_load_balancer_visible) }')
|
||||
td Enable connection pooler load balancer
|
||||
td
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableConnectionPooler }'
|
||||
onchange='{ toggleEnableConnectionPooler }'
|
||||
)
|
||||
|
|
||||
| Enable Connection Pool (using PGBouncer)
|
||||
ul.ips
|
||||
li
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableMasterPoolerLoadBalancer }'
|
||||
onchange='{ toggleEnableMasterPoolerLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Master
|
||||
li(if='{ [undefined, true].includes(config.replica_pooler_load_balancer_visible) && instanceCount > 1 }')
|
||||
label
|
||||
input(
|
||||
type='checkbox'
|
||||
value='{ enableReplicaPoolerLoadBalancer }'
|
||||
onchange='{ toggleEnableReplicaPoolerLoadBalancer }'
|
||||
)
|
||||
|
|
||||
| Replica
|
||||
|
||||
tr
|
||||
td Volume size
|
||||
@@ -267,7 +300,7 @@ new
|
||||
.input-group-addon
|
||||
.input-units Gi
|
||||
tr
|
||||
td
|
||||
td
|
||||
td Specify Iops and Throughput only if you need more than the default 3000 Iops and 125Mb/s EBS provides.
|
||||
|
||||
tr
|
||||
@@ -539,6 +572,15 @@ new
|
||||
{{#if enableConnectionPooler}}
|
||||
enableConnectionPooler: true
|
||||
{{/if}}
|
||||
{{#if enableReplicaConnectionPooler}}
|
||||
enableReplicaConnectionPooler: true
|
||||
{{/if}}
|
||||
{{#if enableMasterPoolerLoadBalancer}}
|
||||
enableMasterPoolerLoadBalancer: true
|
||||
{{/if}}
|
||||
{{#if enableReplicaPoolerLoadBalancer}}
|
||||
enableReplicaPoolerLoadBalancer: true
|
||||
{{/if}}
|
||||
volume:
|
||||
size: "{{ volumeSize }}Gi"{{#if iops}}
|
||||
iops: {{ iops }}{{/if}}{{#if throughput}}
|
||||
@@ -592,6 +634,9 @@ new
|
||||
enableMasterLoadBalancer: this.enableMasterLoadBalancer,
|
||||
enableReplicaLoadBalancer: this.enableReplicaLoadBalancer,
|
||||
enableConnectionPooler: this.enableConnectionPooler,
|
||||
enableReplicaConnectionPooler: this.enableReplicaConnectionPooler,
|
||||
enableMasterPoolerLoadBalancer: this.enableMasterPoolerLoadBalancer,
|
||||
enableReplicaPoolerLoadBalancer: this.enableReplicaPoolerLoadBalancer,
|
||||
volumeSize: this.volumeSize,
|
||||
iops: this.iops,
|
||||
throughput: this.throughput,
|
||||
@@ -655,6 +700,18 @@ new
|
||||
this.enableConnectionPooler = !this.enableConnectionPooler
|
||||
}
|
||||
|
||||
this.toggleEnableReplicaConnectionPooler = e => {
|
||||
this.enableReplicaConnectionPooler = !this.enableReplicaConnectionPooler
|
||||
}
|
||||
|
||||
this.toggleEnableMasterPoolerLoadBalancer = e => {
|
||||
this.enableMasterPoolerLoadBalancer = !this.enableMasterPoolerLoadBalancer
|
||||
}
|
||||
|
||||
this.toggleEnableReplicaPoolerLoadBalancer = e => {
|
||||
this.enableReplicaPoolerLoadBalancer = !this.enableReplicaPoolerLoadBalancer
|
||||
}
|
||||
|
||||
this.volumeChange = e => {
|
||||
this.volumeSize = +e.target.value
|
||||
}
|
||||
@@ -692,6 +749,11 @@ new
|
||||
|
||||
this.instanceCountChange = e => {
|
||||
this.instanceCount = +e.target.value
|
||||
if (this.instanceCount < 2) {
|
||||
this.enableReplicaLoadBalancer = false
|
||||
this.enableReplicaConnectionPooler = false
|
||||
this.enableReplicaPoolerLoadBalancer = false
|
||||
}
|
||||
}
|
||||
|
||||
this.checkClusterExists = () => (
|
||||
@@ -957,6 +1019,9 @@ new
|
||||
this.enableMasterLoadBalancer = false
|
||||
this.enableReplicaLoadBalancer = false
|
||||
this.enableConnectionPooler = false
|
||||
this.enableReplicaConnectionPooler = false
|
||||
this.enableMasterPoolerLoadBalancer = false
|
||||
this.enableReplicaPoolerLoadBalancer = false
|
||||
|
||||
this.postgresqlVersion = this.postgresqlVersion = (
|
||||
this.config.postgresql_versions[0]
|
||||
|
||||
@@ -168,11 +168,13 @@ postgresql
|
||||
this.progress.dnsName = data.metadata.name + '.' + data.metadata.namespace
|
||||
}
|
||||
|
||||
jQuery.get('/pooler/' + this.cluster_path).done(data => {
|
||||
this.progress.pooler = {"url": ""}
|
||||
this.update()
|
||||
})
|
||||
|
||||
if (this.progress.poolerEnabled == true) {
|
||||
jQuery.get('/pooler/' + this.cluster_path).done(data => {
|
||||
this.progress.pooler = {"url": ""}
|
||||
this.update()
|
||||
})
|
||||
}
|
||||
|
||||
this.update()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -68,6 +68,8 @@ postgresqls
|
||||
| IOPS (-3000 baseline): 0.006$
|
||||
br
|
||||
| Throughput (-125 baseline): 0.0476$
|
||||
br
|
||||
| 1 ELB: 21.96$
|
||||
th(stlye='width: 120px')
|
||||
|
||||
tbody
|
||||
@@ -87,7 +89,7 @@ postgresqls
|
||||
td { volume_size }
|
||||
td { iops }
|
||||
td { throughput }
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput) }$
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput, num_elb) }$
|
||||
|
||||
td
|
||||
|
||||
@@ -167,7 +169,9 @@ postgresqls
|
||||
| IOPS (-3000 baseline): 0.006$
|
||||
br
|
||||
| Throughput (-125 baseline): 0.0476$
|
||||
th(stlye='width: 120px')
|
||||
br
|
||||
| 1 ELB: 21.96$
|
||||
th(style='width: 120px')
|
||||
|
||||
tbody
|
||||
tr(
|
||||
@@ -188,7 +192,7 @@ postgresqls
|
||||
td { volume_size }
|
||||
td { iops }
|
||||
td { throughput }
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput) }$
|
||||
td { calcCosts(nodes, cpu, memory, volume_size, iops, throughput, num_elb) }$
|
||||
|
||||
td
|
||||
|
||||
@@ -263,10 +267,11 @@ postgresqls
|
||||
+ '/' + encodeURI(cluster.name)
|
||||
)
|
||||
|
||||
const calcCosts = this.calcCosts = (nodes, cpu, memory, disk, iops, throughput) => {
|
||||
const calcCosts = this.calcCosts = (nodes, cpu, memory, disk, iops, throughput, num_elb) => {
|
||||
podcount = Math.max(nodes, opts.config.min_pods)
|
||||
corecost = toCores(cpu) * opts.config.cost_core * 30.5 * 24
|
||||
memorycost = toMemory(memory) * opts.config.cost_memory * 30.5 * 24
|
||||
elbcost = num_elb * opts.config.cost_elb * 30.5 * 24
|
||||
diskcost = toDisk(disk) * opts.config.cost_ebs
|
||||
iopscost = 0
|
||||
if (iops !== undefined && iops > opts.config.free_iops) {
|
||||
@@ -283,7 +288,7 @@ postgresqls
|
||||
throughputcost = (throughput - opts.config.free_throughput) * opts.config.cost_throughput
|
||||
}
|
||||
|
||||
costs = podcount * (Math.max(corecost, memorycost) + diskcost + iopscost + throughputcost)
|
||||
costs = podcount * (Math.max(corecost, memorycost) + diskcost + iopscost + throughputcost) + elbcost
|
||||
return costs.toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user