Skip to content

Commit

Permalink
redpanda: replace bash jobs with go utilities
Browse files Browse the repository at this point in the history
This commit removes the bash scripts that used to power the post_upgrade and
post_install_upgrade job with the recently implement `sync-cluster-config` sub
command of the redpanda operator.

`bootstrap.yaml` will now be correctly populated with secret values
from cluster inception. bootstrap will contain place holder values in the form
of `$REDPANDA_PROPERTY_NAME` which are filled out by the envsubst init
container.

The post_upgrade job has been removed as the post_install_upgrade job performed
the majority of it's behavior sans setting cloud storage secrets which it now
does thanks to the aforementioned bootstrap yaml envsubst'ing.
  • Loading branch information
chrisseto committed Oct 8, 2024
1 parent cbe9c28 commit b527f59
Show file tree
Hide file tree
Showing 26 changed files with 7,198 additions and 11,253 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#### Changed
#### Fixed
#### Removed
* `post_upgrade_job.*`, and the post-upgrade job itself, has been removed. All
it's functionality has been consolidated into the `post_install_job`, which
actually runs on both post-install and post-upgrade.

The consolidated job now runs the redpanda-operator image, which may be
controlled the same way as the additional controllers:
`statefulset.controllers.{image,repository}`.

### [5.9.5](https://github.com/redpanda-data/helm-charts/releases/tag/redpanda-5.9.5) - 2024-09-26
#### Added
Expand Down
32 changes: 1 addition & 31 deletions charts/redpanda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,36 +571,6 @@ A subset of Kubernetes' PodSpec type that will be merged into the final PodSpec.
{"containers":[{"env":[],"name":"post-install","securityContext":{}}],"securityContext":{}}
```

### [post_upgrade_job.affinity](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=post_upgrade_job.affinity)

**Default:** `{}`

### [post_upgrade_job.enabled](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=post_upgrade_job.enabled)

**Default:** `true`

### [post_upgrade_job.podTemplate.annotations](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=post_upgrade_job.podTemplate.annotations)

Additional annotations to apply to the Pods of this Job.

**Default:** `{}`

### [post_upgrade_job.podTemplate.labels](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=post_upgrade_job.podTemplate.labels)

Additional labels to apply to the Pods of this Job.

**Default:** `{}`

### [post_upgrade_job.podTemplate.spec](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=post_upgrade_job.podTemplate.spec)

A subset of Kubernetes' PodSpec type that will be merged into the final PodSpec. See [Merge Semantics](#merging-semantics) for details.

**Default:**

```
{"containers":[{"env":[],"name":"post-upgrade","securityContext":{}}],"securityContext":{}}
```

### [rackAwareness](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=rackAwareness)

Rack Awareness settings. For details, see the [Rack Awareness documentation](https://docs.redpanda.com/docs/manage/kubernetes/kubernetes-rack-awareness/).
Expand Down Expand Up @@ -985,7 +955,7 @@ To create `Guaranteed` Pods for Redpanda brokers, provide both requests and limi

### [statefulset.sideCars.controllers.image.tag](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=statefulset.sideCars.controllers.image.tag)

**Default:** `"v2.1.10-23.2.18"`
**Default:** `"v2.2.4-24.2.5"`

### [statefulset.sideCars.controllers.metricsAddress](https://artifacthub.io/packages/helm/redpanda-data/redpanda?modal=values&path=statefulset.sideCars.controllers.metricsAddress)

Expand Down
1 change: 0 additions & 1 deletion charts/redpanda/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func render(dot *helmette.Dot) []kube.Object {
SidecarControllersRole(dot),
SidecarControllersRoleBinding(dot),
StatefulSet(dot),
PostUpgrade(dot),
PostInstallUpgradeJob(dot),
}

Expand Down
27 changes: 26 additions & 1 deletion charts/redpanda/configmap.tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ func RedpandaConfigMap(dot *helmette.Dot) *corev1.ConfigMap {
}
}

// BootstrapFile returns contents of `.bootstrap.yaml`. Keys that may be set
// via environment variables (such as tiered storage secrets) will have
// placeholders in the form of $ENVVARNAME. An init container is responsible
// for expanding said placeholders.
//
// Convention is to name envvars
// $REDPANDA_SCREAMING_CASE_CLUSTER_PROPERTY_NAME. For example,
// cloud_storage_secret_key would be $REDPANDA_CLOUD_STORAGE_SECRET_KEY.
//
// `.bootstrap.yaml` is templated and then read by both the redpanda container
// and the post install/upgrade job.
func BootstrapFile(dot *helmette.Dot) string {
values := helmette.Unwrap[Values](dot.Values)

Expand All @@ -63,7 +74,21 @@ func BootstrapFile(dot *helmette.Dot) string {
bootstrap = helmette.Merge(bootstrap, values.Config.Tunable.Translate())
bootstrap = helmette.Merge(bootstrap, values.Config.Cluster.Translate())
bootstrap = helmette.Merge(bootstrap, values.Auth.Translate(values.Auth.IsSASLEnabled()))
bootstrap = helmette.Merge(bootstrap, values.Storage.Translate())
bootstrap = helmette.Merge(bootstrap, values.Storage.GetTieredStorageConfig().Translate(&values.Storage.Tiered.CredentialsSecretRef))

// If default_topic_replications is not set and we have at least 3 Brokers,
// upgrade from redpanda's default of 1 to 3 so, when possible, topics are
// HA by default.
// See also:
// - https://github.com/redpanda-data/helm-charts/issues/583
// - https://github.com/redpanda-data/helm-charts/issues/1501
if _, ok := values.Config.Cluster["default_topic_replications"]; !ok && values.Statefulset.Replicas >= 3 {
bootstrap["default_topic_replications"] = 3
}

if _, ok := values.Config.Cluster["storage_min_free_bytes"]; !ok {
bootstrap["storage_min_free_bytes"] = values.Storage.StorageMinFreeBytes()
}

return helmette.ToYaml(bootstrap)
}
Expand Down
4 changes: 2 additions & 2 deletions charts/redpanda/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func ClientAuthRequired(dot *helmette.Dot) bool {
func DefaultMounts(dot *helmette.Dot) []corev1.VolumeMount {
return append([]corev1.VolumeMount{
{
Name: "config",
Name: "base-config",
MountPath: "/etc/redpanda",
},
}, CommonMounts(dot)...)
Expand Down Expand Up @@ -239,7 +239,7 @@ func CommonMounts(dot *helmette.Dot) []corev1.VolumeMount {
func DefaultVolumes(dot *helmette.Dot) []corev1.Volume {
return append([]corev1.Volume{
{
Name: "config",
Name: "base-config",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Expand Down
Loading

0 comments on commit b527f59

Please sign in to comment.