Skip to content
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

Open
wants to merge 1,532 commits into
base: main
Choose a base branch
from
Open

Conversation

RafalKorepta
Copy link
Contributor

@RafalKorepta RafalKorepta commented Nov 8, 2024

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 and cmd/gotohelm as all programs in redpanda-operator are anchored in the root.

Commands

# In helm-charts-clone

git filter-repo --path charts/redpanda --path charts/operator --path charts/console --path charts/connectors --path cmd --path-rename cmd/genpartial/:genpartial/ --path-rename cmd/genschema/:genschema/ --path-rename cmd/gotohelm/:gotohelm/ --path pkg

# In redpanda-operator repo clone

git remote add helm-charts-clone ../helm-charts-clone
git pull helm-repo main --allow-unrelated-histories --no-ff --no-rebase

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

JakeSCahill and others added 30 commits November 8, 2024 03:13
It was recently discovered that `rpk cluster health --watch
--exit-when-healthy` can exit non-zero in cases where trying to dial a
broker fails. This causes a cascading error as it results in a sidecar
of redpanda to then crash and bring down the pod.

To mitigate, this commit wraps the `rpk cluster health --watch
--exit-when-healthy` line of the the config-watcher's `sasl-user.sh`
script in a back off loop.
As new version 24.1.1 of Redpanda is released this commit bumps helm
chart version and appVersion.

Reference

https://github.com/redpanda-data/redpanda/releases/tag/v24.1.1
What's Changed
* Remove cluster to redpanda migration tool by @RafalKorepta in #120
* Control pod deletion behaviour via annotation by @koikonom in #112
* Add Tiered Storage config options for Azure by @JakeSCahill in #127

New Contributors
* @koikonom made their first contribution in #112

**Full Changelog**: v2.1.17-23.3.11...v2.1.18-23.3.13
This commit migrates the `pod-security-context` and
`container-security-context` helpers from helm to go.

There's a very mild and intentional change in the behavior:
`statefulset.podSecurityContext` will not longer be merged with
`statefulset.securityContext`, it will be taken in place of it.
The Kubernetes go SDK doesn't provide any convent way to marshal
objects to or from YAML, especially multi-document YAML. This commit
implements the `EncodeYAML`, `EncodeYAMLInto`, `DecodeYAML`, and
`DecodeYAMLFrom` function in the `kube` package for ease of marshalling
typed objects to and from YAML.
A previous commit modified the behavior of how redpanda Pods' labels are
computed to prevent unintentional breakages of the StatefulSet's label
selector. This change accidentally removed `commonLabels` from being
specified on redpanda Pods entirely.

This commit adds common labels back to redpanda Pods without injecting
them into the StatefulSet's label selector.

It additionally adds a regression test that asserts that all objects
output by this chart have common labels included within their labels.
A previous commit intended to perform a release but was on an outdated
version of `main` and accidentally bumped the version to what main was
already at.

This commit bumps the redpanda version to 5.8.4 to appropriately release
73d01d5c9db04480b26e5b55fa700f859751316a.
This commit converts the certs.yaml helm template into equivalent go
code and adds the appropriate bridge to render the output as a
multi-document YAML file.

Fixes #1111
Previously there was a typo in the fsValidator configuration that would
result in a nil pointer exception if one attempted to specify any
resources for the fsValidator.

This commit corrects the typo and updates a test to correctly exercise
the previously bugged path.
This commit bumps all nix dependencies via `nix flake update`. The primary aim
here is to bump our go version to 1.22 in order to support installing
`setup-envtest` and Kubernetes 1.30.

See kubernetes-sigs/controller-runtime@4c2442e
Recent exploration into the performance of `helm template` has shown that that
VAST majority of execution time is due to calls to `deepCopy`. 50% is executing
deepCopy itself and the other 50% is go's GC attempting to keep up with the
massive allocations and cleanups.

Upon auditing our charts, it became apparent that most usages of `deepCopy` are
not required with many instances not being used at all.

This commit removes all usages of `deepCopy` across all charts in this
repository.
This commit bumps the operator chart to operator version
[`v2.1.20-24.1.2`](https://github.com/redpanda-data/redpanda-operator/releases/tag/v2.1.20-24.1.2)
and bumps the operator helm chart version.
This commit adds the `kubetest` subpackage to the `kube` package. It contains a
small set of helpers for setuping up kubernetes' `envtest.Environment`.
Previously, there only existed tests for `advertisedPorts` with exactly one
element.
This commit adds a test case for configuring listeners with `advertisedPorts`
equal in length to the number of STS replicas to show case the expected
behavior.
This commit adds support for the modulus or rem operator.
Previously, gotohelm ran "helm" tests via an inline template runner. This
muddled what code was performing test assertions and what code was attempting
to execute the transpiled templates in a helm-like fashion.

This commit extracts the template execution out into it a runner struct similar
to the go runner struct. In the future, we may want to provide direct access to
the go runner and helm runner structs to allow transpiled charts to easily test
either the gocode path and helm path.
This commit modifies helm.Client.Template to run via depending on Helm as a
library rather than run through a subprocess. This provides a greater degree of
control over the helm execution environment but also reduces the overhead of
running `helm template` many times.

Note: The actual performance gain of this commit hasn't truly been measured.
The bulk of the time was wasted in `deepCopy` calls, this commit was required
to appropriately profile the execution of `helm template`.
Previously, the `image.repository` field had a weak regex associated with it to
prevent invalid values from being passed to Kubernetes. This accidentally
prevented users from leveraging repositories that contained a specified port
due to the `:` character.

Rather than extending the regex or replacing it with an appropriate URL regex,
this commit opts to remove the validation entirely. This string is never parsed
internally within the chart and Kubernetes itself will provide appropriate
error messages if required.

Fixes #1292
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.
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.
andrewstucki and others added 25 commits November 8, 2024 03:13
The Console partial values are used for pragmatic reasons as genpartial does
not convert console.Values to console.PartialValues inside Redpanda Values
partial generation. In both structs the type is the same. Unit tests that
marshals Redpanda partial values into file does not work as expected. The
console part of the marshalled values have multiple empty strings or nulls.
It is caused by the fact omitempty is not always set in Console.Values. In
normal template evaluation those nulls and empty strings would be replaced by
default values from values.yaml file. To unblock operator integration
Console.PartialValues is used, until genpartail is smart enough.
Prior to this commit, `--configurator-tag` would render as `%s(nil)` due
checking for emptiness on the wrong value.

This commit corrects the check to be on `values.Configurator.Tag`.
Prior to this commit the memory limits of the `bootstrap-yaml-envsubst`
container were set to 25Mi. This value was accidentally lower than the total
size of the binary itself, 80Mi, which seemingly surfaced as unexplained hangs
when _initially_ run on aarch64 (specifically using obstack).

This commit bumps the limit to 125Mi to ensure adequate headroom which seems to
mitigate such hangs. The exact mechanisms at play here at not well known.

Fixes #1564
… (#1567)

This adds the `--users-directory` command line flag needed to leverage #265
The connectors deployment replication was set to 0. The connectors was not
tested. With this change Redpanda chart will generate connectors configuration
and connectors deployment will be deployed.
Prior to this commit the `MustParseDuration` would transpile to nothing. Any
string given to it would be passed through unchanged as the API server would
handle validation.

This is not acceptable as the go's `time.Duration` always adds includes minutes
and second in the stringified form. So `1h` would be rendered as `1h0m0s`. The
kube-apiserver accepts this as a valid duration but does not update it's form.
This can cause `.Generation` to be incremented when toggling between helm and
go as `0m0s` is added and removed from the apiserver.

This commit implements `time.ParseDuration` in gotohelm (with limitations) and
updates the transpilation of `MustParseDuration` to properly re-serialize the
provided duration.
This commit adds a `Types` function to the redpanda chart that returns a slice
of all possible `kube.Object/runtime.Object/client.Object` implementations that
could be returned from various inputs of the redpanda chart.

This function will be utilized by the redpanda operator to aid in garbage
collecting objects that have been removed across chart invocations. For
example, toggling console on and off will result in a Deployment that needs to
be removed.
Prior to this commit `firstUser` incorrectly required lines of `users.txt` to
explicitly specify their SCRAM mechanism. The `config-watcher` side car,
however, permits entries to omit the mechanism and will infer a default of
`SCRAM-SHA-512`.

Said issue surfaced in a CI test failure from the kuttl test
`upgrade-values-check`, which generated the following for `users.txt`:

```yaml
superuser:secretpassword
```

This commit corrects the `firstUser` function's parsing.
External.Domain could be defined as go lang template. In all places domain is passed
to tpl function to correctly render the value.

In Service type LoadBalancer the external addresses should be handled the same way as
in ConfigMap. Every service should have annotation that starts with external address even
if only single one is provided.
@CLAassistant
Copy link

CLAassistant commented Nov 8, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
4 out of 6 committers have signed the CLA.

✅ RafalKorepta
✅ andrewstucki
✅ chrisseto
✅ JakeSCahill
❌ david-yu
❌ ooesili
You have signed the CLA already but the status is still pending? Let us recheck it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
4 out of 6 committers have signed the CLA.

✅ RafalKorepta
✅ JakeSCahill
✅ chrisseto
✅ andrewstucki
❌ david-yu
❌ ooesili
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.