-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Database Service: Dummy template for SUT
- Loading branch information
Showing
2 changed files
with
198 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: {app: bexhoma, component: sut, configuration: default, experiment: default} | ||
name: bexhoma-service | ||
spec: | ||
ports: | ||
- {port: 9091, protocol: TCP, name: port-dbms, targetPort: 5432} | ||
- {port: 9300, protocol: TCP, name: port-monitoring, targetPort: 9300} | ||
selector: {app: bexhoma, component: sut, configuration: default, experiment: default} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: {app: bexhoma, component: sut, configuration: default, experiment: default} | ||
name: bexhoma-deployment-postgres | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: {app: bexhoma, component: sut, configuration: default, experiment: default} | ||
template: | ||
metadata: | ||
labels: {app: bexhoma, component: sut, configuration: default, experiment: default} | ||
spec: | ||
automountServiceAccountToken: false | ||
imagePullSecrets: | ||
- {name: dockerhub} | ||
nodeSelector: | ||
tolerations: | ||
#- key: "nvidia.com/gpu" | ||
# effect: "NoSchedule" | ||
terminationGracePeriodSeconds: 180 | ||
containers: | ||
- name: dbms | ||
image: postgres:16.1 | ||
env: | ||
- name: POSTGRES_HOST_AUTH_METHOD | ||
value: trust | ||
- name: PGDATA | ||
value: /var/lib/postgresql/data/pgdata | ||
# pg_ctl: cannot be run as root | ||
lifecycle: | ||
postStart: | ||
exec: | ||
command: ["/bin/sh", "-c", "echo 'Hello from the postStart handler' > /usr/share/message && cat /usr/share/message"] | ||
preStop: | ||
exec: | ||
#command: ["/bin/sh", "-c", "gosu postgres pg_ctl stop -D /var/lib/postgresql/data -m fast"] | ||
#command: ["/bin/sh", "-c", "gosu postgres pg_ctl stop -m fast"] | ||
#command: ["echo 'PRESTOP' ;", "/bin/sh", "-c", "gosu postgres pg_ctl stop -m smart -t 120"] | ||
#command: ["/bin/sh", "-c", "echo 'Hello from the preStop handler'; gosu postgres pg_ctl stop -m smart -t 120"] | ||
#command: ["gosu postgres", "pg_ctl stop -m smart -t 120"] | ||
#command: ["/bin/sh", "-c"] | ||
#args: ["gosu postgres pg_ctl stop -m smart -t 120"] | ||
#command: ["/bin/sh", "-c", "gosu postgres 'pg_ctl stop -m smart -t 120'"] | ||
#command: ["/bin/sh", "-c", "gosu postgres '/usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120'"] | ||
#command: ["/bin/sh -c 'gosu postgres /usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120'"] | ||
command: ["/bin/sh", "-c", "gosu postgres /usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120"] | ||
#command: ["/bin/sh", "-c", "echo 'Hello from the preStop handler' > /usr/share/message && cat /usr/share/message"] | ||
#command: ["sh", "-c", "trap 'gosu postgres pg_ctl stop -m smart' SIGTERM; gosu postgres postgres"] # trap: SIGTERM: bad trap | ||
readinessProbe: | ||
exec: | ||
command: | ||
- /bin/sh | ||
- "-c" | ||
- > | ||
if pg_isready -h localhost -p 5432 > /dev/null; then | ||
recovery_status=$(psql -h localhost -p 5432 -U postgres -t -c "SELECT pg_is_in_recovery();" | xargs); | ||
[ "$recovery_status" = "f" ] && exit 0 || exit 1; | ||
else | ||
exit 1; | ||
fi | ||
#command: | ||
#- pg_isready | ||
#- -U | ||
#- postgres | ||
initialDelaySeconds: 15 | ||
periodSeconds: 60 | ||
successThreshold: 3 | ||
ports: | ||
- {containerPort: 5432} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
#runAsNonRoot: true | ||
#runAsUser: 1000 | ||
#runAsGroup: 1000 | ||
#capabilities: | ||
# drop: | ||
# - ALL | ||
#readOnlyRootFilesystem: true #could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Read-only file system | ||
resources: | ||
limits: {cpu: 16000m, memory: 128Gi} | ||
requests: {cpu: 1000m, memory: 1Gi} | ||
#, ephemeral-storage: "1536Gi"} | ||
volumeMounts: | ||
- {mountPath: /dev/shm, name: dshm} | ||
args: [ | ||
"-c", "max_worker_processes=64", | ||
"-c", "max_parallel_workers=64", | ||
"-c", "max_parallel_workers_per_gather=64", | ||
"-c", "max_parallel_maintenance_workers=64", # only for PostgreSQL > 10 (?) | ||
"-c", "max_wal_size=32GB", | ||
"-c", "shared_buffers=64GB", | ||
#"-c", "shared_memory_size=32GB", # read-only | ||
"-c", "max_connections=2048", | ||
"-c", "autovacuum_max_workers=10", | ||
"-c", "autovacuum_vacuum_cost_limit=3000", | ||
"-c", "vacuum_cost_limit=1000", | ||
"-c", "checkpoint_completion_target=0.9", | ||
"-c", "cpu_tuple_cost=0.03", | ||
"-c", "effective_cache_size=64GB", | ||
"-c", "maintenance_work_mem=2GB", | ||
#"-c", "max_connections=1700", | ||
#"-c", "random_page_cost=1.1", | ||
"-c", "wal_buffers=1GB", | ||
"-c", "work_mem=32GB", | ||
#"-c", "huge_pages=on", | ||
"-c", "temp_buffers=4GB", | ||
"-c", "autovacuum_work_mem=-1", | ||
"-c", "max_stack_depth=7MB", | ||
"-c", "max_files_per_process=4000", | ||
"-c", "effective_io_concurrency=32", | ||
"-c", "wal_level=minimal", | ||
"-c", "max_wal_senders=0", | ||
"-c", "synchronous_commit=off", | ||
"-c", "checkpoint_timeout=1h", | ||
"-c", "checkpoint_warning=0", | ||
"-c", "autovacuum=off", | ||
"-c", "max_locks_per_transaction=64", | ||
"-c", "max_pred_locks_per_transaction=64", | ||
"-c", "default_statistics_target=1000", | ||
"-c", "random_page_cost=60" | ||
] | ||
# , "-c", "listen_addresses='*'", "-c", "logging_collector=on" | ||
# , "-c", "pg_stat_statements.save=off", "-c", "pg_stat_statements.track=all", "-c", "shared_preload_libraries='pg_stat_statements'" | ||
- name: cadvisor | ||
image: gcr.io/cadvisor/cadvisor:v0.47.0 | ||
args: ["--port", "9300", "--storage_duration", "20m0s", "--docker_only", "true", "--disable_metrics", "disk,network,tcp,advtcp,udp,sched,process,hugetlb", "--application_metrics_count_limit", "30", "--housekeeping_interval", "5s"] | ||
ports: | ||
- containerPort: 9300 | ||
#hostPort: 9300 | ||
name: http | ||
protocol: TCP | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
#runAsNonRoot: true | ||
#runAsUser: 1000 | ||
#runAsGroup: 1000 | ||
#capabilities: | ||
# drop: | ||
# - ALL | ||
readOnlyRootFilesystem: true | ||
resources: | ||
requests: {cpu: 150m, memory: 200Mi} | ||
limits: {cpu: 16000m, memory: 128Gi} | ||
volumeMounts: | ||
- name: rootfs | ||
mountPath: /rootfs | ||
readOnly: true | ||
- name: var-run | ||
mountPath: /var/run | ||
readOnly: true | ||
- name: sys | ||
mountPath: /sys | ||
readOnly: true | ||
- name: docker | ||
mountPath: /var/lib/docker | ||
readOnly: true | ||
- name: disk | ||
mountPath: /dev/disk | ||
readOnly: true | ||
volumes: | ||
- name: rootfs | ||
hostPath: | ||
path: / | ||
- name: var-run | ||
hostPath: | ||
path: /var/run | ||
- name: sys | ||
hostPath: | ||
path: /sys | ||
- name: docker | ||
hostPath: | ||
path: /var/lib/docker | ||
- name: disk | ||
hostPath: | ||
path: /dev/disk | ||
- name: dshm | ||
emptyDir: | ||
medium: Memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters