blob: d1ae8784d79cb35ee73d5f1cd58765f61158014b [file] [log] [blame]
giof6ad2982024-08-23 17:42:49 +04001import (
gio721c0042025-04-03 11:56:36 +04002 "encoding/base64"
giof6ad2982024-08-23 17:42:49 +04003)
4
5input: {
gio9bd87ca2025-04-20 08:05:34 +04006 cluster: #Cluster
7 vpnUser: string
giof6ad2982024-08-23 17:42:49 +04008 vpnProxyHostname: string
gio9bd87ca2025-04-20 08:05:34 +04009 vpnAuthKey: string @role(VPNAuthKey) @usernameField(vpnUser)
10 sshPrivateKey: string
giof6ad2982024-08-23 17:42:49 +040011}
12
gio9bd87ca2025-04-20 08:05:34 +040013name: "Cluster Network"
giof6ad2982024-08-23 17:42:49 +040014namespace: "cluster-network"
15
16out: {
17 images: {
18 "ingress-nginx": {
gio9bd87ca2025-04-20 08:05:34 +040019 registry: "registry.k8s.io"
giof6ad2982024-08-23 17:42:49 +040020 repository: "ingress-nginx"
gio9bd87ca2025-04-20 08:05:34 +040021 name: "controller"
22 tag: "v1.8.0"
giof6ad2982024-08-23 17:42:49 +040023 pullPolicy: "IfNotPresent"
24 }
25 "tailscale-proxy": {
26 repository: "tailscale"
gio9bd87ca2025-04-20 08:05:34 +040027 name: "tailscale"
28 tag: "v1.82.0"
giof6ad2982024-08-23 17:42:49 +040029 pullPolicy: "IfNotPresent"
30 }
gio721c0042025-04-03 11:56:36 +040031 portAllocator: {
32 repository: "giolekva"
gio9bd87ca2025-04-20 08:05:34 +040033 name: "port-allocator"
34 tag: "latest"
gio721c0042025-04-03 11:56:36 +040035 pullPolicy: "Always"
36 }
giof6ad2982024-08-23 17:42:49 +040037 }
38
39 charts: {
40 "access-secrets": {
gio9bd87ca2025-04-20 08:05:34 +040041 kind: "GitRepository"
giof6ad2982024-08-23 17:42:49 +040042 address: "https://code.v1.dodo.cloud/helm-charts"
gio9bd87ca2025-04-20 08:05:34 +040043 branch: "main"
44 path: "charts/access-secrets"
giof6ad2982024-08-23 17:42:49 +040045 }
46 "ingress-nginx": {
gio9bd87ca2025-04-20 08:05:34 +040047 kind: "GitRepository"
giof6ad2982024-08-23 17:42:49 +040048 address: "https://code.v1.dodo.cloud/helm-charts"
gio9bd87ca2025-04-20 08:05:34 +040049 branch: "main"
50 path: "charts/ingress-nginx"
giof6ad2982024-08-23 17:42:49 +040051 }
52 "tailscale-proxy": {
gio9bd87ca2025-04-20 08:05:34 +040053 kind: "GitRepository"
giof6ad2982024-08-23 17:42:49 +040054 address: "https://code.v1.dodo.cloud/helm-charts"
gio9bd87ca2025-04-20 08:05:34 +040055 branch: "main"
56 path: "charts/tailscale-proxy"
giof6ad2982024-08-23 17:42:49 +040057 }
gio721c0042025-04-03 11:56:36 +040058 portAllocator: {
gio9bd87ca2025-04-20 08:05:34 +040059 kind: "GitRepository"
gio721c0042025-04-03 11:56:36 +040060 address: "https://code.v1.dodo.cloud/helm-charts"
gio9bd87ca2025-04-20 08:05:34 +040061 branch: "main"
62 path: "charts/port-allocator"
gio721c0042025-04-03 11:56:36 +040063 }
giof6ad2982024-08-23 17:42:49 +040064 }
65
66 helm: {
67 _fullnameOverride: "\(global.id)-nginx-cluster-\(input.cluster.name)"
68 "access-secrets": {
69 chart: charts["access-secrets"]
70 values: {
71 serviceAccountName: _fullnameOverride
72 }
73 }
74 "ingress-nginx": {
75 chart: charts["ingress-nginx"]
76 dependsOn: [{
gio9bd87ca2025-04-20 08:05:34 +040077 name: "access-secrets"
giof6ad2982024-08-23 17:42:49 +040078 namespace: release.namespace
79 }]
80 values: {
81 fullnameOverride: _fullnameOverride
82 controller: {
83 service: enabled: false
84 ingressClassByName: true
85 ingressClassResource: {
gio9bd87ca2025-04-20 08:05:34 +040086 name: input.cluster.ingressClassName
87 enabled: true
88 default: false
giof6ad2982024-08-23 17:42:49 +040089 controllerValue: "k8s.io/\(input.cluster.name)"
90 }
91 config: {
gio9bd87ca2025-04-20 08:05:34 +040092 "proxy-body-size": "200M" // TODO(giolekva): configurable
giof6ad2982024-08-23 17:42:49 +040093 "force-ssl-redirect": "true"
94 "server-snippet": """
95 more_clear_headers "X-Frame-Options";
96 """
97 }
98 admissionWebhooks: {
99 enabled: false
100 }
101 image: {
gio9bd87ca2025-04-20 08:05:34 +0400102 registry: images["ingress-nginx"].registry
103 image: images["ingress-nginx"].imageName
104 tag: images["ingress-nginx"].tag
giof6ad2982024-08-23 17:42:49 +0400105 pullPolicy: images["ingress-nginx"].pullPolicy
106 }
107 extraContainers: [{
gio9bd87ca2025-04-20 08:05:34 +0400108 name: "proxy"
giof6ad2982024-08-23 17:42:49 +0400109 image: images["tailscale-proxy"].fullNameWithTag
110 env: [{
gio9bd87ca2025-04-20 08:05:34 +0400111 name: "TS_AUTHKEY"
giof6ad2982024-08-23 17:42:49 +0400112 value: input.vpnAuthKey
gio9bd87ca2025-04-20 08:05:34 +0400113 }, {
114 name: "TS_HOSTNAME"
giof6ad2982024-08-23 17:42:49 +0400115 value: input.vpnProxyHostname
116 }, {
gio9bd87ca2025-04-20 08:05:34 +0400117 name: "TS_EXTRA_ARGS"
giof6ad2982024-08-23 17:42:49 +0400118 value: "--login-server=https://headscale.\(global.domain)"
119 }]
gio9bd87ca2025-04-20 08:05:34 +0400120 }]
giof6ad2982024-08-23 17:42:49 +0400121 }
gio721c0042025-04-03 11:56:36 +0400122 tcp: {}
123 udp: {}
giof6ad2982024-08-23 17:42:49 +0400124 }
125 }
gio721c0042025-04-03 11:56:36 +0400126 "port-allocator": {
gio9bd87ca2025-04-20 08:05:34 +0400127 chart: charts.portAllocator
gio721c0042025-04-03 11:56:36 +0400128 cluster: null
129 values: {
gio9bd87ca2025-04-20 08:05:34 +0400130 repoAddr: release.repoAddr
131 sshPrivateKey: base64.Encode(null, input.sshPrivateKey)
gio721c0042025-04-03 11:56:36 +0400132 ingressNginxPath: "\(release.appDir)/resources/ingress-nginx.yaml"
133 image: {
134 repository: images.portAllocator.fullName
gio9bd87ca2025-04-20 08:05:34 +0400135 tag: "amd64" // TODO(gio): images.portAllocator.tag
gio721c0042025-04-03 11:56:36 +0400136 pullPolicy: images.portAllocator.pullPolicy
137 }
138 }
139 }
giof6ad2982024-08-23 17:42:49 +0400140 }
141}