blob: e22f177781fc4c21633b35a10921e8734b3b97f3 [file] [log] [blame]
gio266c04f2024-07-03 14:18:45 +04001import (
2 "encoding/base64"
3)
4
5input: {
gio266c04f2024-07-03 14:18:45 +04006 repoAddr: string
gio33059762024-07-05 13:19:07 +04007 repoHost: string
gio266c04f2024-07-03 14:18:45 +04008 gitRepoPublicKey: string
9 // TODO(gio): auto generate
10 fluxKeys: #SSHKey
11}
12
13name: "Dodo App Instance"
14namespace: "dodo-app-instance"
15readme: "Deploy app by pushing to Git repository"
16description: "Deploy app by pushing to Git repository"
17icon: ""
18_domain: "\(input.subdomain).\(input.network.domain)"
19
20resources: {
21 "config-kustomization": {
22 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
23 kind: "Kustomization"
24 metadata: {
gio33059762024-07-05 13:19:07 +040025 name: "app"
gio266c04f2024-07-03 14:18:45 +040026 namespace: release.namespace
27 }
28 spec: {
29 interval: "1m"
30 path: "./"
31 sourceRef: {
32 kind: "GitRepository"
33 name: "app"
34 namespace: release.namespace
35 }
36 prune: true
37 }
38 }
39 "config-secret": {
40 apiVersion: "v1"
41 kind: "Secret"
42 type: "Opaque"
43 metadata: {
gio33059762024-07-05 13:19:07 +040044 name: "app"
gio266c04f2024-07-03 14:18:45 +040045 namespace: release.namespace
46 }
47 data: {
48 identity: base64.Encode(null, input.fluxKeys.private)
49 "identity.pub": base64.Encode(null, input.fluxKeys.public)
gio33059762024-07-05 13:19:07 +040050 known_hosts: base64.Encode(null, "\(input.repoHost) \(input.gitRepoPublicKey)")
gio266c04f2024-07-03 14:18:45 +040051 }
52 }
53 "config-source": {
54 apiVersion: "source.toolkit.fluxcd.io/v1"
55 kind: "GitRepository"
56 metadata: {
gio33059762024-07-05 13:19:07 +040057 name: "app"
gio266c04f2024-07-03 14:18:45 +040058 namespace: release.namespace
59 }
60 spec: {
61 interval: "1m0s"
62 ref: branch: "dodo"
gio33059762024-07-05 13:19:07 +040063 secretRef: name: "app"
gio266c04f2024-07-03 14:18:45 +040064 timeout: "60s"
65 url: input.repoAddr
66 }
67 }
68}