Skip to content

Commit e6f1f4d

Browse files
operator: add console stanza -> CRD migration (#1177)
Reconciling a Redpanda will now produce a Console CR with a clusterRef pointing back at the cluster itself. Accordingly, the `console` stanza on the Redpanda CR is now deprecated. For the time being changes to it are stlil propagated to the generated Console CR, but deletion of the Redpanda CR will not cause deletion of the Console CR since they should be managed separately. Additionally, due to migration of the stanza to an otherwise opt-in CR, the flag to enable the Console reconciler is now default-on and must be opted out of if someone does not want to ensure the Console CRs exist in the default installation. --------- Co-authored-by: Andrew Stucki <[email protected]>
1 parent 7cd7919 commit e6f1f4d

38 files changed

+3208
-905
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project: operator
2+
kind: Deprecated
3+
body: The entirety of the `spec.clusterSpec.console` block in the Redpanda CR is now deprecated and will be removed in the future. Any Redpanda CR that contains one will automatically be migrated to a standalone Console CR with a back reference to the parent Redpanda CR. Note that these will *not* be automatically deleted when the `console` stanza is removed or when the parent Redpanda CR is deleted.
4+
time: 2025-11-26T12:05:45.014863-05:00
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
@operator:none
2+
Feature: Upgrading the operator with Console installed
3+
@skip:gke @skip:aks @skip:eks
4+
Scenario: Console v2 to v3 no warnings
5+
Given I helm install "redpanda-operator" "redpanda/operator" --version v25.1.3 with values:
6+
"""
7+
"""
8+
And I apply Kubernetes manifest:
9+
"""
10+
---
11+
apiVersion: cluster.redpanda.com/v1alpha2
12+
kind: Redpanda
13+
metadata:
14+
name: operator-console-upgrade
15+
spec:
16+
clusterSpec:
17+
console:
18+
# Old versions have broken chart rendering for the console stanza
19+
# unless nameOverride is set due to mapping configmap values for
20+
# both the console deployment and redpanda statefulset to the same
21+
# name. Setting nameOverride to "broken" works around this.
22+
nameOverride: broken
23+
tls:
24+
enabled: false
25+
external:
26+
enabled: false
27+
statefulset:
28+
replicas: 1
29+
sideCars:
30+
image:
31+
tag: dev
32+
repository: localhost/redpanda-operator
33+
"""
34+
And cluster "operator-console-upgrade" is available
35+
Then I can helm upgrade "redpanda-operator" "../operator/chart" with values:
36+
"""
37+
image:
38+
tag: dev
39+
repository: localhost/redpanda-operator
40+
crds:
41+
experimental: true
42+
"""
43+
And cluster "operator-console-upgrade" should be stable with 1 nodes
44+
And the migrated console cluster "operator-console-upgrade" should have 0 warnings
45+
46+
@skip:gke @skip:aks @skip:eks
47+
Scenario: Console v2 to v3 with warnings
48+
Given I helm install "redpanda-operator" "redpanda/operator" --version v25.1.3 with values:
49+
"""
50+
"""
51+
And I apply Kubernetes manifest:
52+
"""
53+
---
54+
apiVersion: cluster.redpanda.com/v1alpha2
55+
kind: Redpanda
56+
metadata:
57+
name: operator-console-upgrade-warnings
58+
spec:
59+
clusterSpec:
60+
console:
61+
nameOverride: broken
62+
console:
63+
roleBindings:
64+
- roleName: admin
65+
subjects:
66+
- kind: group
67+
provider: OIDC
68+
name: devs
69+
tls:
70+
enabled: false
71+
external:
72+
enabled: false
73+
statefulset:
74+
replicas: 1
75+
sideCars:
76+
image:
77+
tag: dev
78+
repository: localhost/redpanda-operator
79+
"""
80+
And cluster "operator-console-upgrade-warnings" is available
81+
Then I can helm upgrade "redpanda-operator" "../operator/chart" with values:
82+
"""
83+
image:
84+
tag: dev
85+
repository: localhost/redpanda-operator
86+
crds:
87+
experimental: true
88+
"""
89+
And cluster "operator-console-upgrade-warnings" should be stable with 1 nodes
90+
And the migrated console cluster "operator-console-upgrade-warnings" should have 1 warning

acceptance/steps/console.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ func consoleIsHealthy(ctx context.Context, t framework.TestingT, name string) {
3333
return upToDate && hasHealthyReplicas
3434
}, time.Minute, 10*time.Second)
3535
}
36+
37+
func consoleHasWarnings(ctx context.Context, t framework.TestingT, name string, expected int) {
38+
key := t.ResourceKey(name)
39+
40+
t.Logf("Checking console %q has %d warning(s)", name, expected)
41+
require.Eventually(t, func() bool {
42+
var console redpandav1alpha2.Console
43+
if t.Get(ctx, key, &console) != nil {
44+
// we have an error fetching, maybe have not yet reconciled,
45+
// so just try again
46+
return false
47+
}
48+
49+
return len(console.Spec.Warnings) == expected
50+
}, time.Minute, 10*time.Second)
51+
}

acceptance/steps/helpers.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,15 @@ func getVersion(t framework.TestingT, version string) string {
657657

658658
return t.Variant()
659659
}
660+
661+
func sleepALongTime(ctx context.Context) error {
662+
t := framework.T(ctx)
663+
664+
t.Log("Becoming debuggable by sleeping for 20 minutes")
665+
select {
666+
case <-time.After(20 * time.Minute):
667+
return nil
668+
case <-ctx.Done():
669+
return ctx.Err()
670+
}
671+
}

acceptance/steps/register.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,8 @@ func init() {
113113

114114
// Console scenario steps
115115
framework.RegisterStep(`^Console "([^"]+)" will be healthy`, consoleIsHealthy)
116+
framework.RegisterStep(`^the migrated console cluster "([^"]+)" should have (\d+) warning(s)?$`, consoleHasWarnings)
117+
118+
// Debug steps
119+
framework.RegisterStep(`^I become debuggable$`, sleepALongTime)
116120
}

charts/console/rendervalues.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ type RenderValues struct {
2828
Annotations map[string]string `json:"annotations"`
2929
PodAnnotations map[string]string `json:"podAnnotations"`
3030
PodLabels map[string]string `json:"podLabels"`
31-
PodSecurityContext corev1.PodSecurityContext `json:"podSecurityContext"`
32-
SecurityContext corev1.SecurityContext `json:"securityContext"`
31+
PodSecurityContext corev1.PodSecurityContext `json:"podSecurityContext" partial:"builtin"`
32+
SecurityContext corev1.SecurityContext `json:"securityContext" partial:"builtin"`
3333
Service ServiceConfig `json:"service"`
3434
Ingress IngressConfig `json:"ingress"`
3535
Resources corev1.ResourceRequirements `json:"resources"`
@@ -55,8 +55,8 @@ type RenderValues struct {
5555
SecretMounts []SecretMount `json:"secretMounts"`
5656
Secret SecretConfig `json:"secret"`
5757
LicenseSecretRef *corev1.SecretKeySelector `json:"licenseSecretRef,omitempty"`
58-
LivenessProbe corev1.Probe `json:"livenessProbe"`
59-
ReadinessProbe corev1.Probe `json:"readinessProbe"`
58+
LivenessProbe corev1.Probe `json:"livenessProbe" partial:"builtin"`
59+
ReadinessProbe corev1.Probe `json:"readinessProbe" partial:"builtin"`
6060
ConfigMap Creatable `json:"configmap"`
6161
Deployment DeploymentConfig `json:"deployment"`
6262
Strategy appsv1.DeploymentStrategy `json:"strategy"`

charts/console/rendervalues_partial.gen.go

Lines changed: 39 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)