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