blob: 6b86890a1e328e1d20b92ec78b246d47f51f6e46 [file] [log] [blame]
gio4a9d83d2024-04-14 13:14:40 +04001import (
gio46994402024-07-31 18:11:00 +04002 "encoding/yaml"
gio4a9d83d2024-04-14 13:14:40 +04003 "encoding/json"
4)
5
6input: {
gio44f621b2024-04-29 09:44:38 +04007 network: #Network @name(Network)
8 subdomain: string @name(Subdomain)
gio4a9d83d2024-04-14 13:14:40 +04009}
10
11_domain: "\(input.subdomain).\(input.network.domain)"
gio09a3e5b2024-04-26 14:11:06 +040012url: "https://\(_domain)"
gio4a9d83d2024-04-14 13:14:40 +040013
gio44f621b2024-04-29 09:44:38 +040014name: "Zot"
gio4a9d83d2024-04-14 13:14:40 +040015namespace: "app-zot"
16readme: "OCI-native container image registry, simplified"
17description: "OCI-native container image registry, simplified"
18icon: "<svg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 24 24'><path fill='currentColor' d='M21.231 2.462L7.18 20.923h14.564V24H2.256v-2.462L16.308 3.076H2.975V0h18.256z'/></svg>"
19
gio1de49582024-04-21 08:33:57 +040020ingress: {
21 zot: {
22 auth: enabled: false
gio4a9d83d2024-04-14 13:14:40 +040023 network: input.network
24 subdomain: input.subdomain
gio1de49582024-04-21 08:33:57 +040025 service: {
26 name: "zot"
27 port: number: _httpPort // TODO(gio): make optional
28 }
gio4a9d83d2024-04-14 13:14:40 +040029 }
30}
31
32// TODO(gio): configure busybox
gio1de49582024-04-21 08:33:57 +040033images: {
gio4a9d83d2024-04-14 13:14:40 +040034 zot: {
35 registry: "ghcr.io"
36 repository: "project-zot"
37 name: "zot-linux-amd64"
38 tag: "v2.0.3"
39 pullPolicy: "IfNotPresent"
40 }
41}
42
gio1de49582024-04-21 08:33:57 +040043charts: {
gio4a9d83d2024-04-14 13:14:40 +040044 zot: {
giof8843412024-05-22 16:38:05 +040045 kind: "GitRepository"
46 address: "https://github.com/giolekva/pcloud.git"
47 branch: "main"
48 path: "charts/zot"
gio4a9d83d2024-04-14 13:14:40 +040049 }
gio46994402024-07-31 18:11:00 +040050 oauth2Client: {
51 kind: "GitRepository"
52 address: "https://github.com/giolekva/pcloud.git"
53 branch: "main"
54 path: "charts/oauth2-client"
55 }
56 resourceRenderer: {
57 kind: "GitRepository"
58 address: "https://github.com/giolekva/pcloud.git"
59 branch: "main"
60 path: "charts/resource-renderer"
61 }
gio4a9d83d2024-04-14 13:14:40 +040062}
63
gio01cf5cb2024-06-28 00:18:18 +040064volumes: zot: size: "100Gi"
gio4a9d83d2024-04-14 13:14:40 +040065
66_httpPort: 80
gio46994402024-07-31 18:11:00 +040067_oauth2ClientSecretName: "oauth2-client"
gio4a9d83d2024-04-14 13:14:40 +040068
gio1de49582024-04-21 08:33:57 +040069helm: {
gio46994402024-07-31 18:11:00 +040070 "oauth2-client": {
71 chart: charts.oauth2Client
72 info: "Creating OAuth2 client"
73 // TODO(gio): remove once hydra maester is installed as part of dodo itself
74 dependsOn: [{
75 name: "auth"
76 namespace: "\(global.namespacePrefix)core-auth"
77 }]
78 values: {
79 name: "\(release.namespace)-zot"
80 secretName: _oauth2ClientSecretName
81 grantTypes: ["authorization_code"]
82 responseTypes: ["code"]
83 scope: "openid profile email groups"
84 redirectUris: ["https://\(_domain)/zot/auth/callback/oidc"]
85 hydraAdmin: "http://hydra-admin.\(global.namespacePrefix)core-auth.svc.cluster.local"
86 }
87 }
88 "config-renderer": {
89 chart: charts.resourceRenderer
90 info: "Generating Zot configuration"
91 values: {
92 name: "config-renderer"
93 secretName: _oauth2ClientSecretName
94 resourceTemplate: yaml.Marshal({
95 apiVersion: "v1"
96 kind: "ConfigMap"
97 metadata: {
98 name: _zotConfigMapName
99 namespace: "\(release.namespace)"
100 }
101 data: {
102 "config.json": json.Marshal({
103 storage: rootDirectory: "/var/lib/registry"
104 http: {
105 address: "0.0.0.0"
106 port: "5000"
107 externalUrl: url
108 auth: openid: providers: oidc: {
109 name: "dodo:"
110 issuer: "https://hydra.\(networks.public.domain)"
111 clientid: "{{ .client_id }}"
112 clientsecret: "{{ .client_secret }}"
113 keypath: ""
114 scopes: ["openid", "profile", "email", "groups"]
115 }
116 accessControl: {
117 repositories: {
118 "**": {
119 defaultPolicy: ["read", "create", "update", "delete"]
120 anonymousPolicy: ["read"]
121 }
122 }
123 }
124 }
125 log: level: "debug"
126 extensions: {
127 ui: enable: true
128 search: enable: true
129 }
130 })
131 }
132 })
133 }
134 }
gio4a9d83d2024-04-14 13:14:40 +0400135 zot: {
136 chart: charts.zot
giof9f0bee2024-06-11 20:10:05 +0400137 info: "Installing Zot server"
gio4a9d83d2024-04-14 13:14:40 +0400138 values: {
139 image: {
140 repository: images.zot.fullName
141 tag: images.zot.tag
142 pullPolicy: images.zot.pullPolicy
143 }
144 service: {
145 type: "ClusterIP"
146 additionalAnnotations: {
147 "metallb.universe.tf/address-pool": global.id
148 }
149 port: _httpPort
150 }
151 ingress: enabled: false
gio46994402024-07-31 18:11:00 +0400152 mountConfig: false
giof8843412024-05-22 16:38:05 +0400153 persistence: true
gio4a9d83d2024-04-14 13:14:40 +0400154 pvc: {
155 create: false
156 name: volumes.zot.name
157 }
gio46994402024-07-31 18:11:00 +0400158 extraVolumes: [{
159 name: "config"
160 configMap: name: _zotConfigMapName
161 }]
162 extraVolumeMounts: [{
163 name: "config"
164 mountPath: "/etc/zot"
165 }]
gio4a9d83d2024-04-14 13:14:40 +0400166 startupProbe: {}
167 }
168 }
gio4a9d83d2024-04-14 13:14:40 +0400169}
gio46994402024-07-31 18:11:00 +0400170
171_zotConfigMapName: "zot-config"
172
173help: [{
174 title: "Authenticate"
175 contents: """
176 First generate new API key.
177 docker login \\-\\-username=**\\<YOUR-USERNAME\\>**@\(networks.public.domain) \\-\\-password=**\\<YOUR-API-KEY\\>** \(_domain)
178 docker build \\-\\-tag=\(_domain)/**\\<IMAGE-NAME\\>**:**\\<IMAGE-TAG\\>** .
179 docker push \\-\\-tag=\(_domain)/**\\<IMAGE-NAME\\>**:**\\<IMAGE-TAG\\>**
180 """
181}]