-
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
Move helm charts git history #289
Conversation
This commit adds support for the `lookup` function from helm. It does so by injecting a Kubernetes API client into the `helmette.Dot` struct to avoid relying on global variables. This is a divergence from helm itself but is thoroughly documented as such. Unlike helm's `lookup`, gotohelm returns `nil, false` in the case of not found errors rather than an empty dictionary.
This commit moves all `lookup` calls into gocode and relies on gotohelm's more clear return values to prevent nil pointer exceptions from occurring. Fixes #1277
This commit bumps the redpanda chart version to `v5.8.6`.
Current go template does not support for statement iteration. To work around the range loop using `until` buildin function. As the `until` counts from 0, the `for` loop needs to have integer iterator that starts from 0.
To correctly handle negative numbers that are parsed as `ast.UnaryExpr` the transplier will past `Literal`.
To handle Redpanda configuration in go code the `first` function needs to be included to helmette as part of the sprig definition. Negative numbers are recognized as `ast.UnaryExpr` with sub token. Now they can be transpiled. P.S. The `[]byte` array can be represented only in Go, but not in template.
Go template supports great or equal and less or equal with different name 'ge' and 'le' respectively. Reference * https://pkg.go.dev/text/template * https://github.com/golang/go/blob/62711d61e5ba3a6c42bc57a28c2402dd8669261f/src/text/template/doc.go#L380-L394 * https://github.com/golang/go/blob/62711d61e5ba3a6c42bc57a28c2402dd8669261f/src/text/template/funcs.go#L55-L61
Prior to this commit, there were no test cases that exercised any of the redpanda version check helpers that are littered throughout the chart. Given a handful of difficulties with the first attempt of migrating said helpers to go, this commit adds in a matrix of regression tests to ensure that the conversion either preserves existing behavior or fixes any latent bugs.
`toString` function is required for Redpanda configuration conversion. Reference https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_configmap.tpl#L380 https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_configmap.tpl#L382
Min function is required for config map conversion. Reference https://github.com/redpanda-data/helm-charts/blob/eb68e97b05d62911ab179d3ad88a4703cb80084b/charts/redpanda/templates/_configmap.tpl#L76
`trimSuffix` function is required for Redpanda configuration conversion. Reference https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_helpers.tpl#L169
In commit 666e0cb, a typo was accidentally introduced that broke the connectors integration of the redpanda chart. This issue went unnoticed until discovered by an end user due to a lack of any test case that specified `connectors.enabled=true`. This commit corrects the typo and adds a minimal regression test. A manual check was also performed to ensure that the behavior of `connectors.enabled=true` is the same prior to `666e0cbf4775d7a814b48cf29bcd66815de46041` Fixes #1321
Previously, gotohelm could panic or generate in valid templates in certain cases when encountering assignment to embedded fields in either the shorted or elongated form as the selector tranpilation case did not correctly handle embedding. This commit update `getFields` to instead returned a flattened list of all fields, including ones inherited from embedded structs. It also updates the `Selector` AST to elide itself if it is accessing an embedded field. As a side effect, this has removed the need to generate nested groups of `mustMergeOverwrite` when calculating the zero values of structs with embedded fields.
This commit converts the servicemonitor.yaml template to a golang equivalent. Notably, the default value for `monitoring.tlsConfig` has changed to `null` to make the gocode more ergonomic.
Previously, gotohelm required special casing for functions that returned `(T, error)` as helm/sprig functions have no notion of returning errors. This commit adds automatic detection for such cases. Any function annotated with `+gotohelm:builtin=` that returns `(T, error)` will automatically be wrapped with `list nil` to simulate a successful return.
Prior to this commit, the semver regression test suite was accidentally performing tests soley against v24.1.0 due taking the address of a loop variable. This commit appropriately "captures" the `version` variable and adds in support for asserting on failures of `helm template. See also https://go.dev/blog/loopvar-preview
This commit converts the collection of redpanda version gate functions from helm to go.
Without this, it ends up on the same depth as `matchLabels:` in my testing: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: topologyKey: kubernetes.io/hostname labelSelector: matchLabels: app.kubernetes.io/component: redpanda-statefulset app.kubernetes.io/instance: redpanda app.kubernetes.io/name: redpanda
This commit migrates `common-volumes`, `default-volumes`, `default-mounts`, and `common-mounts` to go.
Prior to this commit, the redpanda helm chart would almost always generate `Certificates`, even if they we're not being used. This can be frustrating for users that are not using cert-manager or want to manage the integration themselves. This commit makes it easier to disable most of the certificates that the chart generates by fixing a mistranslated boolean check, respecting the `enabled` field on elements of `tls.certs`, and providing a few example test cases.
The `toYaml` function is not part of the sprig library, but helm provides it. The `toYaml` is required for Redpanda configuration conversion to go. Referance https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_configmap.tpl#L69 https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_configmap.tpl#L79 https://github.com/redpanda-data/helm-charts/blob/d3349c8191779c31e98348689c2465d69ea2c33d/charts/redpanda/templates/_configmap.tpl#L157 helm function definition https://github.com/helm/helm/blob/e90b456d655e78d7c72a32a52a9b70bc1984c33f/pkg/engine/funcs.go#L49-L68
Based on broker configuration template https://docs.redpanda.com/23.3/reference/node-configuration-sample/ the `cluster-id` and `organization` was defined at the top level. It should be defined under `redpanda` part of the `redpanda.yaml`. Based on redpanda-data/redpanda#9713 `organization` is being removed from the cluster configuration.
Floating point constants in go, when possible, are represented as division of rational numbers. For example, 0.1 would be represented as 1/10. This syntax is passed directly to helm which does not support such division. This commit handles floating point constants and forcibly represents them as decimals in all cases. Refresh of gotohelm-float-consts
Prior to this commit, writing gotohelm code need to be very tactical when dealing with numeric values. This lead to type casts being littered around the codebase and likely a handful of unnoticed bugs. This commit upgrades the transpiler to inject type casts into transpiled code at function boundaries and struct field references. While this solution is not perfect, it should dramatically reduce needless type casting and make code slightly more idiomatic.
This commit adds the `AsNumeric` and `AsIntegral` helper functions to the `helmette` package to aid working with numeric values in gotohelm code. A future commit will disallow type assertions and type checks of numeric values in favor of these helpers as they are the closest approximation to keeping helm and go behavior the same.
Prior to this commit is was value to use type checks or assertions within gotohelm code with numeric values. For example: `x.(int)`. Due to the numerous limitations of go templates and helm, it's not feasible to fully support such expressions as there's no type information that could be used to distinguish between ints, int64s, and float64s. This commit causes the transpiler to fail if it encounters such a statement and instead points users to the recently added `AsNumeric` and `AsIntegral` functions.
Instance methods are transpiled into templates that receives as a first argument the instance of the struct. Any function call that have pointer receiver would be translated to template `include` statement with one argument which is struct itself. There is special case for Values.AsMap method as it is not defined as seperated template, but rather it is build in feature of the helm engine. In future improvements instance methods transpilation could support arguments.
Prior to this commit the operator chart's declared permissions had grown out of sync with those declared by the operator itself. This commit re-synchronizes the permissions, adds in regression tests to prevent such drift from happening again, and releases the updated chart. Co-authored-by: Rafal Korepta <[email protected]>
Prior to this commit gotohelm did not support first class functions. This made certain operations tedious to implement as cases would have to be manually copied. This commit adds support for passing functions as arguments and invoking said functions. Closures themselves are not supported.
Prior to this commit the `podTemplate` value only permitted overriding a few special cased fields. This commit makes the implementation generic enough to allow: - Adding additional containers - Adding additional init containers - Adding additional environment variables to _any_ container - overriding any value on podSpec. In particular, this commit is aimed at allowing users to specify `priority` or `priorityClassName` on the redpanda statefulset to prevent undesired evictions. K8S-423
9c9f73a
to
c2e2381
Compare
c2e2381
to
b87729c
Compare
Just signed the CLA, btw what would be the experience moving forward for installing helm charts? Would it be hosted on the same Helm repo just the code will be place now in a single mono-repo? Also should we rename this repo or keep as redpanda-operator? |
I'm open for any suggestion.
It's described in our internal RFC where:
It would be hosted in helm-chart repo. Just redpanda, console, connectors and operator helm chart will have the same version from the git tag created in this redpanda-operator repo. |
Rebase failed
Due to issues with Github after force push new PR was opened #338 |
From https://github.com/redpanda-data/helm-charts the following directories was copied:
charts/
redpanda/
operator/
console/
connectors/
pkg/
cmd/
There is rewrite
cmd/genschema
,cmd/genpartial
andcmd/gotohelm
as all programs inredpanda-operator
are anchored in the root.Commands
As our CI checks if go lang files have BSL license header one additional commit was added to this PR.
Reference
https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html
https://dev.to/art_ptushkin/how-to-migrate-a-directory-from-git-repository-to-another-one-preserving-git-history-bitbucket-example-15m5
K8S-443