Skip to content

Commit

Permalink
Clean up resources
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Dec 23, 2023
1 parent 61fdaa2 commit c847742
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 90 deletions.
7 changes: 3 additions & 4 deletions terraform/modules/cloud-sql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ locals {
cloud_sql_admin_port = 9092
# memory should scale based on pg pool size
cloud_sql_memory = "256Mi"
# cant seem to adjust this to less than 1
cloud_sql_cpu = "1"
cloud_sql_cpu = "100m"
cloud_sql_storage = "1Gi"
cloud_sql_port = 25432

pgbouncer_image = "edoburu/pgbouncer"
pgbouncer_memory = "256Mi"
pgbouncer_cpu = "250m"
pgbouncer_cpu = "100m"

pgbouncer_port = 5432
pgbouncer_default_pool_size = 20
Expand Down Expand Up @@ -154,6 +153,7 @@ resource "kubernetes_deployment_v1" "default" {
limits = {
cpu = local.pgbouncer_cpu
memory = local.pgbouncer_memory
ephemeral-storage = local.cloud_sql_storage
}
}

Expand Down Expand Up @@ -333,7 +333,6 @@ resource "kubernetes_deployment_v1" "default" {
lifecycle {
ignore_changes = [
spec[0].template[0].spec[0].container[0].image,
spec[0].template[0].spec[0].container[0].resources[0].limits["ephemeral-storage"],
spec[0].template[0].spec[0].security_context,
spec[0].template[0].spec[0].toleration,
metadata[0].annotations["autopilot.gke.io/resource-adjustment"],
Expand Down
80 changes: 1 addition & 79 deletions terraform/modules/faktory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,58 +95,7 @@ resource "kubernetes_stateful_set_v1" "stateful_set" {

spec {
termination_grace_period_seconds = 10
share_process_namespace = true

# container {
# name = "config-watcher"
# image = "busybox"
# image_pull_policy = "IfNotPresent"
# command = [
# "sh",
# "-c",
# <<EOT
# sum() {
# current=$(find /conf -type f -exec md5sum {} \; | sort -k 2 | md5sum)
# }
# sum
# last=\"$current\"
# while true; do
# sum
# if [ \"$current\" != \"$last\" ]; then
# pid=$(pidof faktory)
# echo \"$(date -Iseconds) [conf.d] changes detected - signaling Faktory with pid=$pid\"
# kill -HUP \"$pid\"
# last=\"$current\"
# fi
# sleep 1
# done
# EOT
# ]

# args = [
# "--volume-dir=/etc/config",
# "--webhook-url=http://localhost:9090/-/reload",
# ]

# volume_mount {
# name = "configs"
# mount_path = "/conf"
# }

# security_context {
# allow_privilege_escalation = false
# privileged = false
# read_only_root_filesystem = false
# run_as_non_root = false

# capabilities {
# add = []
# drop = [
# "NET_RAW"
# ]
# }
# }
# }
# share_process_namespace = true

container {
name = "server"
Expand Down Expand Up @@ -222,20 +171,8 @@ resource "kubernetes_stateful_set_v1" "stateful_set" {
name = "data"
mount_path = "/var/lib/faktory"
}

# volume_mount {
# name = "configs"
# mount_path = "/etc/faktory/conf.d"
# }
}

# volume {
# name = "configs"
# config_map {
# name = var.name
# }
# }

volume {
name = "data"
persistent_volume_claim {
Expand Down Expand Up @@ -267,25 +204,10 @@ resource "kubernetes_stateful_set_v1" "stateful_set" {
lifecycle {
ignore_changes = [
spec[0].template[0].spec[0].container[0].image,
spec[0].template[0].spec[0].container[0].resources[0].limits["ephemeral-storage"],
spec[0].template[0].spec[0].security_context,
spec[0].template[0].spec[0].toleration,
metadata[0].annotations["autopilot.gke.io/resource-adjustment"],
metadata[0].annotations["autopilot.gke.io/warden-version"],
]
}
}

# resource "kubernetes_config_map_v1" "config_map" {
# metadata {
# name = var.name

# labels = {
# "app.kubernetes.io/name" = var.name
# }
# }

# data = {

# }
# }
7 changes: 0 additions & 7 deletions terraform/modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ resource "kubernetes_deployment_v1" "default" {
}

resources {
requests = {
cpu = var.cpu
memory = var.memory
ephemeral-storage = var.ephemeral_storage
}

limits = {
cpu = var.cpu
memory = var.memory
Expand Down Expand Up @@ -211,7 +205,6 @@ resource "kubernetes_deployment_v1" "default" {
lifecycle {
ignore_changes = [
spec[0].template[0].spec[0].container[0].image,
spec[0].template[0].spec[0].container[0].resources[0].limits["ephemeral-storage"],
spec[0].template[0].spec[0].security_context,
spec[0].template[0].spec[0].toleration,
metadata[0].annotations["autopilot.gke.io/resource-adjustment"],
Expand Down

0 comments on commit c847742

Please sign in to comment.