Update image references for nginx and caddy, and enhance environment injection for deployments

This commit is contained in:
suyiiyii 2025-03-14 18:15:11 +08:00
parent a890a979e9
commit 6edd214baf
Signed by: suyiiyii
GPG Key ID: 044704CB29B8AD85
3 changed files with 8 additions and 7 deletions

View File

@ -24,7 +24,7 @@ appRender = lambda a: App {
template.spec.containers = [ template.spec.containers = [
{ {
name = a.name name = a.name
image = a.image image = "cr.suyiiyii.top/docker.io" + a.image
ports = [{containerPort = a.port}] ports = [{containerPort = a.port}]
} }
] ]

View File

@ -17,12 +17,13 @@ envSecretRender = lambda e: Envs {
[secret] [secret]
} }
envInjector = lambda envs: Envs, deploy { envInjector = lambda envs: Envs, input: appsv1.Deployment | any {
"""Inject envs to Deployment""" """Inject envs to Deployment"""
_result = {} _result: any = {}
if deploy.kind != "Deployment": if input.kind != "Deployment":
_result = deploy input
else: else:
deploy: appsv1.Deployment = input as appsv1.Deployment
secretEnv: [corev1.EnvVar] = [{ secretEnv: [corev1.EnvVar] = [{
name = k name = k
valueFrom = { valueFrom = {

4
main.k
View File

@ -6,13 +6,13 @@ apps = [
base.App { base.App {
name = "nginxxx" name = "nginxxx"
replicas = 2 replicas = 2
image = "nginx" image = "library/nginx"
port = 80 port = 80
} }
base.App { base.App {
name = "caddyy" name = "caddyy"
replicas = 2 replicas = 2
image = "caddy" image = "library/caddy"
port = 80 port = 80
} }
] ]