| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 1 | import ( |
| 2 | "strings" |
| 3 | ) |
| 4 | |
| 5 | input: {} |
| 6 | |
| 7 | name: "env-dns" |
| 8 | namespace: "dns" |
| 9 | readme: "env-dns" |
| 10 | description: "Environment local DNS manager" |
| 11 | icon: "" |
| 12 | |
| 13 | images: { |
| 14 | coredns: { |
| 15 | repository: "coredns" |
| 16 | name: "coredns" |
| 17 | tag: "1.11.1" |
| 18 | pullPolicy: "IfNotPresent" |
| 19 | } |
| 20 | api: { |
| 21 | repository: "giolekva" |
| 22 | name: "dns-api" |
| 23 | tag: "latest" |
| 24 | pullPolicy: "Always" |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | charts: { |
| 29 | coredns: { |
| gio | f884341 | 2024-05-22 16:38:05 +0400 | [diff] [blame] | 30 | kind: "GitRepository" |
| 31 | address: "https://github.com/giolekva/pcloud.git" |
| 32 | branch: "main" |
| 33 | path: "charts/coredns" |
| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 34 | } |
| 35 | api: { |
| gio | f884341 | 2024-05-22 16:38:05 +0400 | [diff] [blame] | 36 | kind: "GitRepository" |
| 37 | address: "https://github.com/giolekva/pcloud.git" |
| 38 | branch: "main" |
| 39 | path: "charts/dns-api" |
| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 40 | } |
| 41 | volume: { |
| gio | f884341 | 2024-05-22 16:38:05 +0400 | [diff] [blame] | 42 | kind: "GitRepository" |
| 43 | address: "https://github.com/giolekva/pcloud.git" |
| 44 | branch: "main" |
| 45 | path: "charts/volumes" |
| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 46 | } |
| 47 | service: { |
| gio | f884341 | 2024-05-22 16:38:05 +0400 | [diff] [blame] | 48 | kind: "GitRepository" |
| 49 | address: "https://github.com/giolekva/pcloud.git" |
| 50 | branch: "main" |
| 51 | path: "charts/service" |
| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 52 | } |
| 53 | ipAddressPool: { |
| gio | f884341 | 2024-05-22 16:38:05 +0400 | [diff] [blame] | 54 | kind: "GitRepository" |
| 55 | address: "https://github.com/giolekva/pcloud.git" |
| 56 | branch: "main" |
| 57 | path: "charts/metallb-ipaddresspool" |
| gio | e72b54f | 2024-04-22 10:44:41 +0400 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
| 61 | volumes: { |
| 62 | data: { |
| 63 | name: "data" |
| 64 | accessMode: "ReadWriteMany" |
| 65 | size: "5Gi" |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | helm: { |
| 70 | coredns: { |
| 71 | chart: charts.coredns |
| 72 | values: { |
| 73 | image: { |
| 74 | repository: images.coredns.fullName |
| 75 | tag: images.coredns.tag |
| 76 | pullPolicy: images.coredns.pullPolicy |
| 77 | } |
| 78 | replicaCount: 1 |
| 79 | resources: { |
| 80 | limits: { |
| 81 | cpu: "100m" |
| 82 | memory: "128Mi" |
| 83 | } |
| 84 | requests: { |
| 85 | cpu: "100m" |
| 86 | memory: "128Mi" |
| 87 | } |
| 88 | } |
| 89 | rollingUpdate: { |
| 90 | maxUnavailable: 1 |
| 91 | maxSurge: "25%" |
| 92 | } |
| 93 | terminationGracePeriodSeconds: 30 |
| 94 | serviceType: "LoadBalancer" |
| 95 | service: { |
| 96 | name: "coredns" |
| 97 | annotations: { |
| 98 | "metallb.universe.tf/loadBalancerIPs": global.network.dns |
| 99 | } |
| 100 | } |
| 101 | serviceAccount: create: false |
| 102 | rbac: { |
| 103 | create: false |
| 104 | pspEnable: false |
| 105 | } |
| 106 | isClusterService: false |
| 107 | servers: [{ |
| 108 | zones: [{ |
| 109 | zone: "." |
| 110 | }] |
| 111 | port: 53 |
| 112 | plugins: [ |
| 113 | { |
| 114 | name: "log" |
| 115 | }, |
| 116 | { |
| 117 | name: "health" |
| 118 | configBlock: "lameduck 5s" |
| 119 | }, |
| 120 | { |
| 121 | name: "ready" |
| 122 | } |
| 123 | ] |
| 124 | }] |
| 125 | extraConfig: import: parameters: "\(_mountPath)/coredns.conf" |
| 126 | extraVolumes: [{ |
| 127 | name: volumes.data.name |
| 128 | persistentVolumeClaim: claimName: volumes.data.name |
| 129 | }] |
| 130 | extraVolumeMounts: [{ |
| 131 | name: volumes.data.name |
| 132 | mountPath: _mountPath |
| 133 | }] |
| 134 | livenessProbe: { |
| 135 | enabled: true |
| 136 | initialDelaySeconds: 60 |
| 137 | periodSeconds: 10 |
| 138 | timeoutSeconds: 5 |
| 139 | failureThreshold: 5 |
| 140 | successThreshold: 1 |
| 141 | } |
| 142 | readinessProbe: { |
| 143 | enabled: true |
| 144 | initialDelaySeconds: 30 |
| 145 | periodSeconds: 10 |
| 146 | timeoutSeconds: 5 |
| 147 | failureThreshold: 5 |
| 148 | successThreshold: 1 |
| 149 | } |
| 150 | zoneFiles: [] |
| 151 | hpa: enabled: false |
| 152 | autoscaler: enabled: false |
| 153 | deployment: enabled: true |
| 154 | } |
| 155 | } |
| 156 | api: { |
| 157 | chart: charts.api |
| 158 | values: { |
| 159 | image: { |
| 160 | repository: images.api.fullName |
| 161 | tag: images.api.tag |
| 162 | pullPolicy: images.api.pullPolicy |
| 163 | } |
| 164 | config: "coredns.conf" |
| 165 | db: "records.db" |
| 166 | zone: global.domain |
| 167 | publicIP: strings.Join(global.publicIP, ",") |
| 168 | privateIP: global.network.ingress |
| 169 | nameserverIP: strings.Join(global.nameserverIP, ",") |
| 170 | service: type: "ClusterIP" |
| 171 | volume: { |
| 172 | claimName: volumes.data.name |
| 173 | mountPath: _mountPath |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | "data-volume": { |
| 178 | chart: charts.volume |
| 179 | values: volumes.data |
| 180 | } |
| 181 | "coredns-svc-cluster": { |
| 182 | chart: charts.service |
| 183 | values: { |
| 184 | name: "dns" |
| 185 | type: "LoadBalancer" |
| 186 | protocol: "TCP" |
| 187 | ports: [{ |
| 188 | name: "udp-53" |
| 189 | port: 53 |
| 190 | protocol: "UDP" |
| 191 | targetPort: 53 |
| 192 | }] |
| 193 | targetPort: "http" |
| 194 | selector:{ |
| 195 | "app.kubernetes.io/instance": "coredns" |
| 196 | "app.kubernetes.io/name": "coredns" |
| 197 | } |
| 198 | annotations: { |
| 199 | "metallb.universe.tf/loadBalancerIPs": global.network.dnsInClusterIP |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | "ipaddresspool-dns": { |
| 204 | chart: charts.ipAddressPool |
| 205 | values: { |
| 206 | name: "\(global.id)-dns" |
| 207 | autoAssign: false |
| 208 | from: global.network.dns |
| 209 | to: global.network.dns |
| 210 | namespace: "metallb-system" |
| 211 | } |
| 212 | } |
| 213 | "ipaddresspool-dns-in-cluster": { |
| 214 | chart: charts.ipAddressPool |
| 215 | values: { |
| 216 | name: "\(global.id)-dns-in-cluster" |
| 217 | autoAssign: false |
| 218 | from: global.network.dnsInClusterIP |
| 219 | to: global.network.dnsInClusterIP |
| 220 | namespace: "metallb-system" |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | _mountPath: "/pcloud" |