@@ -29,6 +29,14 @@ import (
29
29
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
30
30
)
31
31
32
+ const (
33
+ certmanagerVersion = "v1.9.1"
34
+ certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
35
+ prometheusOperatorVersion = "0.51"
36
+ prometheusOperatorURL = "https://raw.githubusercontent.com/prometheus-operator/" +
37
+ "prometheus-operator/release-%s/bundle.yaml"
38
+ )
39
+
32
40
// TestContext specified to run e2e tests
33
41
type TestContext struct {
34
42
* CmdContext
@@ -108,34 +116,15 @@ func (t *TestContext) Prepare() error {
108
116
return os .MkdirAll (t .Dir , 0o755 )
109
117
}
110
118
111
- const (
112
- certmanagerVersionWithv1beta2CRs = "v0.11.0"
113
- certmanagerLegacyVersion = "v1.0.4"
114
- certmanagerVersion = "v1.5.3"
115
-
116
- certmanagerURLTmplLegacy = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager-legacy.yaml"
117
- certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
118
- )
119
-
120
119
// makeCertManagerURL returns a kubectl-able URL for the cert-manager bundle.
121
- func (t * TestContext ) makeCertManagerURL (hasv1beta1CRs bool ) string {
122
- // Return a URL for the manifest bundle with v1beta1 CRs.
123
- if hasv1beta1CRs {
124
- return fmt .Sprintf (certmanagerURLTmpl , certmanagerVersionWithv1beta2CRs )
125
- }
126
-
127
- // Determine which URL to use for a manifest bundle with v1 CRs.
128
- // The most up-to-date bundle uses v1 CRDs, which were introduced in k8s v1.16.
129
- if ver := t .K8sVersion .ServerVersion ; ver .GetMajorInt () <= 1 && ver .GetMinorInt () < 16 {
130
- return fmt .Sprintf (certmanagerURLTmplLegacy , certmanagerLegacyVersion )
131
- }
120
+ func (t * TestContext ) makeCertManagerURL () string {
132
121
return fmt .Sprintf (certmanagerURLTmpl , certmanagerVersion )
133
122
}
134
123
135
124
// InstallCertManager installs the cert manager bundle. If hasv1beta1CRs is true,
136
125
// the legacy version (which uses v1alpha2 CRs) is installed.
137
- func (t * TestContext ) InstallCertManager (hasv1beta1CRs bool ) error {
138
- url := t .makeCertManagerURL (hasv1beta1CRs )
126
+ func (t * TestContext ) InstallCertManager () error {
127
+ url := t .makeCertManagerURL ()
139
128
if _ , err := t .Kubectl .Apply (false , "-f" , url , "--validate=false" ); err != nil {
140
129
return err
141
130
}
@@ -149,43 +138,24 @@ func (t *TestContext) InstallCertManager(hasv1beta1CRs bool) error {
149
138
return err
150
139
}
151
140
152
- // UninstallCertManager uninstalls the cert manager bundle. If hasv1beta1CRs is true,
153
- // the legacy version (which uses v1alpha2 CRs) is installed.
154
- func (t * TestContext ) UninstallCertManager (hasv1beta1CRs bool ) {
155
- url := t .makeCertManagerURL (hasv1beta1CRs )
141
+ // UninstallCertManager uninstalls the cert manager bundle.
142
+ func (t * TestContext ) UninstallCertManager () {
143
+ url := t .makeCertManagerURL ()
156
144
if _ , err := t .Kubectl .Delete (false , "-f" , url ); err != nil {
157
145
warnError (err )
158
146
}
159
147
}
160
148
161
- const (
162
- prometheusOperatorLegacyVersion = "0.33"
163
- prometheusOperatorLegacyURL = "https://raw.githubusercontent.com/coreos/prometheus-operator/release-%s/bundle.yaml"
164
- prometheusOperatorVersion = "0.51"
165
- prometheusOperatorURL = "https://raw.githubusercontent.com/prometheus-operator/" +
166
- "prometheus-operator/release-%s/bundle.yaml"
167
- )
168
-
169
149
// InstallPrometheusOperManager installs the prometheus manager bundle.
170
150
func (t * TestContext ) InstallPrometheusOperManager () error {
171
- var url string
172
- if ver := t .K8sVersion .ServerVersion ; ver .GetMajorInt () <= 1 && ver .GetMinorInt () < 16 {
173
- url = fmt .Sprintf (prometheusOperatorLegacyURL , prometheusOperatorLegacyVersion )
174
- } else {
175
- url = fmt .Sprintf (prometheusOperatorURL , prometheusOperatorVersion )
176
- }
151
+ url := fmt .Sprintf (prometheusOperatorURL , prometheusOperatorVersion )
177
152
_ , err := t .Kubectl .Apply (false , "-f" , url )
178
153
return err
179
154
}
180
155
181
156
// UninstallPrometheusOperManager uninstalls the prometheus manager bundle.
182
157
func (t * TestContext ) UninstallPrometheusOperManager () {
183
- var url string
184
- if ver := t .K8sVersion .ServerVersion ; ver .GetMajorInt () <= 1 && ver .GetMinorInt () < 16 {
185
- url = fmt .Sprintf (prometheusOperatorLegacyURL , prometheusOperatorLegacyVersion )
186
- } else {
187
- url = fmt .Sprintf (prometheusOperatorURL , prometheusOperatorVersion )
188
- }
158
+ url := fmt .Sprintf (prometheusOperatorURL , prometheusOperatorVersion )
189
159
if _ , err := t .Kubectl .Delete (false , "-f" , url ); err != nil {
190
160
warnError (err )
191
161
}
0 commit comments