-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helm nightly release #345
base: main
Are you sure you want to change the base?
Helm nightly release #345
Changes from all commits
8dc66a6
cb007c7
b753eb3
acaca66
5f19af1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ kubeVersion: ">= 1.25.0-0" | |
|
||
icon: https://images.ctfassets.net/paqvtpyf8rwu/3cYHw5UzhXCbKuR24GDFGO/73fb682e6157d11c10d5b2b5da1d5af0/skate-stand-panda.svg | ||
sources: | ||
- https://github.com/redpanda-data/helm-charts | ||
- https://github.com/redpanda-data/redpanda-operator/charts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These links don't resolve as they need the ref set. https://github.com/redpanda-data/redpanda-operator/tree/main/charts Should we go ahead and link to the specific folder or the chart as well? e.g. https://github.com/redpanda-data/redpanda-operator/tree/main/charts/console |
||
annotations: | ||
artifacthub.io/license: Apache-2.0 | ||
artifacthub.io/links: | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,11 @@ import ( | |
|
||
certmanagerv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1" | ||
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" | ||
"github.com/redpanda-data/redpanda-operator/pkg/gotohelm" | ||
"github.com/redpanda-data/redpanda-operator/pkg/gotohelm/helmette" | ||
"github.com/redpanda-data/redpanda-operator/pkg/helm" | ||
"github.com/redpanda-data/redpanda-operator/pkg/kube" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/client-go/kubernetes/scheme" | ||
"sigs.k8s.io/yaml" | ||
) | ||
|
||
var ( | ||
|
@@ -34,53 +33,59 @@ var ( | |
//go:embed values.yaml | ||
defaultValuesYAML []byte | ||
|
||
chartMeta helmette.Chart | ||
// Chart is the go version of the operator helm chart. | ||
Chart = gotohelm.MustLoad(chartYAML, defaultValuesYAML, render) | ||
) | ||
|
||
func init() { | ||
must(scheme.AddToScheme(Scheme)) | ||
must(certmanagerv1.AddToScheme(Scheme)) | ||
must(monitoringv1.AddToScheme(Scheme)) | ||
} | ||
|
||
// NB: We can't directly unmarshal into a helmette.Chart as adding json | ||
// tags to it breaks gotohelm. | ||
var chart map[string]any | ||
must(yaml.Unmarshal(chartYAML, &chart)) | ||
|
||
chartMeta = helmette.Chart{ | ||
Name: chart["name"].(string), | ||
Version: chart["version"].(string), | ||
AppVersion: chart["appVersion"].(string), | ||
func must(err error) { | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// ChartMeta returns a parsed version of redpanda's Chart.yaml. | ||
func ChartMeta() helmette.Chart { | ||
return chartMeta | ||
} | ||
// render is the entrypoint to both the go and helm versions of the redpanda | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to not merge changes to the charts until we have CI running generation and unit tests for them. It's too easy for something to accidentally slip in and not get caught until MUCH later. |
||
// 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 [Chart.Render], which will | ||
// handle construction of [helmette.Dot], subcharting, and output filtering. | ||
func render(dot *helmette.Dot) []kube.Object { | ||
manifests := []kube.Object{ | ||
Certificate(dot), | ||
ConfigMap(dot), | ||
Deployment(dot), | ||
WebhookService(dot), | ||
MetricsService(dot), | ||
ServiceAccount(dot), | ||
ServiceMonitor(dot), | ||
} | ||
|
||
func Dot(release helmette.Release, values PartialValues, kubeConfig kube.Config) (*helmette.Dot, error) { | ||
valuesYaml, err := yaml.Marshal(values) | ||
if err != nil { | ||
return nil, err | ||
// NB: gotohelm doesn't currently have a way to handle casting from | ||
// []Instance -> []Interface as doing so generally requires some go | ||
// helpers. | ||
// Instead, it's easiest (though painful to read and write) to iterate over | ||
// all functions that return slices and append them one at a time. | ||
for _, obj := range ClusterRole(dot) { | ||
manifests = append(manifests, obj) | ||
} | ||
|
||
// NB: err1 is working around an issue in gotohelm's ASTs rewrites | ||
merged, err1 := helm.MergeYAMLValues("", defaultValuesYAML, valuesYaml) | ||
if err1 != nil { | ||
return nil, err1 | ||
for _, obj := range ClusterRoleBindings(dot) { | ||
manifests = append(manifests, obj) | ||
} | ||
|
||
return &helmette.Dot{ | ||
Values: merged, | ||
Chart: ChartMeta(), | ||
Release: release, | ||
KubeConfig: kubeConfig, | ||
}, nil | ||
} | ||
for _, obj := range Roles(dot) { | ||
manifests = append(manifests, obj) | ||
} | ||
|
||
func must(err error) { | ||
if err != nil { | ||
panic(err) | ||
for _, obj := range RoleBindings(dot) { | ||
manifests = append(manifests, obj) | ||
} | ||
|
||
return manifests | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we determine that we need
Chart.lock
to be checked in? https://github.com/redpanda-data/helm-charts/blob/main/charts/redpanda/Chart.lockThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I'm going back and fourth with this. Our tests in redpanda repo requires Chart.lock to have stable input. I didn't want operator helm chart lock as I feel like it's not required. Never the less if .helmignore will exclude Chart.lock I can commit
Chart.lock
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't currently have
Chart.lock
in our.helmignore
either. That also caused problems.