Compare commits
3 Commits
5dc4290337
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
a79eff18c6
|
|||
|
4465018c15
|
|||
|
3892da3ced
|
+22
-3
@@ -12,9 +12,6 @@ httpServiceRender = lambda h: HTTPService {
|
||||
kind = "Ingress"
|
||||
metadata = {
|
||||
name = h.service
|
||||
annotations = {
|
||||
"cert-manager.io/issuer": "letsencrypt"
|
||||
}
|
||||
}
|
||||
spec = {
|
||||
rules = [{
|
||||
@@ -38,3 +35,25 @@ httpServiceRender = lambda h: HTTPService {
|
||||
}
|
||||
[ingress]
|
||||
}
|
||||
|
||||
certInjector = lambda input: networkingv1.Ingress | any {
|
||||
"""Inject cert to Ingress"""
|
||||
_result: any = {}
|
||||
if input.kind != "Ingress":
|
||||
_result = input
|
||||
else:
|
||||
ingress: networkingv1.Ingress = input as networkingv1.Ingress
|
||||
ingress.metadata.annotations = {"cert-manager.io/issuer" = "letsencrypt"}
|
||||
ingress.spec.tls = [{
|
||||
hosts = [r.host for r in ingress.spec.rules]
|
||||
secretName = "tls-" + ingress.metadata.name
|
||||
}]
|
||||
_result = ingress
|
||||
_result
|
||||
}
|
||||
|
||||
httpServiceRefine = lambda h: HTTPService {
|
||||
ingress = httpServiceRender(h)
|
||||
ingress2 = certInjector(ingress[0])
|
||||
ingress2
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ edition = "v0.11.1"
|
||||
version = "0.0.1"
|
||||
|
||||
[dependencies]
|
||||
k8s = "1.31.2"
|
||||
cert-manager = "0.3.0"
|
||||
k8s = "1.31.2"
|
||||
|
||||
@@ -26,15 +26,16 @@ envs = base.Envs {
|
||||
|
||||
http = base.HTTPService {
|
||||
service = "nginxxx"
|
||||
domain = "nginxxx.ve.suyiiyii.top"
|
||||
domain = prefix + "nginxxx.ve.suyiiyii.top"
|
||||
}
|
||||
|
||||
prefix = option("prefix") or "prefix"
|
||||
deploys = sum([base.appRender(a) for a in apps], [])
|
||||
|
||||
apps_manifests = [base.envInjector(envs, deploy) for deploy in deploys]
|
||||
|
||||
ingresses = [base.httpServiceRender(http)]
|
||||
ingresses = [base.httpServiceRefine(http)]
|
||||
|
||||
env_manifests = [base.envSecretRender(a) for a in base.Envs.instances()]
|
||||
# base.appRender(a)
|
||||
manifests.yaml_stream([apps_manifests, env_manifests, ingresses,base.issuer])
|
||||
manifests.yaml_stream([apps_manifests, env_manifests, ingresses, base.issuer])
|
||||
|
||||
Reference in New Issue
Block a user