Compare commits

...

2 Commits
jobs ... master

Author SHA1 Message Date
dave 7ddb2b933c add args arg
Gitea/photolib/pipeline/head This commit looks good Details
2024-04-09 15:52:33 -07:00
dave 2e588149be updates for tf 1.5
Gitea/photolib/pipeline/head This commit looks good Details
2024-04-09 15:51:35 -07:00
1 changed files with 26 additions and 32 deletions

View File

@ -1,13 +1,12 @@
terraform {
backend "local" {}
required_version = ">= 0.13"
required_version = ">= 1.5"
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.3.2"
version = "2.28.0"
}
}
experiments = [module_variable_optional_attrs]
}
@ -42,8 +41,8 @@ variable "replicas" {
variable "requests" {
type = object({
cpu = optional(string)
memory = optional(string)
cpu = optional(string, "250m")
memory = optional(string, "50Mi")
})
description = "per-pod resource request"
default = {}
@ -51,8 +50,8 @@ variable "requests" {
variable "limits" {
type = object({
cpu = optional(string)
memory = optional(string)
cpu = optional(string, "1")
memory = optional(string, "512Mi")
})
description = "per-pod resource limit"
default = {}
@ -77,20 +76,10 @@ variable "thumbservice_password" {
type = string
}
locals {
requests = defaults(var.requests,
{
cpu = "250m"
memory = "50Mi"
}
)
limits = defaults(var.limits,
{
cpu = "1"
memory = "512Mi"
}
)
variable "photolib_args" {
type = list(string)
description = "additional arguments for the photolib daemon"
default = []
}
@ -128,6 +117,7 @@ resource "kubernetes_deployment" "photolib" {
container {
name = "web"
image = var.image
args = var.photolib_args
env {
name = "DATABASE_URL"
@ -149,12 +139,12 @@ resource "kubernetes_deployment" "photolib" {
resources {
requests = {
cpu = local.requests.cpu
memory = local.requests.memory
cpu = var.requests.cpu
memory = var.requests.memory
}
limits = {
cpu = local.limits.cpu
memory = local.limits.memory
cpu = var.limits.cpu
memory = var.limits.memory
}
}
@ -217,7 +207,7 @@ resource "kubernetes_service" "photolib" {
}
}
resource "kubernetes_ingress" "photolib" {
resource "kubernetes_ingress_v1" "photolib" {
metadata {
name = var.name
namespace = var.namespace
@ -234,8 +224,12 @@ resource "kubernetes_ingress" "photolib" {
http {
path {
backend {
service_name = kubernetes_service.photolib.metadata.0.name
service_port = 8080
service {
name = kubernetes_service.photolib.metadata.0.name
port {
number = 8080
}
}
}
}
}
@ -342,12 +336,12 @@ resource "kubernetes_deployment" "thumbservice" {
resources {
requests = {
cpu = local.requests.cpu
memory = local.requests.memory
cpu = var.requests.cpu
memory = var.requests.memory
}
limits = {
cpu = local.limits.cpu
memory = local.limits.memory
cpu = var.limits.cpu
memory = var.limits.memory
}
}