| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 1 | import ( |
| 2 | "encoding/base64" |
| 3 | ) |
| 4 | |
| 5 | input: { |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 6 | repoAddr: string |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 7 | repoHost: string |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 8 | gitRepoPublicKey: string |
| 9 | // TODO(gio): auto generate |
| 10 | fluxKeys: #SSHKey |
| 11 | } |
| 12 | |
| 13 | name: "Dodo App Instance" |
| 14 | namespace: "dodo-app-instance" |
| 15 | readme: "Deploy app by pushing to Git repository" |
| 16 | description: "Deploy app by pushing to Git repository" |
| 17 | icon: "" |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 18 | |
| 19 | resources: { |
| 20 | "config-kustomization": { |
| 21 | apiVersion: "kustomize.toolkit.fluxcd.io/v1" |
| 22 | kind: "Kustomization" |
| 23 | metadata: { |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 24 | name: "app" |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 25 | 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: { |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 43 | name: "app" |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 44 | namespace: release.namespace |
| 45 | } |
| 46 | data: { |
| 47 | identity: base64.Encode(null, input.fluxKeys.private) |
| 48 | "identity.pub": base64.Encode(null, input.fluxKeys.public) |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 49 | known_hosts: base64.Encode(null, "\(input.repoHost) \(input.gitRepoPublicKey)") |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | "config-source": { |
| 53 | apiVersion: "source.toolkit.fluxcd.io/v1" |
| 54 | kind: "GitRepository" |
| 55 | metadata: { |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 56 | name: "app" |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 57 | namespace: release.namespace |
| 58 | } |
| 59 | spec: { |
| 60 | interval: "1m0s" |
| 61 | ref: branch: "dodo" |
| gio | 3305976 | 2024-07-05 13:19:07 +0400 | [diff] [blame] | 62 | secretRef: name: "app" |
| gio | 266c04f | 2024-07-03 14:18:45 +0400 | [diff] [blame] | 63 | timeout: "60s" |
| 64 | url: input.repoAddr |
| 65 | } |
| 66 | } |
| 67 | } |