Skip to content

Commit 483be93

Browse files
chrissetoRafalKorepta
authored andcommitted
charts/redpanda: use new sidecar --selector flag
This commit builds upon a previous commit that added the `--selector` flag to the sidecar. It updates the chart to appropriate set this new flag and adds acceptance tests to assert the functionality works as expected. This commit is separate as the v2.x.x branches need to release the updated sidecar before it can be used. (cherry picked from commit 13aeda8)
1 parent cc128b4 commit 483be93

37 files changed

+5470
-303
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project: charts/redpanda
2+
kind: Deprecated
3+
body: '- `statefulset.sideCars.controllers.createRBAC` is deprecated and no longer respected. In most cases, setting this field to `false` would result in a broken deployment. RBAC may be controlled via `rbac.enabled` or per controller via `statefulset.sideCars.controllers.{pvcUnbinder,brokerDecommissioner}.enabled`.'
4+
time: 2025-10-21T14:38:34.206376-04:00
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project: charts/redpanda
2+
kind: Deprecated
3+
body: '`statefulset.sideCars.controllers.run` has been unused for many releases and is now deprecated. Individual controllers may be enabled/disabled by setting their enabled field: `statefulset.sideCars.pvcUnbinder.enabled`, `statefulset.sideCars.brokerDecommissioner.enabled`.'
4+
time: 2025-10-21T14:44:13.331483-04:00

Taskfile.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ tasks:
187187
- task: build:image
188188
vars:
189189
CLI_ARGS: '' # Don't forward CLI args to build:image
190+
- task: build:charts
190191
vars:
191192
RUN: '{{ default `"^TestIntegration"` .RUN }}'
192193
cmds:
@@ -204,6 +205,7 @@ tasks:
204205
- task: build:charts
205206
vars:
206207
CLI_ARGS: '' # Don't forward CLI args to build:image
208+
- task: build:charts
207209
vars:
208210
RUN: '{{ default `"^TestAcceptance"` .RUN }}'
209211
GO_TEST_RUNNER: '{{default "go test" .GO_TEST_RUNNER}}'
@@ -215,7 +217,7 @@ tasks:
215217
# Minor speed up only building the acceptance package, which (surprise
216218
# surprise) is the only package with acceptance tests.
217219
PKG: ./acceptance/
218-
CLI_ARGS: '{{.CLI_ARGS}} -run {{.RUN}} -timeout 35m -tags acceptance'
220+
CLI_ARGS: '{{.CLI_ARGS}} -run {{.RUN}} -timeout 55m -tags acceptance'
219221

220222
test:pull-images:
221223
vars:

acceptance/features/decommissioning.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Feature: Decommissioning brokers
88
When I physically shutdown a kubernetes node for cluster "decommissioning"
99
And cluster "decommissioning" is unhealthy
1010
And cluster "decommissioning" has only 2 remaining nodes
11-
And I prune any kubernetes node that is now in a NotReady status
11+
And I prune kubernetes node that was removed in previous step
1212
Then cluster "decommissioning" should recover
1313
And cluster "decommissioning" should be stable with 3 nodes
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@operator:none
2+
Feature: Redpanda Helm Chart
3+
4+
Scenario: Tolerating Node Failure
5+
Given I helm install "redpanda" "../charts/redpanda" with values:
6+
```yaml
7+
nameOverride: foobar
8+
fullnameOverride: bazquux
9+
10+
statefulset:
11+
sideCars:
12+
image:
13+
tag: dev
14+
repository: localhost/redpanda-operator
15+
pvcUnbinder:
16+
enabled: true
17+
unbindAfter: 15s
18+
brokerDecommissioner:
19+
enabled: true
20+
decommissionAfter: 15s
21+
```
22+
When I stop the Node running Pod "bazquux-2"
23+
And Pod "bazquux-2" is eventually Pending
24+
Then Pod "bazquux-2" will eventually be Running
25+
And kubectl exec -it "bazquux-0" "rpk redpanda admin brokers list | sed -E 's/\s+/ /gm' | cut -d ' ' -f 1,6" will eventually output:
26+
```
27+
ID MEMBERSHIP
28+
0 active
29+
1 active
30+
3 active
31+
```
32+
And kubectl exec -it "bazquux-0" "rpk redpanda admin brokers list --include-decommissioned | sed -E 's/\s+/ /gm' | cut -d ' ' -f 1,6" will eventually output:
33+
```
34+
ID MEMBERSHIP
35+
0 active
36+
1 active
37+
3 active
38+
2 -
39+
```

acceptance/features/migration.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Feature: Helm chart to Redpanda Operator migration
22

33
@skip:gke @skip:aks @skip:eks
44
Scenario: Migrate from a Helm chart release to a Redpanda custom resource
5-
Given a Helm release named "redpanda-migration-example" of the "redpanda/redpanda" helm chart with the values:
5+
Given I helm install "redpanda-migration-example" "../charts/redpanda" with values:
66
"""
77
# tag::helm-values[]
88
fullnameOverride: name-override
Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,77 @@
11
@operator:none
22
Feature: Upgrading the operator
3+
34
@skip:gke @skip:aks @skip:eks
45
Scenario: Operator upgrade from 2.3.x
5-
Given I install redpanda helm chart version "v2.3.9-24.3.11" with the values:
6+
Given I kubectl kustomize "https://github.com/redpanda-data/redpanda-operator//operator/config/crd?ref=v2.3.9-24.3.11" | kubectl apply -f - --server-side
7+
And I helm install "redpanda-operator" "redpanda/operator" --version v2.3.9-24.3.11 with values:
68
"""
7-
9+
810
"""
911
And I apply Kubernetes manifest:
1012
"""
1113
---
1214
apiVersion: cluster.redpanda.com/v1alpha2
1315
kind: Redpanda
1416
metadata:
15-
name: operator-upgrade
17+
name: operator-upgrade-2-3
1618
spec:
1719
clusterSpec:
1820
statefulset:
1921
replicas: 1
2022
"""
2123
# use just a Ready status check here since that's all the
2224
# old operator supports
23-
And cluster "operator-upgrade" is available
24-
Then I can upgrade to the latest operator with the values:
25+
And cluster "operator-upgrade-2-3" is available
26+
Then I can helm upgrade "redpanda-operator" "../operator/chart" with values:
2527
"""
2628
image:
2729
tag: dev
2830
repository: localhost/redpanda-operator
31+
crds:
32+
enabled: true
33+
experimental: true
2934
"""
3035
# use the new status as this will eventually get set
31-
And cluster "operator-upgrade" should be stable with 1 nodes
36+
And cluster "operator-upgrade-2-3" should be stable with 1 nodes
37+
38+
@skip:gke @skip:aks @skip:eks
39+
Scenario: Operator upgrade from 2.4.x
40+
Given I kubectl kustomize "https://github.com/redpanda-data/redpanda-operator//operator/config/crd?ref=operator/v2.4.5" | kubectl apply -f - --server-side
41+
And I can helm install "redpanda-operator" "redpanda/operator" --version v2.4.5 with values:
42+
"""
43+
console:
44+
enabled: false
45+
"""
46+
And I apply Kubernetes manifest:
47+
"""
48+
---
49+
apiVersion: cluster.redpanda.com/v1alpha2
50+
kind: Redpanda
51+
metadata:
52+
name: operator-upgrade-2-4
53+
spec:
54+
clusterSpec:
55+
console:
56+
enabled: false
57+
statefulset:
58+
replicas: 1
59+
sideCars:
60+
image:
61+
tag: dev
62+
repository: localhost/redpanda-operator
63+
"""
64+
# use just a Ready status check here since that's all the
65+
# old operator supports
66+
And cluster "operator-upgrade-2-4" is available
67+
Then I can helm upgrade "redpanda-operator" "../operator/chart" with values:
68+
"""
69+
image:
70+
tag: dev
71+
repository: localhost/redpanda-operator
72+
crds:
73+
enabled: true
74+
experimental: true
75+
"""
76+
# use the new status as this will eventually get set
77+
And cluster "operator-upgrade-2-4" should be stable with 1 nodes

acceptance/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/redpanda-data/redpanda-operator/acceptance
33
go 1.24.3
44

55
require (
6+
github.com/cockroachdb/errors v1.11.3
67
github.com/cucumber/godog v0.14.1
78
github.com/prometheus/common v0.64.0
89
github.com/redpanda-data/common-go/rpadmin v0.1.14
@@ -75,7 +76,6 @@ require (
7576
github.com/chai2010/gettext-go v1.0.2 // indirect
7677
github.com/cisco-open/k8s-objectmatcher v1.9.0 // indirect
7778
github.com/cloudhut/common v0.10.0 // indirect
78-
github.com/cockroachdb/errors v1.11.3 // indirect
7979
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
8080
github.com/cockroachdb/redact v1.1.5 // indirect
8181
github.com/containerd/containerd v1.7.27 // indirect

acceptance/main_test.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import (
1818
"testing"
1919

2020
"github.com/stretchr/testify/require"
21+
"k8s.io/utils/ptr"
2122

2223
_ "github.com/redpanda-data/redpanda-operator/acceptance/steps"
2324
framework "github.com/redpanda-data/redpanda-operator/harpoon"
2425
"github.com/redpanda-data/redpanda-operator/harpoon/providers"
2526
redpandav1alpha1 "github.com/redpanda-data/redpanda-operator/operator/api/redpanda/v1alpha1"
2627
redpandav1alpha2 "github.com/redpanda-data/redpanda-operator/operator/api/redpanda/v1alpha2"
28+
operatorchart "github.com/redpanda-data/redpanda-operator/operator/chart"
2729
"github.com/redpanda-data/redpanda-operator/pkg/helm"
2830
"github.com/redpanda-data/redpanda-operator/pkg/otelutil"
2931
"github.com/redpanda-data/redpanda-operator/pkg/testutil"
@@ -76,16 +78,20 @@ var setupSuite = sync.OnceValues(func() (*framework.Suite, error) {
7678
return
7779
}
7880
t.Log("Installing default Redpanda operator chart")
79-
t.InstallLocalHelmChart(ctx, "../operator/chart", helm.InstallOptions{
81+
t.InstallHelmChart(ctx, "../operator/chart", helm.InstallOptions{
8082
Name: "redpanda-operator",
8183
Namespace: namespace,
82-
Values: map[string]any{
83-
"logLevel": "trace",
84-
"image": map[string]any{
85-
"tag": imageTag,
86-
"repository": imageRepo,
84+
Values: operatorchart.PartialValues{
85+
LogLevel: ptr.To("trace"),
86+
Image: &operatorchart.PartialImage{
87+
Tag: ptr.To(imageTag),
88+
Repository: ptr.To(imageRepo),
8789
},
88-
"additionalCmdFlags": []string{
90+
CRDs: &operatorchart.PartialCRDs{
91+
Enabled: ptr.To(true),
92+
Experimental: ptr.To(true),
93+
},
94+
AdditionalCmdFlags: []string{
8995
// These are needed for running decommissioning tests.
9096
"--additional-controllers=all",
9197
"--unbind-pvcs-after=5s",
@@ -140,7 +146,7 @@ func OperatorTag(ctx context.Context, t framework.TestingT, args ...string) cont
140146
}
141147

142148
t.Logf("Installing Redpanda operator chart: %q", name)
143-
t.InstallLocalHelmChart(ctx, "../operator/chart", helm.InstallOptions{
149+
t.InstallHelmChart(ctx, "../operator/chart", helm.InstallOptions{
144150
Name: "redpanda-operator",
145151
Namespace: t.Namespace(),
146152
ValuesFile: filepath.Join("operator", fmt.Sprintf("%s.yaml", name)),

acceptance/steps/cluster.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func checkClusterHealthCondition(ctx context.Context, t framework.TestingT, clus
102102
t.Logf("Cluster %q contains Healthy reason %q!", clusterName, reason)
103103
}
104104

105-
func shutdownRandomClusterNode(ctx context.Context, t framework.TestingT, clusterName string) {
105+
func shutdownRandomClusterNode(ctx context.Context, t framework.TestingT, clusterName string) context.Context {
106106
var clusterSet appsv1.StatefulSet
107107

108108
key := t.ResourceKey(clusterName)
@@ -123,6 +123,27 @@ func shutdownRandomClusterNode(ctx context.Context, t framework.TestingT, cluste
123123
pod := pods.Items[index]
124124

125125
t.ShutdownNode(ctx, pod.Spec.NodeName)
126+
return context.WithValue(ctx, recordedVariable("ShutdownNodeName"), pod.Spec.NodeName)
127+
}
128+
129+
func shutdownNodeOfPod(ctx context.Context, t framework.TestingT, podName string) context.Context {
130+
t.ResourceKey(podName)
131+
132+
var pod corev1.Pod
133+
require.NoError(t, t.Get(ctx, t.ResourceKey(podName), &pod))
134+
135+
var node corev1.Node
136+
require.NoError(t, t.Get(ctx, t.ResourceKey(pod.Spec.NodeName), &node))
137+
138+
node.Spec.Taints = append(node.Spec.Taints, corev1.Taint{
139+
Key: "node.kubernetes.io/out-of-service",
140+
Effect: corev1.TaintEffectNoExecute,
141+
})
142+
143+
require.NoError(t, t.Update(ctx, &node))
144+
145+
t.ShutdownNode(ctx, pod.Spec.NodeName)
146+
return context.WithValue(ctx, recordedVariable("ShutdownNodeName"), pod.Spec.NodeName)
126147
}
127148

128149
func deleteNotReadyKubernetesNodes(ctx context.Context, t framework.TestingT) {
@@ -138,6 +159,12 @@ func deleteNotReadyKubernetesNodes(ctx context.Context, t framework.TestingT) {
138159
}
139160
}
140161

162+
func deleteKubernetesNodesFromContext(ctx context.Context, t framework.TestingT) {
163+
shutdownNodeName := ctx.Value(recordedVariable("ShutdownNodeName"))
164+
t.Logf("Deleting Kubernetes node: %q", shutdownNodeName)
165+
t.DeleteNode(ctx, shutdownNodeName.(string))
166+
}
167+
141168
func checkClusterNodeCount(ctx context.Context, t framework.TestingT, clusterName string, nodeCount int32) {
142169
var cluster redpandav1alpha2.Redpanda
143170
var actualNodeCount int32

0 commit comments

Comments
 (0)