-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathchart.go
More file actions
72 lines (61 loc) · 1.88 KB
/
chart.go
File metadata and controls
72 lines (61 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2025 Redpanda Data, Inc.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.md
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0
// +gotohelm:filename=_chart.go.tpl
package console
import (
"embed"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
"github.com/redpanda-data/redpanda-operator/gotohelm"
"github.com/redpanda-data/redpanda-operator/gotohelm/helmette"
"github.com/redpanda-data/redpanda-operator/pkg/kube"
)
var (
// Scheme is a [runtime.Scheme] with the appropriate extensions to load all
// objects produced by the console chart.
Scheme = runtime.NewScheme()
//go:embed Chart.yaml
//go:embed templates/*
//go:embed values.schema.json
//go:embed values.yaml
chartFiles embed.FS
// ChartLabel is the go version of the console helm chart.
Chart = gotohelm.MustLoad(chartFiles, render)
)
// +gotohelm:ignore=true
func init() {
must(scheme.AddToScheme(Scheme))
}
// +gotohelm:ignore=true
func must(err error) {
if err != nil {
panic(err)
}
}
// render is the entrypoint to both the go and helm versions of the console
// helm chart.
// In helm, _shims.render-manifest is used to call and filter the output of
// this function.
// In go, this function should be call by executing [ChartLabel.Render], which will
// handle construction of [helmette.Dot], subcharting, and output filtering.
func render(dot *helmette.Dot) []kube.Object {
manifests := []kube.Object{
ServiceAccount(dot),
Secret(dot),
ConfigMap(dot),
Service(dot),
Ingress(dot),
Deployment(dot),
HorizontalPodAutoscaler(dot),
}
// NB: This slice may contain nil interfaces!
// Filtering happens elsewhere, don't call this function directly if you
// can avoid it.
return manifests
}