Skip to content

Commit

Permalink
v2: bump chart to v5.9.15 to support full podtemplate overrides
Browse files Browse the repository at this point in the history
Prior to this commit the `podTemplate` field of the redpanda operator had
drifted out of sync with that of the helm chart. This prevented users from
leveraging the new pod template overrides recently added.

This commit bumps the internal chart version to v5.9.15 updates the PodTemplate
type to be a PodSpecApplyConfiguration.
  • Loading branch information
chrisseto committed Dec 6, 2024
1 parent feccb09 commit dbe0481
Show file tree
Hide file tree
Showing 14 changed files with 31,093 additions and 10,211 deletions.
5 changes: 5 additions & 0 deletions .licenseupdater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ ignore:
- directory: .task
- directory: dist
- directory: operator/api/applyconfiguration
# Ignore go files installed in testdata as they're not writable.
- directory: pkg/gotohelm/testdata/pkg
# Ignore go files from gotohelm's rewrite tests, they'll have the header but
# after a build directive.
- match: /\.rewritten\.go$/
files:
- name: licenses/boilerplate.go.txt
type: go
Expand Down
2 changes: 1 addition & 1 deletion acceptance/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/cucumber/godog v0.14.1
github.com/go-logr/logr v1.4.2
github.com/redpanda-data/common-go/rpadmin v0.1.9
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2
github.com/redpanda-data/helm-charts v0.0.0-20241203151858-926cfe070c6e
github.com/redpanda-data/redpanda-operator/harpoon v0.0.0-00010101000000-000000000000
github.com/redpanda-data/redpanda-operator/operator v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions acceptance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ github.com/redpanda-data/common-go/rpadmin v0.1.9 h1:X5a95P7Dc+7EaidU7dusWJyiG3e
github.com/redpanda-data/common-go/rpadmin v0.1.9/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20 h1:+zsE3W1V86k2sjAGWOySIlF0xn5R1aXXQBaIdr80F48=
github.com/redpanda-data/console/backend v0.0.0-20240303221210-05d5d9e85f20/go.mod h1:DC42/3+k5PefSo4IalYbDN3yRZrVFP0b69+gC/NwGd4=
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2 h1:OBCxU0Q5vhy3FVuvhw1FWxrx2pyyu5KG2arpCkccDvQ=
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2/go.mod h1:iUkRGjzQhCRKvmYpeExfsN+aslvoahRke6PGPit2xC4=
github.com/redpanda-data/helm-charts v0.0.0-20241203151858-926cfe070c6e h1:UEzwEsi0nuT6qrDyDfpXjCm9DhjY4Cryj9XRPgjzpDs=
github.com/redpanda-data/helm-charts v0.0.0-20241203151858-926cfe070c6e/go.mod h1:maQmSf2TLXRGKLcDeCBO/zD+5/i+8NDNOkS2685/P9A=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240827155712-244863ea0ae8 h1:uTQKqF8UPNxYxKBJ11VlG6Vt2l9ctkkeXsmmjHUSUG4=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240827155712-244863ea0ae8/go.mod h1:97qkjcMI3gDL+y+aY/w5o0xF2qGHFof6rCXIYjnTalM=
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,7 @@ github.com/redpanda-data/helm-charts v0.0.0-20241031235426-99ca96105c9a/go.mod h
github.com/redpanda-data/helm-charts v0.0.0-20241113221319-230a32adcee0/go.mod h1:dmmGZo7DuHNnCy0QOykXN2sY9QI8kbdlkSKgIkCT978=
github.com/redpanda-data/helm-charts v0.0.0-20241121200315-d6d3364e543d h1:Uh/25ztbyKy304h+AJIiATu0oyaw2QXRLRqRHEsiG8o=
github.com/redpanda-data/helm-charts v0.0.0-20241121200315-d6d3364e543d/go.mod h1:iUkRGjzQhCRKvmYpeExfsN+aslvoahRke6PGPit2xC4=
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2/go.mod h1:iUkRGjzQhCRKvmYpeExfsN+aslvoahRke6PGPit2xC4=
github.com/redpanda-data/redpanda/src/go/rpk v0.0.0-20240105044330-c094966ca0cf/go.mod h1:SaSp5/JwdLHu8ZU82wFbXD8/oE4UWB+8ZkjWWreAt7Y=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rhnvrm/simples3 v0.6.1 h1:H0DJwybR6ryQE+Odi9eqkHuzjYAeJgtGcGtuBwOhsH8=
Expand Down
2 changes: 1 addition & 1 deletion harpoon/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/cucumber/godog v0.14.1
github.com/cucumber/messages/go/v21 v21.0.1
github.com/olekukonko/tablewriter v0.0.5
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2
github.com/redpanda-data/helm-charts v0.0.0-20241203151858-926cfe070c6e
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e
k8s.io/api v0.30.3
Expand Down
3 changes: 1 addition & 2 deletions harpoon/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2 h1:OBCxU0Q5vhy3FVuvhw1FWxrx2pyyu5KG2arpCkccDvQ=
github.com/redpanda-data/helm-charts v0.0.0-20241121211850-232b4aaab5b2/go.mod h1:iUkRGjzQhCRKvmYpeExfsN+aslvoahRke6PGPit2xC4=
github.com/redpanda-data/helm-charts v0.0.0-20241203151858-926cfe070c6e h1:UEzwEsi0nuT6qrDyDfpXjCm9DhjY4Cryj9XRPgjzpDs=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
42 changes: 27 additions & 15 deletions operator/api/redpanda/v1alpha2/redpanda_clusterspec_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
package v1alpha2

import (
"encoding/json"

monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
applycorev1 "k8s.io/client-go/applyconfigurations/core/v1"

"github.com/redpanda-data/redpanda-operator/operator/api/apiutil"
)
Expand Down Expand Up @@ -731,25 +734,34 @@ type Statefulset struct {

// PodTemplate will pass label and annotation to Statefulset Pod template.
type PodTemplate struct {
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Spec *PodSpec `json:"spec,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Spec *PodSpecApplyConfiguration `json:"spec,omitempty"`
}

type Container struct {
Name string `json:"name"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
Env []corev1.EnvVar `json:"env"`
// PodSpecApplyConfiguration is a wrapper around
// [applycorev1.PodSpecApplyConfiguration] that adds support for DeepCopying.
type PodSpecApplyConfiguration struct {
*applycorev1.PodSpecApplyConfiguration `json:",inline"`
}

// PodSpec is a subset of [corev1.PodSpec] that will be merged into the objects
// constructed by this helm chart via means of a [strategic merge
// patch](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#use-a-strategic-merge-patch-to-update-a-deployment).
// NOTE: At the time of writing, merging is manually implemented for each
// field. Ideally, a more generally applicable solution should be used.
type PodSpec struct {
Containers []Container `json:"containers,omitempty"`
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
func (ac *PodSpecApplyConfiguration) DeepCopy() *PodSpecApplyConfiguration {
// For some inexplicable reason, apply configs don't have deepcopy
// generated for them.
//
// DeepCopyInto can be generated with just DeepCopy implemented. Sadly, the
// easiest way to implement DeepCopy is to run this type through JSON. It's
// highly unlikely that we'll hit a panic but it is possible to do so with
// invalid values for resource.Quantity and the like.
out := new(PodSpecApplyConfiguration)
data, err := json.Marshal(ac)
if err != nil {
panic(err)
}
if err := json.Unmarshal(data, out); err != nil {
panic(err)
}
return out
}

// Budget configures the management of disruptions affecting the Pods in the StatefulSet.
Expand Down
2 changes: 1 addition & 1 deletion operator/api/redpanda/v1alpha2/redpanda_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ChartRef struct {
// UseFlux flag set to `false` will prevent helm controller from reconciling helm chart. The operator would be
// tight with `go` based Redpanda helm chart version. The rest of the ChartRef fields would be ignored.
//
// Before setting UseFlux flag to `false` please alight your ChartVersion to at least `5.9.11`
// Before setting UseFlux flag to `false` please align your ChartVersion to `5.9.15` or ``
// version of the Redpanda chart.
//
// RedpandaStatus might not be accurate if flag is set to `false` and HelmRelease is manually deleted.
Expand Down
22 changes: 15 additions & 7 deletions operator/api/redpanda/v1alpha2/redpanda_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ var (
SuccessThreshold: rapid.Int32Min(1).Draw(t, "SuccessThreshold"),
}
})

Time = rapid.Custom(func(t *rapid.T) metav1.Time {
// As metav1.Time will unmarshal 0 into "null", we need to ensure that
// we never generate a 0 time here otherwise JSON serialization will be
// non-idempotent and break out tests.
nsec := rapid.Int64Min(1).Draw(t, "Time")
return metav1.Time{Time: time.Unix(0, nsec)}
})
)

func TestDefluxedMinimumVersion(t *testing.T) {
Expand Down Expand Up @@ -133,13 +141,13 @@ func TestRedpanda_ValuesJSON(t *testing.T) {
func TestHelmValuesCompat(t *testing.T) {
cfg := rapid.MakeConfig{
Types: map[reflect.Type]*rapid.Generator[any]{
reflect.TypeFor[intstr.IntOrString](): IntOrString.AsAny(),
reflect.TypeFor[*resource.Quantity](): Quantity.AsAny(),
reflect.TypeFor[metav1.Duration](): Duration.AsAny(),
reflect.TypeFor[*redpanda.PartialPodSpec](): rapid.Just[any](nil), // PodSpec's serialization intentionally diverges from PartialPodSpec's so we can leverage builtin types and their validation.
reflect.TypeFor[any](): rapid.Just[any](nil), // Return nil for all untyped (any, interface{}) fields.
reflect.TypeFor[*metav1.FieldsV1](): rapid.Just[any](nil), // Return nil for K8s accounting fields.
reflect.TypeFor[corev1.Probe](): Probe.AsAny(), // We use the Probe type to simplify typing but it's serialization isn't fully "partial" which is acceptable.
reflect.TypeFor[intstr.IntOrString](): IntOrString.AsAny(),
reflect.TypeFor[*resource.Quantity](): Quantity.AsAny(),
reflect.TypeFor[metav1.Duration](): Duration.AsAny(),
reflect.TypeFor[metav1.Time](): Time.AsAny(),
reflect.TypeFor[any](): rapid.Just[any](nil), // Return nil for all untyped (any, interface{}) fields.
reflect.TypeFor[*metav1.FieldsV1](): rapid.Just[any](nil), // Return nil for K8s accounting fields.
reflect.TypeFor[corev1.Probe](): Probe.AsAny(), // We use the Probe type to simplify typing but it's serialization isn't fully "partial" which is acceptable.
},
Fields: map[reflect.Type]map[string]*rapid.Generator[any]{
reflect.TypeFor[redpanda.PartialValues](): {
Expand Down
57 changes: 4 additions & 53 deletions operator/api/redpanda/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dbe0481

Please sign in to comment.