Skip to content

Commit 63c9f91

Browse files
authored
fix default cpu memory (#2178)
1 parent a4f95e9 commit 63c9f91

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ui/operator_ui/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
OPERATOR_API_URL = getenv('OPERATOR_API_URL', 'http://postgres-operator')
8181
OPERATOR_CLUSTER_NAME_LABEL = getenv('OPERATOR_CLUSTER_NAME_LABEL', 'cluster-name')
82-
OPERATOR_UI_CONFIG = getenv('OPERATOR_UI_CONFIG', '{}')
82+
OPERATOR_UI_CONFIG = loads(getenv('OPERATOR_UI_CONFIG', '{}'))
8383
OPERATOR_UI_MAINTENANCE_CHECK = getenv('OPERATOR_UI_MAINTENANCE_CHECK', '{}')
8484
READ_ONLY_MODE = getenv('READ_ONLY_MODE', False) in [True, 'true']
8585
SPILO_S3_BACKUP_PREFIX = getenv('SPILO_S3_BACKUP_PREFIX', 'spilo/')
@@ -348,7 +348,7 @@ def index():
348348
@authorize
349349
def get_config():
350350
config = DEFAULT_UI_CONFIG.copy()
351-
config.update(loads(OPERATOR_UI_CONFIG))
351+
config.update(OPERATOR_UI_CONFIG)
352352

353353
config['namespaces'] = (
354354
[TARGET_NAMESPACE]
@@ -508,10 +508,10 @@ def get_postgresqls():
508508
postgresqls = [
509509
{
510510
'nodes': spec.get('numberOfInstances', ''),
511-
'memory': spec.get('resources', {}).get('requests', {}).get('memory', 0),
512-
'memory_limit': spec.get('resources', {}).get('limits', {}).get('memory', 0),
513-
'cpu': spec.get('resources', {}).get('requests', {}).get('cpu', 0),
514-
'cpu_limit': spec.get('resources', {}).get('limits', {}).get('cpu', 0),
511+
'memory': spec.get('resources', {}).get('requests', {}).get('memory', OPERATOR_UI_CONFIG.get("default_memory", DEFAULT_MEMORY)),
512+
'memory_limit': spec.get('resources', {}).get('limits', {}).get('memory', OPERATOR_UI_CONFIG.get("default_memory_limit", DEFAULT_MEMORY_LIMIT)),
513+
'cpu': spec.get('resources', {}).get('requests', {}).get('cpu', OPERATOR_UI_CONFIG.get("default_cpu", DEFAULT_CPU)),
514+
'cpu_limit': spec.get('resources', {}).get('limits', {}).get('cpu', OPERATOR_UI_CONFIG.get("default_cpu_limit", DEFAULT_CPU_LIMIT)),
515515
'volume_size': spec.get('volume', {}).get('size', 0),
516516
'iops': spec.get('volume', {}).get('iops', 3000),
517517
'throughput': spec.get('volume', {}).get('throughput', 125),

0 commit comments

Comments
 (0)