Skip to content

Commit 3ea64d3

Browse files
authored
Merge pull request #19 from kurtosis-tech/barnabasbusa-patch-1
feat: Add node selectors to postgres
2 parents 08984ce + 39d3454 commit 3ea64d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.star

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def run(
3232
max_cpu=POSTGRES_MAX_CPU,
3333
min_memory=POSTGRES_MIN_MEMORY,
3434
max_memory=POSTGRES_MAX_MEMORY,
35+
node_selectors=None,
3536
):
3637
"""Launches a Postgresql database instance, optionally seeding it with a SQL file script
3738
@@ -52,6 +53,7 @@ def run(
5253
max_cpu (int): Define how much CPU millicores the service should be assign max.
5354
min_memory (int): Define how much MB of memory the service should be assigned at least.
5455
max_memory (int): Define how much MB of memory the service should be assigned max.
56+
node_selectors (dict): Define a dict of node selectors - only works in kubernetes example: {"kubernetes.io/hostname": node-name-01}
5557
Returns:
5658
An object containing useful information about the Postgres database running inside the enclave:
5759
```
@@ -95,7 +97,8 @@ def run(
9597
persistent_key= "data-{0}".format(service_name),
9698
)
9799
env_vars["PGDATA"] = DATA_DIRECTORY_PATH + "/pgdata"
98-
100+
if node_selectors == None:
101+
node_selectors = {}
99102
if config_file_artifact_name != "":
100103
config_filepath = CONFIG_FILE_MOUNT_DIRPATH + "/" + CONFIG_FILENAME
101104
cmd += ["-c", "config_file=" + config_filepath]
@@ -126,6 +129,7 @@ def run(
126129
max_cpu=max_cpu,
127130
min_memory=min_memory,
128131
max_memory=max_memory,
132+
node_selectors=node_selectors,
129133
),
130134
)
131135

@@ -158,6 +162,7 @@ def run(
158162
max_cpu=max_cpu,
159163
min_memory=min_memory,
160164
max_memory=max_memory,
165+
node_selectors=node_selectors,
161166
)
162167

163168

0 commit comments

Comments
 (0)