Skip to content

Commit 8a234d6

Browse files
committed
chore(helm): switch to 3.0.0 and drop compat measures
1 parent 5b2726b commit 8a234d6

8 files changed

Lines changed: 34 additions & 507 deletions

File tree

deploy/charts/emqx-operator/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ type: application
66

77
# This is the chart version. This version number should be incremented each time you make changes
88
# to the chart and its templates, including the app version.
9-
version: 2.3.0-rc.1
9+
version: 3.0.0-rc.1
1010

1111
# This is the version number of the application being deployed.
12-
appVersion: 2.3.0
12+
appVersion: 3.0.0
1313

1414
sources:
15-
- https://github.com/emqx/emqx-operator/tree/main-2.3/deploy/charts/emqx-operator
15+
- https://github.com/emqx/emqx-operator/tree/main-3.x/deploy/charts/emqx-operator
1616
- https://github.com/emqx/emqx

deploy/charts/emqx-operator/templates/NOTES.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,3 @@ EMQX Operator Controller {{ .Chart.AppVersion }} has been deployed successfully!
33
The operator is running in namespace: {{ .Release.Namespace }}
44

55
Now you can create EMQX Custom Resources to deploy EMQX clusters.
6-
7-
{{- if .Values.upgrade.preUpgradeCheck }}
8-
9-
A pre-upgrade compatibility check Job ran automatically to ensure a smooth
10-
upgrade from any prior installation.
11-
12-
The check:
13-
- Verified no legacy custom resources exist (emqxbrokers, emqxenterprises,
14-
emqxplugins) that would be destroyed when Helm removes their CRDs
15-
- Patched CRDs to remove conversion webhooks, preventing API server
16-
errors during the operator replacement window
17-
18-
To skip the pre-upgrade Job on future installs (e.g. in air-gapped environments):
19-
--set upgrade.preUpgradeCheck=false
20-
{{- end }}

deploy/charts/emqx-operator/templates/controller-manager-rbac.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ rules:
6565
resources:
6666
- pods
6767
verbs:
68+
- delete
6869
- get
6970
- list
7071
- update
@@ -104,14 +105,12 @@ rules:
104105
- apps.emqx.io
105106
resources:
106107
- emqxes/finalizers
107-
- rebalances/finalizers
108108
verbs:
109109
- update
110110
- apiGroups:
111111
- apps.emqx.io
112112
resources:
113113
- emqxes/status
114-
- rebalances/status
115114
verbs:
116115
- get
117116
- patch

deploy/charts/emqx-operator/templates/pre-upgrade-job.yaml

Lines changed: 0 additions & 165 deletions
This file was deleted.

deploy/charts/emqx-operator/values.yaml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ singleNamespace: false
1212
# Development configures the logger to use a Zap development config
1313
# (stacktraces on warnings, no sampling), otherwise a Zap production
1414
# config will be used (stacktraces on errors, sampling).
15-
# NOTE: On by default for 2.3.0 as it changes a lot, a higher risk of
15+
# NOTE: On by default for 3.0.0 as it changes a lot, a higher risk of
1616
# bug reports. Impact is tolerable, usually not much debug output.
17-
# TODO: Switch off by default in 2.3.1.
17+
# TODO: Switch off by default in 3.1.0.
1818
development: true
1919

2020
replicaCount: 1
@@ -65,27 +65,3 @@ nodeSelector: {}
6565
tolerations: []
6666

6767
affinity: {}
68-
69-
## Upgrade settings.
70-
## A pre-install/pre-upgrade Job runs automatically to ensure a smooth
71-
## upgrade from earlier chart versions:
72-
## 1. Checks for legacy custom resources (emqxbrokers, emqxenterprises,
73-
## emqxplugins) and blocks the upgrade if any exist, because Helm
74-
## will delete those CRDs (and their CRs) during the upgrade.
75-
## 2. Patches CRD conversion webhooks to strategy "None" so the API
76-
## server does not fail while the old operator is being replaced.
77-
##
78-
## The Job is fully idempotent and becomes a no-op on fresh installs.
79-
upgrade:
80-
## Run the pre-upgrade compatibility check Job.
81-
## Enabled by default so that upgrades from 2.2.x work out of the box.
82-
## Set to false to skip the Job entirely (e.g. in air-gapped
83-
## environments where pulling the kubectl image is not possible).
84-
preUpgradeCheck: true
85-
86-
## Image used for the pre-upgrade cleanup Job.
87-
## Must include kubectl and sh.
88-
image:
89-
repository: alpine/k8s
90-
tag: "1.31.4"
91-
pullPolicy: IfNotPresent

test/e2e-helm/helm_install_test.go

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
. "github.com/onsi/gomega"
2323
)
2424

25-
// helmInstall installs the local 2.3.x chart into the given namespace with --wait.
25+
// helmInstall installs the local 3.x chart into the given namespace with --wait.
2626
func helmInstall(namespace string, extraArgs ...string) error {
2727
args := []string{
2828
"install",
@@ -39,31 +39,31 @@ func helmInstall(namespace string, extraArgs ...string) error {
3939
return Run("helm", args...)
4040
}
4141

42-
// helmUpgrade upgrades to the local 2.3.x chart in the given namespace with --wait.
43-
func helmUpgrade(namespace string) error {
44-
return Run("helm", "upgrade",
45-
helmReleaseName,
46-
localChartPath,
47-
"--namespace", namespace,
48-
"--set", "image.repository="+operatorImageRepo,
49-
"--set", "image.tag="+operatorImageTag,
50-
"--set", "image.pullPolicy=Never",
51-
"--wait",
52-
"--timeout", "2m",
53-
)
54-
}
55-
56-
// helmCleanup removes all resources that 2.3.x chart may have left behind in
42+
// helmUpgrade upgrades to the local 3.x chart in the given namespace with --wait.
43+
// func helmUpgrade(namespace string) error {
44+
// return Run("helm", "upgrade",
45+
// helmReleaseName,
46+
// localChartPath,
47+
// "--namespace", namespace,
48+
// "--set", "image.repository="+operatorImageRepo,
49+
// "--set", "image.tag="+operatorImageTag,
50+
// "--set", "image.pullPolicy=Never",
51+
// "--wait",
52+
// "--timeout", "2m",
53+
// )
54+
// }
55+
56+
// helmCleanup removes all resources that 3.x chart may have left behind in
5757
// the given namespace, including the Helm release itself.
5858
func helmCleanup(namespace string) {
5959
_ = Run("helm", "uninstall", helmReleaseName, "--namespace", namespace)
60-
_ = Kubectl("delete", "clusterrole", "emqx-operator-manager-role", "--ignore-not-found")
61-
_ = Kubectl("delete", "clusterrolebinding", "emqx-operator-manager-rolebinding", "--ignore-not-found")
62-
_ = Kubectl("delete", "clusterrole", "emqx-operator-pre-upgrade", "--ignore-not-found")
63-
_ = Kubectl("delete", "clusterrolebinding", "emqx-operator-pre-upgrade", "--ignore-not-found")
64-
_ = Kubectl("delete", "crd", "emqxes.apps.emqx.io", "--ignore-not-found")
65-
_ = Kubectl("delete", "crd", "rebalances.apps.emqx.io", "--ignore-not-found")
66-
_ = Kubectl("delete", "ns", namespace, "--ignore-not-found")
60+
_ = Kubectl("delete", "clusterrole", "emqx-operator-manager-role")
61+
_ = Kubectl("delete", "clusterrolebinding", "emqx-operator-manager-rolebinding")
62+
_ = Kubectl("delete", "clusterrole", "emqx-operator-pre-upgrade")
63+
_ = Kubectl("delete", "clusterrolebinding", "emqx-operator-pre-upgrade")
64+
_ = Kubectl("delete", "crd", "emqxes.apps.emqx.io")
65+
_ = Kubectl("delete", "crd", "rebalances.apps.emqx.io")
66+
_ = Kubectl("delete", "ns", namespace)
6767
}
6868

6969
//nolint:errcheck
@@ -89,13 +89,14 @@ var _ = Describe("Helm Install", Ordered, func() {
8989
}
9090
})
9191

92-
It("should install cleanly / cleanup no-op", func() {
93-
By("install 2.3.x chart")
92+
It("should install cleanly", func() {
93+
By("install 3.x chart")
9494
Expect(helmInstall(namespace)).To(Succeed())
9595

9696
By("verify CRDs are installed")
9797
Expect(crdExists("emqxes.apps.emqx.io")).To(BeTrue())
98-
Expect(crdExists("rebalances.apps.emqx.io")).To(BeTrue())
98+
// NOTE: Rebalance controller is disabled in this release. See api/v3alpha1/rebalance_types.go.
99+
// Expect(crdExists("rebalances.apps.emqx.io")).To(BeTrue())
99100

100101
By("verify operator deployment is available")
101102
Expect(Kubectl("wait", "deployment",
@@ -105,22 +106,4 @@ var _ = Describe("Helm Install", Ordered, func() {
105106
"--timeout", "1m",
106107
)).To(Succeed())
107108
})
108-
109-
It("should install cleanly / pre-upgrade check disabled", func() {
110-
By("install 2.3.x with pre-upgrade check disabled")
111-
Expect(helmInstall(namespace, "--set", "upgrade.preUpgradeCheck=false")).
112-
To(Succeed())
113-
114-
By("verify operator is running")
115-
Expect(Kubectl("wait", "deployment",
116-
"emqx-operator-controller-manager",
117-
"--for", "condition=Available",
118-
"--namespace", namespace,
119-
"--timeout", "1m",
120-
)).To(Succeed())
121-
122-
By("verify CRDs are installed")
123-
Expect(crdExists("emqxes.apps.emqx.io")).To(BeTrue())
124-
Expect(crdExists("rebalances.apps.emqx.io")).To(BeTrue())
125-
})
126109
})

test/e2e-helm/helm_suite_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
// helmReleaseName is the Helm release name used across all Helm upgrade tests.
3232
helmReleaseName = "emqx-operator"
3333

34-
// localChartPath is the path to the local 2.3.x chart being tested.
34+
// localChartPath is the path to the local 3.x chart being tested.
3535
localChartPath = "deploy/charts/emqx-operator"
3636

3737
// operatorImage is the operator image which should already be built and available.
@@ -71,11 +71,6 @@ func crdExists(name string) bool {
7171
return Kubectl("get", "crd", name) == nil
7272
}
7373

74-
// resourceExists checks whether a cluster-scoped resource exists.
75-
func resourceExists(kind, name string) bool {
76-
return Kubectl("get", kind, name) == nil
77-
}
78-
7974
// dumpHelmDiagnostics writes debug info for the given namespace to GinkgoWriter.
8075
func dumpHelmDiagnostics(namespace string) {
8176
out, _ := Output("helm", "list", "--namespace", namespace)

0 commit comments

Comments
 (0)