Compare commits

...

5 Commits

7 changed files with 61 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
tmp/build-errors.log
+22
View File
@@ -35,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
}
+25
View File
@@ -0,0 +1,25 @@
import cert_manager.v1
issuer = v1.Issuer {
apiVersion = "cert-manager.io/v1"
kind = "Issuer"
metadata = {
name = "letsencrypt"
}
spec = {
acme = {
email = "suyiiyii@gmail.com"
server = "https://acme-v02.api.letsencrypt.org/directory"
privateKeySecretRef = {
name = "letsencrypt"
}
solvers = [{
http01 = {
ingress = {
class = "traefik"
}
}
}]
}
}
}
+1
View File
@@ -4,4 +4,5 @@ edition = "v0.11.1"
version = "0.0.1"
[dependencies]
cert-manager = "0.3.0"
k8s = "1.31.2"
+8
View File
@@ -1,4 +1,12 @@
[dependencies]
[dependencies.cert-manager]
name = "cert-manager"
full_name = "cert-manager_0.3.0"
version = "0.3.0"
sum = "yyuUXsyOsHOGUK3e9P6GzM5A0hcSpW1XBd5O6TLhyvE="
reg = "ghcr.io"
repo = "kcl-lang/cert-manager"
oci_tag = "0.3.0"
[dependencies.k8s]
name = "k8s"
full_name = "k8s_1.31.2"
+4 -3
View File
@@ -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])
manifests.yaml_stream([apps_manifests, env_manifests, ingresses, base.issuer])
-1
View File
@@ -1 +0,0 @@
exit status 1exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1