feat(quadlet-app): enable registry auto-update and shared container network
Add AutoUpdate=registry and Network=containers.network to the generated container quadlet, extend haproxy_services with an optional grpc_port field, and drop the now-unused cloud-init/loginctl linger wait from the remote-exec inline steps.
This commit is contained in:
parent
344baa16aa
commit
49b2a6c38a
|
|
@ -57,6 +57,7 @@ variable "haproxy_services" {
|
|||
port = string
|
||||
host = optional(string, "127.0.0.1")
|
||||
tls = optional(bool, false)
|
||||
grpc_port = optional(string, "")
|
||||
}))
|
||||
default = []
|
||||
}
|
||||
|
|
@ -85,7 +86,8 @@ locals {
|
|||
"Label=haproxy.${svc.name}.domain=${svc.domain}",
|
||||
"Label=haproxy.${svc.name}.port=${svc.port}",
|
||||
"Label=haproxy.${svc.name}.host=${svc.host}",
|
||||
"Label=haproxy.${svc.name}.tls=${svc.tls}"
|
||||
"Label=haproxy.${svc.name}.tls=${svc.tls}",
|
||||
#"Label=haproxy.${svc.name}.grpc_port=${svc.grpc_port}"
|
||||
]
|
||||
])
|
||||
}
|
||||
|
|
@ -109,11 +111,8 @@ resource "null_resource" "deploy_quadlet_app" {
|
|||
provisioner "remote-exec" {
|
||||
inline = compact(flatten([
|
||||
[
|
||||
# Wait for cloud-init to complete before proceeding
|
||||
"cloud-init status --wait || true",
|
||||
|
||||
# Verify the user systemd session is ready and linger is enabled
|
||||
"timeout 60 bash -c 'until loginctl show-user fourlights | grep -q \"Linger=yes\"; do sleep 2; done'",
|
||||
#"timeout 60 bash -c 'until loginctl show-user fourlights | grep -q \"Linger=yes\"; do sleep 2; done'",
|
||||
|
||||
# Create base quadlet file
|
||||
"cat > /tmp/${var.app_name}.container << 'EOF'",
|
||||
|
|
@ -123,6 +122,8 @@ resource "null_resource" "deploy_quadlet_app" {
|
|||
"",
|
||||
"[Container]",
|
||||
"Image=${var.image}",
|
||||
"AutoUpdate=registry",
|
||||
"Network=containers.network"
|
||||
],
|
||||
|
||||
# Add ports (only if not empty)
|
||||
|
|
@ -139,6 +140,7 @@ resource "null_resource" "deploy_quadlet_app" {
|
|||
|
||||
# Add pre-computed HAProxy labels (only if not empty)
|
||||
length(local.haproxy_labels) > 0 ? local.haproxy_labels : [],
|
||||
|
||||
# Add health checks if not empty
|
||||
var.healthcmd != "" ? ["HealthCmd=${var.healthcmd}"] : [],
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue