blob: e0d6906a5a077eae365bc9c923d3b1dff4d1d2d8 [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: ""
gio266c04f2024-07-03 14:18:45 +040018
19resources: {
20 "config-kustomization": {
21 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
22 kind: "Kustomization"
23 metadata: {
gio33059762024-07-05 13:19:07 +040024 name: "app"
gio266c04f2024-07-03 14:18:45 +040025 namespace: release.namespace
26 }
27 spec: {
28 interval: "1m"
29 path: "./"
30 sourceRef: {
31 kind: "GitRepository"
32 name: "app"
33 namespace: release.namespace
34 }
35 prune: true
36 }
37 }
38 "config-secret": {
39 apiVersion: "v1"
40 kind: "Secret"
41 type: "Opaque"
42 metadata: {
gio33059762024-07-05 13:19:07 +040043 name: "app"
gio266c04f2024-07-03 14:18:45 +040044 namespace: release.namespace
45 }
46 data: {
47 identity: base64.Encode(null, input.fluxKeys.private)
48 "identity.pub": base64.Encode(null, input.fluxKeys.public)
gio33059762024-07-05 13:19:07 +040049 known_hosts: base64.Encode(null, "\(input.repoHost) \(input.gitRepoPublicKey)")
gio266c04f2024-07-03 14:18:45 +040050 }
51 }
52 "config-source": {
53 apiVersion: "source.toolkit.fluxcd.io/v1"
54 kind: "GitRepository"
55 metadata: {
gio33059762024-07-05 13:19:07 +040056 name: "app"
gio266c04f2024-07-03 14:18:45 +040057 namespace: release.namespace
58 }
59 spec: {
60 interval: "1m0s"
61 ref: branch: "dodo"
gio33059762024-07-05 13:19:07 +040062 secretRef: name: "app"
gio266c04f2024-07-03 14:18:45 +040063 timeout: "60s"
64 url: input.repoAddr
65 }
66 }
67}