blob: 4ed15496f7b3471f115ef882798cc2364daa70bb [file] [log] [blame]
giolekva8aa73e82022-07-09 11:34:39 +04001package installer
giolekva050609f2021-12-29 15:51:40 +04002
giolekva8aa73e82022-07-09 11:34:39 +04003import (
4 "embed"
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +04005 "fmt"
giolekva8aa73e82022-07-09 11:34:39 +04006 "log"
7 "text/template"
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +04008
9 "github.com/Masterminds/sprig/v3"
giolekva8aa73e82022-07-09 11:34:39 +040010)
giolekva050609f2021-12-29 15:51:40 +040011
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040012//go:embed values-tmpl
13var valuesTmpls embed.FS
14
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040015type Named interface {
16 Nam() string
17}
18
giolekva050609f2021-12-29 15:51:40 +040019type App struct {
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +040020 Name string
21 Namespaces []string
22 Templates []*template.Template
23 Schema string
24 Readme *template.Template
giolekva050609f2021-12-29 15:51:40 +040025}
26
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040027type StoreApp struct {
28 App
29 Icon string
30 ShortDescription string
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040031}
32
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040033func (a App) Nam() string {
34 return a.Name
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040035}
36
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040037func (a StoreApp) Nam() string {
38 return a.Name
39}
40
41type AppRepository[A Named] interface {
42 GetAll() ([]A, error)
43 Find(name string) (*A, error)
44}
45
46type InMemoryAppRepository[A Named] struct {
47 apps []A
48}
49
50func NewInMemoryAppRepository[A Named](apps []A) AppRepository[A] {
51 return &InMemoryAppRepository[A]{
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040052 apps,
53 }
54}
55
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040056func (r InMemoryAppRepository[A]) Find(name string) (*A, error) {
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040057 for _, a := range r.apps {
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040058 if a.Nam() == name {
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040059 return &a, nil
60 }
61 }
62 return nil, fmt.Errorf("Application not found: %s", name)
63}
giolekva8aa73e82022-07-09 11:34:39 +040064
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040065func (r InMemoryAppRepository[A]) GetAll() ([]A, error) {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +040066 return r.apps, nil
67}
68
giolekva8aa73e82022-07-09 11:34:39 +040069func CreateAllApps() []App {
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +040070 tmpls, err := template.New("root").Funcs(template.FuncMap(sprig.FuncMap())).ParseFS(valuesTmpls, "values-tmpl/*")
giolekva8aa73e82022-07-09 11:34:39 +040071 if err != nil {
72 log.Fatal(err)
73 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040074 ret := []App{
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +040075 CreateAppIngressPrivate(valuesTmpls, tmpls),
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +040076 CreateCertificateIssuerPublic(valuesTmpls, tmpls),
77 CreateCertificateIssuerPrivate(valuesTmpls, tmpls),
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +040078 CreateAppCoreAuth(valuesTmpls, tmpls),
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +040079 CreateAppHeadscale(valuesTmpls, tmpls),
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +040080 CreateAppTailscaleProxy(valuesTmpls, tmpls),
81 CreateMetallbConfigEnv(valuesTmpls, tmpls),
82 CreateEnvManager(valuesTmpls, tmpls),
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +040083 CreateWelcome(valuesTmpls, tmpls),
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +040084 CreateIngressPublic(valuesTmpls, tmpls),
85 CreateCertManager(valuesTmpls, tmpls),
86 CreateCertManagerWebhookGandi(valuesTmpls, tmpls),
87 CreateCertManagerWebhookGandiRole(valuesTmpls, tmpls),
88 CreateCSIDriverSMB(valuesTmpls, tmpls),
89 CreateResourceRendererController(valuesTmpls, tmpls),
90 CreateHeadscaleController(valuesTmpls, tmpls),
giolekvaef76a3e2022-01-10 12:22:28 +040091 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +040092 for _, a := range CreateStoreApps() {
93 ret = append(ret, a.App)
94 }
95 return ret
96}
97
98func CreateStoreApps() []StoreApp {
99 tmpls, err := template.New("root").Funcs(template.FuncMap(sprig.FuncMap())).ParseFS(valuesTmpls, "values-tmpl/*")
100 if err != nil {
101 log.Fatal(err)
102 }
103 return []StoreApp{
104 CreateAppVaultwarden(valuesTmpls, tmpls),
105 CreateAppMatrix(valuesTmpls, tmpls),
106 CreateAppPihole(valuesTmpls, tmpls),
107 CreateAppMaddy(valuesTmpls, tmpls),
108 CreateAppQBittorrent(valuesTmpls, tmpls),
109 CreateAppJellyfin(valuesTmpls, tmpls),
110 CreateAppRpuppy(valuesTmpls, tmpls),
111 }
giolekvaef76a3e2022-01-10 12:22:28 +0400112}
113
Giorgi Lekveishvili4d2784d2023-06-01 14:27:32 +0400114// TODO(gio): service account needs permission to create/update secret
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400115func CreateAppIngressPrivate(fs embed.FS, tmpls *template.Template) App {
116 schema, err := fs.ReadFile("values-tmpl/ingress-private.jsonschema")
117 if err != nil {
118 panic(err)
119 }
giolekva050609f2021-12-29 15:51:40 +0400120 return App{
121 "ingress-private",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400122 []string{"ingress-private"},
giolekva050609f2021-12-29 15:51:40 +0400123 []*template.Template{
giolekva050609f2021-12-29 15:51:40 +0400124 tmpls.Lookup("ingress-private.yaml"),
giolekva050609f2021-12-29 15:51:40 +0400125 },
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400126 string(schema),
Giorgi Lekveishvili4d2784d2023-06-01 14:27:32 +0400127 tmpls.Lookup("ingress-private.md"),
giolekva050609f2021-12-29 15:51:40 +0400128 }
129}
130
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400131func CreateCertificateIssuerPrivate(fs embed.FS, tmpls *template.Template) App {
132 schema, err := fs.ReadFile("values-tmpl/certificate-issuer-private.jsonschema")
133 if err != nil {
134 panic(err)
135 }
136 return App{
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +0400137 "certificate-issuer-private",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400138 []string{},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400139 []*template.Template{
140 tmpls.Lookup("certificate-issuer-private.yaml"),
141 },
142 string(schema),
143 tmpls.Lookup("certificate-issuer-private.md"),
144 }
145}
146
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +0400147func CreateCertificateIssuerPublic(fs embed.FS, tmpls *template.Template) App {
148 schema, err := fs.ReadFile("values-tmpl/certificate-issuer-public.jsonschema")
149 if err != nil {
150 panic(err)
151 }
152 return App{
153 "certificate-issuer-public",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400154 []string{},
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +0400155 []*template.Template{
156 tmpls.Lookup("certificate-issuer-public.yaml"),
157 },
158 string(schema),
159 tmpls.Lookup("certificate-issuer-public.md"),
160 }
161}
162
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400163func CreateAppCoreAuth(fs embed.FS, tmpls *template.Template) App {
164 schema, err := fs.ReadFile("values-tmpl/core-auth.jsonschema")
165 if err != nil {
166 panic(err)
167 }
giolekva050609f2021-12-29 15:51:40 +0400168 return App{
169 "core-auth",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400170 []string{"core-auth"},
giolekva050609f2021-12-29 15:51:40 +0400171 []*template.Template{
172 tmpls.Lookup("core-auth-storage.yaml"),
173 tmpls.Lookup("core-auth.yaml"),
174 },
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400175 string(schema),
Giorgi Lekveishvili3ca1f3f2023-05-30 14:33:02 +0400176 tmpls.Lookup("core-auth.md"),
giolekva050609f2021-12-29 15:51:40 +0400177 }
178}
179
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400180func CreateAppVaultwarden(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400181 schema, err := fs.ReadFile("values-tmpl/vaultwarden.jsonschema")
182 if err != nil {
183 panic(err)
184 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400185 return StoreApp{
186 App: App{
187 "vaultwarden",
188 []string{"app-vaultwarden"},
189 []*template.Template{
190 tmpls.Lookup("vaultwarden.yaml"),
191 },
192 string(schema),
193 tmpls.Lookup("vaultwarden.md"),
giolekva050609f2021-12-29 15:51:40 +0400194 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400195 Icon: "arcticons:bitwarden",
196 ShortDescription: "Open source implementation of Bitwarden password manager. Can be used with official client applications.",
giolekva050609f2021-12-29 15:51:40 +0400197 }
198}
199
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400200func CreateAppMatrix(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400201 schema, err := fs.ReadFile("values-tmpl/matrix.jsonschema")
202 if err != nil {
203 panic(err)
204 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400205 return StoreApp{
206 App{
207 "matrix",
208 []string{"app-matrix"},
209 []*template.Template{
210 tmpls.Lookup("matrix-storage.yaml"),
211 tmpls.Lookup("matrix.yaml"),
212 },
213 string(schema),
214 nil,
giolekva050609f2021-12-29 15:51:40 +0400215 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400216 "simple-icons:matrix",
217 "An open network for secure, decentralised communication",
giolekva050609f2021-12-29 15:51:40 +0400218 }
219}
220
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400221func CreateAppPihole(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400222 schema, err := fs.ReadFile("values-tmpl/pihole.jsonschema")
223 if err != nil {
224 panic(err)
225 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400226 return StoreApp{
227 App{
228 "pihole",
229 []string{"app-pihole"},
230 []*template.Template{
231 tmpls.Lookup("pihole.yaml"),
232 },
233 string(schema),
234 tmpls.Lookup("pihole.md"),
giolekva050609f2021-12-29 15:51:40 +0400235 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400236 "simple-icons:pihole",
237 "Pi-hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole and optionally a DHCP server, intended for use on a private network.",
giolekva050609f2021-12-29 15:51:40 +0400238 }
239}
240
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400241func CreateAppMaddy(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400242 schema, err := fs.ReadFile("values-tmpl/maddy.jsonschema")
243 if err != nil {
244 panic(err)
245 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400246 return StoreApp{
247 App{
248 "maddy",
249 []string{"app-maddy"},
250 []*template.Template{
251 tmpls.Lookup("maddy.yaml"),
252 },
253 string(schema),
254 nil,
giolekva050609f2021-12-29 15:51:40 +0400255 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400256 "arcticons:huawei-email",
257 "SMPT/IMAP server to communicate via email.",
giolekva050609f2021-12-29 15:51:40 +0400258 }
259}
giolekvaef76a3e2022-01-10 12:22:28 +0400260
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400261func CreateAppQBittorrent(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400262 schema, err := fs.ReadFile("values-tmpl/qbittorrent.jsonschema")
263 if err != nil {
264 panic(err)
265 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400266 return StoreApp{
267 App{
268 "qbittorrent",
269 []string{"app-qbittorrent"},
270 []*template.Template{
271 tmpls.Lookup("qbittorrent.yaml"),
272 },
273 string(schema),
274 tmpls.Lookup("qbittorrent.md"),
giolekvaef76a3e2022-01-10 12:22:28 +0400275 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400276 "arcticons:qbittorrent-remote",
277 "qBittorrent is a cross-platform free and open-source BitTorrent client written in native C++. It relies on Boost, Qt 6 toolkit and the libtorrent-rasterbar library, with an optional search engine written in Python.",
giolekvaef76a3e2022-01-10 12:22:28 +0400278 }
279}
280
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400281func CreateAppJellyfin(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400282 schema, err := fs.ReadFile("values-tmpl/jellyfin.jsonschema")
283 if err != nil {
284 panic(err)
285 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400286 return StoreApp{
287 App{
288 "jellyfin",
289 []string{"app-jellyfin"},
290 []*template.Template{
291 tmpls.Lookup("jellyfin.yaml"),
292 },
293 string(schema),
294 nil,
giolekvaef76a3e2022-01-10 12:22:28 +0400295 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400296 "arcticons:jellyfin",
297 "Jellyfin is a free and open-source media server and suite of multimedia applications designed to organize, manage, and share digital media files to networked devices.",
giolekvaef76a3e2022-01-10 12:22:28 +0400298 }
299}
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400300
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400301func CreateAppRpuppy(fs embed.FS, tmpls *template.Template) StoreApp {
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400302 schema, err := fs.ReadFile("values-tmpl/rpuppy.jsonschema")
303 if err != nil {
304 panic(err)
305 }
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400306 return StoreApp{
307 App{
308 "rpuppy",
309 []string{"app-rpuppy"},
310 []*template.Template{
311 tmpls.Lookup("rpuppy.yaml"),
312 },
313 string(schema),
314 tmpls.Lookup("rpuppy.md"),
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400315 },
Giorgi Lekveishvili27b2b572023-06-30 10:44:45 +0400316 "ph:dog-thin",
317 "Delights users with randomly generate puppy pictures. Can be configured to be reachable only from private network or publicly.",
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400318 }
319}
320
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400321func CreateAppHeadscale(fs embed.FS, tmpls *template.Template) App {
322 schema, err := fs.ReadFile("values-tmpl/headscale.jsonschema")
323 if err != nil {
324 panic(err)
325 }
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400326 return App{
327 "headscale",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400328 []string{"app-headscale"},
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400329 []*template.Template{
330 tmpls.Lookup("headscale.yaml"),
331 },
Giorgi Lekveishvili7efe22f2023-05-30 13:01:53 +0400332 string(schema),
Giorgi Lekveishvili3a907052023-05-30 13:33:32 +0400333 tmpls.Lookup("headscale.md"),
Giorgi Lekveishvili23ef7f82023-05-26 11:57:48 +0400334 }
335}
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400336
337func CreateAppTailscaleProxy(fs embed.FS, tmpls *template.Template) App {
338 schema, err := fs.ReadFile("values-tmpl/tailscale-proxy.jsonschema")
339 if err != nil {
340 panic(err)
341 }
342 return App{
343 "tailscale-proxy",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400344 []string{"tailscale-proxy"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400345 []*template.Template{
346 tmpls.Lookup("tailscale-proxy.yaml"),
347 },
348 string(schema),
349 tmpls.Lookup("tailscale-proxy.md"),
350 }
351}
352
353func CreateMetallbConfigEnv(fs embed.FS, tmpls *template.Template) App {
354 schema, err := fs.ReadFile("values-tmpl/metallb-config-env.jsonschema")
355 if err != nil {
356 panic(err)
357 }
358 return App{
359 "metallb-config-env",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400360 []string{"metallb-config"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400361 []*template.Template{
362 tmpls.Lookup("metallb-config-env.yaml"),
363 },
364 string(schema),
365 tmpls.Lookup("metallb-config-env.md"),
366 }
367}
368
369func CreateEnvManager(fs embed.FS, tmpls *template.Template) App {
370 schema, err := fs.ReadFile("values-tmpl/env-manager.jsonschema")
371 if err != nil {
372 panic(err)
373 }
374 return App{
375 "env-manager",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400376 []string{"env-manager"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400377 []*template.Template{
378 tmpls.Lookup("env-manager.yaml"),
379 },
380 string(schema),
381 tmpls.Lookup("env-manager.md"),
382 }
383}
384
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +0400385func CreateWelcome(fs embed.FS, tmpls *template.Template) App {
386 schema, err := fs.ReadFile("values-tmpl/welcome.jsonschema")
387 if err != nil {
388 panic(err)
389 }
390 return App{
391 "welcome",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400392 []string{"app-welcome"},
Giorgi Lekveishvili12850ee2023-06-22 13:11:17 +0400393 []*template.Template{
394 tmpls.Lookup("welcome.yaml"),
395 },
396 string(schema),
397 tmpls.Lookup("welcome.md"),
398 }
399}
400
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400401func CreateIngressPublic(fs embed.FS, tmpls *template.Template) App {
402 schema, err := fs.ReadFile("values-tmpl/ingress-public.jsonschema")
403 if err != nil {
404 panic(err)
405 }
406 return App{
407 "ingress-public",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400408 []string{"ingress-public"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400409 []*template.Template{
410 tmpls.Lookup("ingress-public.yaml"),
411 },
412 string(schema),
413 tmpls.Lookup("ingress-public.md"),
414 }
415}
416
417func CreateCertManager(fs embed.FS, tmpls *template.Template) App {
418 schema, err := fs.ReadFile("values-tmpl/cert-manager.jsonschema")
419 if err != nil {
420 panic(err)
421 }
422 return App{
423 "cert-manager",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400424 []string{"cert-manager"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400425 []*template.Template{
426 tmpls.Lookup("cert-manager.yaml"),
427 },
428 string(schema),
429 tmpls.Lookup("cert-manager.md"),
430 }
431}
432
433func CreateCertManagerWebhookGandi(fs embed.FS, tmpls *template.Template) App {
434 schema, err := fs.ReadFile("values-tmpl/cert-manager-webhook-gandi.jsonschema")
435 if err != nil {
436 panic(err)
437 }
438 return App{
439 "cert-manager-webhook-gandi",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400440 []string{},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400441 []*template.Template{
442 tmpls.Lookup("cert-manager-webhook-gandi.yaml"),
443 },
444 string(schema),
445 tmpls.Lookup("cert-manager-webhook-gandi.md"),
446 }
447}
448
449func CreateCertManagerWebhookGandiRole(fs embed.FS, tmpls *template.Template) App {
450 schema, err := fs.ReadFile("values-tmpl/cert-manager-webhook-gandi-role.jsonschema")
451 if err != nil {
452 panic(err)
453 }
454 return App{
455 "cert-manager-webhook-gandi-role",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400456 []string{},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400457 []*template.Template{
458 tmpls.Lookup("cert-manager-webhook-gandi-role.yaml"),
459 },
460 string(schema),
461 tmpls.Lookup("cert-manager-webhook-gandi-role.md"),
462 }
463}
464
465func CreateCSIDriverSMB(fs embed.FS, tmpls *template.Template) App {
466 schema, err := fs.ReadFile("values-tmpl/csi-driver-smb.jsonschema")
467 if err != nil {
468 panic(err)
469 }
470 return App{
471 "csi-driver-smb",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400472 []string{"csi-driver-smb"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400473 []*template.Template{
474 tmpls.Lookup("csi-driver-smb.yaml"),
475 },
476 string(schema),
477 tmpls.Lookup("csi-driver-smb.md"),
478 }
479}
480
481func CreateResourceRendererController(fs embed.FS, tmpls *template.Template) App {
482 schema, err := fs.ReadFile("values-tmpl/resource-renderer-controller.jsonschema")
483 if err != nil {
484 panic(err)
485 }
486 return App{
487 "resource-renderer-controller",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400488 []string{"rr-controller"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400489 []*template.Template{
490 tmpls.Lookup("resource-renderer-controller.yaml"),
491 },
492 string(schema),
493 tmpls.Lookup("resource-renderer-controller.md"),
494 }
495}
496
497func CreateHeadscaleController(fs embed.FS, tmpls *template.Template) App {
498 schema, err := fs.ReadFile("values-tmpl/headscale-controller.jsonschema")
499 if err != nil {
500 panic(err)
501 }
502 return App{
503 "headscale-controller",
Giorgi Lekveishvili7fb28bf2023-06-24 19:51:16 +0400504 []string{"headscale-controller"},
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +0400505 []*template.Template{
506 tmpls.Lookup("headscale-controller.yaml"),
507 },
508 string(schema),
509 tmpls.Lookup("headscale-controller.md"),
510 }
511}