blob: e783ffe745426af8ff7189a43bac5c66d5e93c27 [file] [log] [blame]
gio266c04f2024-07-03 14:18:45 +04001import (
2 "encoding/base64"
3)
4
5input: {
6 appName: string
7 repoAddr: string
8 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: {
25 name: input.appName
26 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: {
44 name: input.appName
45 namespace: release.namespace
46 }
47 data: {
48 identity: base64.Encode(null, input.fluxKeys.private)
49 "identity.pub": base64.Encode(null, input.fluxKeys.public)
50 known_hosts: base64.Encode(null, "soft-serve.\(release.namespace).svc.cluster.local \(input.gitRepoPublicKey)")
51 }
52 }
53 "config-source": {
54 apiVersion: "source.toolkit.fluxcd.io/v1"
55 kind: "GitRepository"
56 metadata: {
57 name: input.appName
58 namespace: release.namespace
59 }
60 spec: {
61 interval: "1m0s"
62 ref: branch: "dodo"
63 secretRef: name: input.appName
64 timeout: "60s"
65 url: input.repoAddr
66 }
67 }
68}