blob: 725585297a5c07a95de599bbf5cf63ec2b753c38 [file] [log] [blame]
gio266c04f2024-07-03 14:18:45 +04001import (
2 "encoding/base64"
3)
4
5input: {
gio9bd87ca2025-04-20 08:05:34 +04006 repoAddr: string
7 repoHost: string
8 branch: string
gio266c04f2024-07-03 14:18:45 +04009 gitRepoPublicKey: string
10 // TODO(gio): auto generate
11 fluxKeys: #SSHKey
12}
13
gio9bd87ca2025-04-20 08:05:34 +040014name: "Dodo App Instance"
15namespace: "dodo-app-instance"
16readme: "Deploy app by pushing to Git repository"
gio266c04f2024-07-03 14:18:45 +040017description: "Deploy app by pushing to Git repository"
gio9bd87ca2025-04-20 08:05:34 +040018icon: ""
gio266c04f2024-07-03 14:18:45 +040019
20resources: {
21 "config-kustomization": {
22 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
gio9bd87ca2025-04-20 08:05:34 +040023 kind: "Kustomization"
gio266c04f2024-07-03 14:18:45 +040024 metadata: {
gio9bd87ca2025-04-20 08:05:34 +040025 name: "app"
gio266c04f2024-07-03 14:18:45 +040026 namespace: release.namespace
27 }
28 spec: {
29 interval: "1m"
gio9bd87ca2025-04-20 08:05:34 +040030 path: "./"
gio266c04f2024-07-03 14:18:45 +040031 sourceRef: {
gio9bd87ca2025-04-20 08:05:34 +040032 kind: "GitRepository"
33 name: "app"
gio266c04f2024-07-03 14:18:45 +040034 namespace: release.namespace
35 }
36 prune: true
37 }
38 }
39 "config-secret": {
40 apiVersion: "v1"
gio9bd87ca2025-04-20 08:05:34 +040041 kind: "Secret"
42 type: "Opaque"
gio266c04f2024-07-03 14:18:45 +040043 metadata: {
gio9bd87ca2025-04-20 08:05:34 +040044 name: "app"
gio266c04f2024-07-03 14:18:45 +040045 namespace: release.namespace
46 }
47 data: {
gio9bd87ca2025-04-20 08:05:34 +040048 identity: base64.Encode(null, input.fluxKeys.private)
gio266c04f2024-07-03 14:18:45 +040049 "identity.pub": base64.Encode(null, input.fluxKeys.public)
gio9bd87ca2025-04-20 08:05:34 +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"
gio9bd87ca2025-04-20 08:05:34 +040055 kind: "GitRepository"
gio266c04f2024-07-03 14:18:45 +040056 metadata: {
gio9bd87ca2025-04-20 08:05:34 +040057 name: "app"
gio266c04f2024-07-03 14:18:45 +040058 namespace: release.namespace
59 }
60 spec: {
61 interval: "1m0s"
gio9bd87ca2025-04-20 08:05:34 +040062 ref: branch: input.branch
gio33059762024-07-05 13:19:07 +040063 secretRef: name: "app"
gio266c04f2024-07-03 14:18:45 +040064 timeout: "60s"
gio9bd87ca2025-04-20 08:05:34 +040065 url: input.repoAddr
gio266c04f2024-07-03 14:18:45 +040066 }
67 }
68}