Add HTTPService rendering for Ingress configuration

This commit is contained in:
2025-03-14 19:59:36 +08:00
parent 6edd214baf
commit 98e324c586
2 changed files with 42 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import k8s.api.networking.v1 as networkingv1
schema HTTPService:
"""http service"""
service: str
domain: str
httpServiceRender = lambda h: HTTPService {
"""Render http service to Ingress"""
ingress = networkingv1.Ingress {
apiVersion = "networking.k8s.io/v1"
kind = "Ingress"
metadata = {
name = h.service
}
spec = {
rules = [{
host = h.domain
http = {
paths = [{
path = "/"
pathType = "Prefix"
backend = {
service = {
name = h.service
port = {
number = 80
}
}
}
}]
}
}]
}
}
[ingress]
}