forked from openshift/osde2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
operators.go
598 lines (510 loc) · 21.1 KB
/
operators.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
package operators
import (
"context"
"encoding/json"
"fmt"
"log"
"strings"
"time"
"github.com/openshift/osde2e/pkg/common/config"
"github.com/openshift/osde2e/pkg/common/helper"
"github.com/openshift/osde2e/pkg/common/providers"
"github.com/openshift/osde2e/pkg/common/runner"
"github.com/openshift/osde2e/pkg/common/templates"
"github.com/openshift/osde2e/pkg/common/util"
appsv1 "k8s.io/api/apps/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
kerror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
operatorv1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
viper "github.com/openshift/osde2e/pkg/common/concurrentviper"
)
func checkClusterServiceVersion(h *helper.H, namespace, name string) {
// Check that the operator clusterServiceVersion exists
ginkgo.Context(fmt.Sprintf("clusterServiceVersion %s/%s", namespace, name), func() {
util.GinkgoIt("should be present and in succeeded state", func() {
Eventually(func() bool {
csvList, err := h.Operator().OperatorsV1alpha1().ClusterServiceVersions(namespace).List(context.TODO(), metav1.ListOptions{})
if err != nil {
log.Printf("failed to get CSVs in namespace %s: %v", namespace, err)
return false
}
for _, csv := range csvList.Items {
if csv.Spec.DisplayName == name && csv.Status.Phase == operatorv1.CSVPhaseSucceeded {
return true
}
}
return false
}, "30m", "15s").Should(BeTrue())
}, viper.GetFloat64(config.Tests.PollingTimeout))
})
}
func checkConfigMapLockfile(h *helper.H, namespace, operatorLockFile string) {
// Check that the operator configmap has been deployed
ginkgo.Context("configmaps", func() {
util.GinkgoIt("should exist", func() {
// Wait for lockfile to signal operator is active
err := pollLockFile(h, namespace, operatorLockFile)
Expect(err).ToNot(HaveOccurred(), "failed fetching the configMap lockfile")
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkDeployment(h *helper.H, namespace string, name string, defaultDesiredReplicas int32) {
// Check that the operator deployment exists in the operator namespace
ginkgo.Context("deployment", func() {
util.GinkgoIt("should exist", func() {
deployment, err := pollDeployment(h, namespace, name)
Expect(err).ToNot(HaveOccurred(), "failed fetching deployment")
Expect(deployment).NotTo(BeNil(), "deployment is nil")
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
util.GinkgoIt("should have all desired replicas ready", func() {
deployment, err := pollDeployment(h, namespace, name)
Expect(err).ToNot(HaveOccurred(), "failed fetching deployment")
readyReplicas := deployment.Status.ReadyReplicas
desiredReplicas := deployment.Status.Replicas
// The desired replicas should match the default installed replica count
Expect(desiredReplicas).To(BeNumerically("==", defaultDesiredReplicas), "The deployment desired replicas should not drift from the default 1.")
// Desired replica count should match ready replica count
Expect(readyReplicas).To(BeNumerically("==", desiredReplicas), "All desired replicas should be ready.")
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkPod(h *helper.H, namespace string, name string, gracePeriod int, maxAcceptedRestart int) {
// Checks that deployed pods have less than maxAcceptedRestart restarts
ginkgo.Context("pods", func() {
util.GinkgoIt(fmt.Sprintf("should have %v or less restart(s)", maxAcceptedRestart), func() {
// wait for graceperiod
time.Sleep(time.Duration(gracePeriod) * time.Second)
//retrieve pods
pods, err := h.Kube().CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{LabelSelector: "name=" + name})
Expect(err).ToNot(HaveOccurred(), "failed fetching pods")
var restartSum int32 = 0
for _, pod := range pods.Items {
for _, status := range pod.Status.ContainerStatuses {
restartSum += status.RestartCount
}
}
Expect(restartSum).To(BeNumerically("<=", maxAcceptedRestart))
}, float64(gracePeriod)+viper.GetFloat64(config.Tests.PollingTimeout))
})
}
func checkServiceAccounts(h *helper.H, operatorNamespace string, serviceAccounts []string) {
// Check that deployed serviceAccounts exist
ginkgo.Context("serviceAccounts", func() {
util.GinkgoIt("should exist", func() {
for _, serviceAccountName := range serviceAccounts {
_, err := h.Kube().CoreV1().ServiceAccounts(operatorNamespace).Get(context.TODO(), serviceAccountName, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred(), "failed to get serviceAccount %v\n", serviceAccountName)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkClusterRoles(h *helper.H, clusterRoles []string, matchPrefix bool) {
// Check that the clusterRoles exist
ginkgo.Context("clusterRoles", func() {
util.GinkgoIt("should exist", func() {
allClusterRoles, err := h.Kube().RbacV1().ClusterRoles().List(context.TODO(), metav1.ListOptions{})
Expect(err).ToNot(HaveOccurred(), "failed to list clusterRoles\n")
for _, clusterRoleToFind := range clusterRoles {
found := false
for _, clusterRole := range allClusterRoles.Items {
if (matchPrefix && strings.HasPrefix(clusterRole.Name, clusterRoleToFind)) ||
(!matchPrefix && clusterRole.Name == clusterRoleToFind) {
found = true
break
}
}
Expect(found).To(BeTrue(), "failed to find ClusterRole %s\n", clusterRoleToFind)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkClusterRoleBindings(h *helper.H, clusterRoleBindings []string, matchPrefix bool) {
// Check that the clusterRoles exist
ginkgo.Context("clusterRoleBindings", func() {
util.GinkgoIt("should exist", func() {
allClusterRoleBindings, err := h.Kube().RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{})
Expect(err).ToNot(HaveOccurred(), "failed to list clusterRoles\n")
for _, clusterRoleBindingToFind := range clusterRoleBindings {
found := false
for _, clusterRole := range allClusterRoleBindings.Items {
if (matchPrefix && strings.HasPrefix(clusterRole.Name, clusterRoleBindingToFind)) ||
(!matchPrefix && clusterRole.Name == clusterRoleBindingToFind) {
found = true
break
}
}
Expect(found).To(BeTrue(), "failed to find ClusterRoleBinding %s\n", clusterRoleBindingToFind)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkRole(h *helper.H, namespace string, roles []string) {
// Check that deployed roles exist
ginkgo.Context("roles", func() {
util.GinkgoIt("should exist", func() {
for _, roleName := range roles {
_, err := h.Kube().RbacV1().Roles(namespace).Get(context.TODO(), roleName, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred(), "failed to get role %v\n", roleName)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkRolesWithNamePrefix(h *helper.H, namespace string, prefix string, count int) {
ginkgo.Context("roles with prefix", func() {
util.GinkgoIt("should exist", func() {
Eventually(func() int {
rolesList, err := h.Kube().RbacV1().Roles(namespace).List(context.TODO(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred(), "failed to get roles in namespace %s", namespace)
var roleCount int
for _, r := range rolesList.Items {
if strings.HasPrefix(r.Name, prefix) {
roleCount++
}
}
return roleCount
}, "10m", "30s").Should(BeNumerically(">=", count))
}, viper.GetFloat64(config.Tests.PollingTimeout))
})
}
func checkRoleBindingsWithNamePrefix(h *helper.H, namespace string, prefix string, count int) {
ginkgo.Context("roles with prefix", func() {
util.GinkgoIt("should exist", func() {
Eventually(func() int {
roleBindings, err := h.Kube().RbacV1().RoleBindings(namespace).List(context.TODO(), metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred(), "failed to get roles in namespace %s", namespace)
var roleCount int
for _, r := range roleBindings.Items {
if strings.HasPrefix(r.Name, prefix) {
roleCount++
}
}
return roleCount
}, "10m", "30s").Should(BeNumerically(">=", count))
}, viper.GetFloat64(config.Tests.PollingTimeout))
})
}
func checkRoleBindings(h *helper.H, namespace string, roleBindings []string) {
// Check that deployed rolebindings exist
ginkgo.Context("roleBindings", func() {
util.GinkgoIt("should exist", func() {
for _, roleBindingName := range roleBindings {
err := pollRoleBinding(h, namespace, roleBindingName)
Expect(err).NotTo(HaveOccurred(), "failed to get roleBinding %v\n", roleBindingName)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
//nolint
func checkSecrets(h *helper.H, namespace string, secrets []string) {
// Check that deployed secrets exist
ginkgo.Context("secrets", func() {
util.GinkgoIt("should exist", func() {
for _, secretName := range secrets {
_, err := h.Kube().CoreV1().Secrets(namespace).Get(context.TODO(), secretName, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred(), "failed to get secret %v\n", secretName)
}
}, float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkUpgrade(h *helper.H, subNamespace string, subName string, packageName string, regServiceName string) {
ginkgo.Context("Operator Upgrade", func() {
installPlanPollingDuration := 5 * time.Minute
upgradePollingDuration := 15 * time.Minute
util.GinkgoIt("should upgrade from the replaced version", func() {
// Get the CSV we're currently installed with
var latestCSV string
var sub *operatorv1.Subscription
var err error
pollErr := wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) {
sub, err = h.Operator().OperatorsV1alpha1().Subscriptions(subNamespace).Get(context.TODO(), subName, metav1.GetOptions{})
if err != nil {
return false, err
}
latestCSV = sub.Status.CurrentCSV
if latestCSV != "" {
return true, nil
}
return false, nil
})
Expect(pollErr).NotTo(HaveOccurred(), fmt.Sprintf("failed trying to get Subscription %s in %s namespace: %v", subName, subNamespace, err))
// Get the N-1 version of the CSV to test an upgrade from
previousCSV, err := getReplacesCSV(h, subNamespace, packageName, regServiceName)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed trying to get previous CSV for Subscription %s in %s namespace", subName, subNamespace))
log.Printf("Reverting to package %v from %v to test upgrade of %v", previousCSV, latestCSV, subName)
// Delete current Operator installation
err = h.Operator().OperatorsV1alpha1().Subscriptions(subNamespace).Delete(context.TODO(), subName, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed trying to delete Subscription %s", subName))
log.Printf("Removed subscription %s", subName)
err = h.Operator().OperatorsV1alpha1().ClusterServiceVersions(subNamespace).Delete(context.TODO(), latestCSV, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed trying to delete ClusterServiceVersion %s", latestCSV))
log.Printf("Removed csv %s", latestCSV)
Eventually(func() bool {
_, err := h.Operator().OperatorsV1alpha1().InstallPlans(subNamespace).Get(context.TODO(), sub.Status.Install.Name, metav1.GetOptions{})
return apierrors.IsNotFound(err)
}, installPlanPollingDuration, 10*time.Second).Should(BeTrue(), "installplan never garbage collected")
log.Printf("Verified installplan removal")
// Create subscription to the previous version
sub, err = h.Operator().OperatorsV1alpha1().Subscriptions(subNamespace).Create(context.TODO(), &operatorv1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Name: subName,
Namespace: subNamespace,
},
Spec: &operatorv1.SubscriptionSpec{
Package: sub.Spec.Package,
Channel: sub.Spec.Channel,
CatalogSourceNamespace: sub.Spec.CatalogSourceNamespace,
CatalogSource: sub.Spec.CatalogSource,
InstallPlanApproval: operatorv1.ApprovalAutomatic,
StartingCSV: previousCSV,
},
}, metav1.CreateOptions{})
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("failed trying to create Subscription %s", subName))
log.Printf("Created replacement subscription %s with starting CSV %s", subName, previousCSV)
// Wait for the operator to arrive back on its latest CSV
err = wait.PollImmediate(5*time.Second, upgradePollingDuration, func() (bool, error) {
csv, err := h.Operator().OperatorsV1alpha1().ClusterServiceVersions(sub.Namespace).Get(context.TODO(), latestCSV, metav1.GetOptions{})
if err != nil && !kerror.IsNotFound(err) {
log.Printf("Returning err %v", err)
return false, err
}
if csv.Status.Phase == operatorv1.CSVPhaseSucceeded {
return true, nil
}
return false, nil
})
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("CSV %s did not eventually install successfully", latestCSV))
}, upgradePollingDuration.Seconds()+installPlanPollingDuration.Seconds()+
float64(viper.GetFloat64(config.Tests.PollingTimeout)))
})
}
func checkService(h *helper.H, namespace string, name string, port int) {
pollTimeout := viper.GetFloat64(config.Tests.PollingTimeout)
ginkgo.Context("service", func() {
util.GinkgoIt(
"should exist",
func() {
Eventually(func() bool {
_, err := h.Kube().CoreV1().Services(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
return false
}
return true
}, "30m", "1m").Should(BeTrue())
},
pollTimeout,
)
})
}
func pollClusterRoleBinding(h *helper.H, clusterRoleBindingName string) error {
// pollRoleBinding will check for the existence of a clusterRole
// in the specified project, and wait for it to exist, until a timeout
var err error
// interval is the duration in seconds between polls
// values here for humans
interval := 5
// convert time.Duration type
timeoutDuration := time.Duration(viper.GetFloat64(config.Tests.PollingTimeout)) * time.Second
intervalDuration := time.Duration(interval) * time.Second
start := time.Now()
Loop:
for {
_, err = h.Kube().RbacV1().ClusterRoleBindings().Get(context.TODO(), clusterRoleBindingName, metav1.GetOptions{})
elapsed := time.Since(start)
switch {
case err == nil:
// Success
break Loop
case strings.Contains(err.Error(), "forbidden"):
return err
default:
if elapsed < timeoutDuration {
log.Printf("Waiting %v for %s clusterRoleBinding to exist", (timeoutDuration - elapsed), clusterRoleBindingName)
time.Sleep(intervalDuration)
} else {
err = fmt.Errorf("Failed to get clusterRolebinding %s before timeout", clusterRoleBindingName)
break Loop
}
}
}
return err
}
func pollRoleBinding(h *helper.H, projectName string, roleBindingName string) error {
// pollRoleBinding will check for the existence of a roleBinding
// in the specified project, and wait for it to exist, until a timeout
var err error
// interval is the duration in seconds between polls
// values here for humans
interval := 5
// convert time.Duration type
timeoutDuration := time.Duration(viper.GetFloat64(config.Tests.PollingTimeout)) * time.Minute
intervalDuration := time.Duration(interval) * time.Second
start := time.Now()
Loop:
for {
_, err = h.Kube().RbacV1().RoleBindings(projectName).Get(context.TODO(), roleBindingName, metav1.GetOptions{})
elapsed := time.Since(start)
switch {
case err == nil:
// Success
break Loop
case strings.Contains(err.Error(), "forbidden"):
return err
default:
if elapsed < timeoutDuration {
log.Printf("Waiting %v for %s roleBinding to exist", (timeoutDuration - elapsed), roleBindingName)
time.Sleep(intervalDuration)
} else {
err = fmt.Errorf("Failed to get rolebinding %s before timeout", roleBindingName)
break Loop
}
}
}
return err
}
func pollLockFile(h *helper.H, namespace, operatorLockFile string) error {
// GetConfigMap polls for a configMap with a timeout
// to handle the case when a new cluster is up but the OLM has not yet
// finished deploying the operator
var err error
// interval is the duration in seconds between polls
// values here for humans
interval := 30
// convert time.Duration type
timeoutDuration := time.Duration(viper.GetFloat64(config.Tests.PollingTimeout)) * time.Minute
intervalDuration := time.Duration(interval) * time.Second
start := time.Now()
Loop:
for {
_, err = h.Kube().CoreV1().ConfigMaps(namespace).Get(context.TODO(), operatorLockFile, metav1.GetOptions{})
elapsed := time.Since(start)
switch {
case err == nil:
// Success
break Loop
case strings.Contains(err.Error(), "forbidden"):
return err
default:
if elapsed < timeoutDuration {
log.Printf("Waiting %v for %s configMap to exist", (timeoutDuration - elapsed), operatorLockFile)
time.Sleep(intervalDuration)
} else {
err = fmt.Errorf("Failed to get configMap %s before timeout", operatorLockFile)
break Loop
}
}
}
return err
}
func pollDeployment(h *helper.H, namespace, deploymentName string) (*appsv1.Deployment, error) {
// pollDeployment polls for a deployment with a timeout
// to handle the case when a new cluster is up but the OLM has not yet
// finished deploying the operator
var err error
var deployment *appsv1.Deployment
// interval is the duration in seconds between polls
// values here for humans
interval := 5
// convert time.Duration type
timeoutDuration := time.Duration(viper.GetFloat64(config.Tests.PollingTimeout)) * time.Minute
intervalDuration := time.Duration(interval) * time.Second
start := time.Now()
Loop:
for {
deployment, err = h.Kube().AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, metav1.GetOptions{})
elapsed := time.Since(start)
switch {
case err == nil:
// Success
break Loop
case strings.Contains(err.Error(), "forbidden"):
return nil, err
default:
if elapsed < timeoutDuration {
log.Printf("Waiting %v for %s deployment to exist", (timeoutDuration - elapsed), deploymentName)
time.Sleep(intervalDuration)
} else {
deployment = nil
err = fmt.Errorf("Failed to get %s Deployment before timeout", deploymentName)
break Loop
}
}
}
return deployment, err
}
func getReplacesCSV(h *helper.H, subscriptionNS string, csvDisplayName string, catalogSvcName string) (string, error) {
cmdTimeoutInSeconds := 60
cmdTestTemplate, err := templates.LoadTemplate("/assets/registry/replaces.template")
if err != nil {
panic(fmt.Sprintf("error while loading registry-replaces addon: %v", err))
}
// This is extremely crude, but saves making multiple grpcurl queries to know what
// channel the package is using
clusterProvider, err := providers.ClusterProvider()
environment := clusterProvider.Environment()
var packageChannel string
if strings.HasPrefix(environment, "prod") {
packageChannel = "production"
} else {
packageChannel = "staging"
}
registrySvcPort := "50051"
h.SetServiceAccount("system:serviceaccount:%s:cluster-admin")
r := h.RunnerWithNoCommand()
r.Name = fmt.Sprintf("csvq-%s", csvDisplayName)
Expect(err).NotTo(HaveOccurred())
values := struct {
Name string
OutputDir string
Namespace string
PackageName string
PackageChannel string
ServiceName string
ServicePort string
CA string
TokenFile string
Server string
}{
Name: r.Name,
OutputDir: runner.DefaultRunner.OutputDir,
Namespace: subscriptionNS,
PackageName: csvDisplayName,
PackageChannel: packageChannel,
ServiceName: catalogSvcName,
ServicePort: registrySvcPort,
Server: "https://kubernetes.default",
CA: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",
TokenFile: "/var/run/secrets/kubernetes.io/serviceaccount/token",
}
registryQueryCmd, err := h.ConvertTemplateToString(cmdTestTemplate, values)
Expect(err).NotTo(HaveOccurred())
r.Cmd = registryQueryCmd
// run tests
stopCh := make(chan struct{})
err = r.Run(cmdTimeoutInSeconds, stopCh)
Expect(err).NotTo(HaveOccurred())
// get results
results, err := r.RetrieveResults()
Expect(err).NotTo(HaveOccurred())
var result map[string]interface{}
err = json.Unmarshal(results["registry.json"], &result)
Expect(err).NotTo(HaveOccurred(), "error unmarshalling json from registry gatherer")
var csvresult map[string]interface{}
err = json.Unmarshal([]byte(fmt.Sprintf("%v", result["csvJson"])), &csvresult)
Expect(err).NotTo(HaveOccurred(), "error unmarshalling csv json from registry gatherer")
replacesCsv, ok := csvresult["spec"].(map[string]interface{})["replaces"]
Expect(ok).NotTo(BeFalse(), "cannot find 'replaces' clusterversion from registry gatherer")
return fmt.Sprintf("%v", replacesCsv), nil
}
func CheckUpgrade(h *helper.H, subNamespace string, subName string, packageName string, regServiceName string) {
checkUpgrade(h, subNamespace, subName, packageName, regServiceName)
}
func CheckPod(h *helper.H, namespace string, name string, gracePeriod int, maxAcceptedRestart int) {
checkPod(h, namespace, name, gracePeriod, maxAcceptedRestart)
}
func PollDeployment(h *helper.H, namespace, deploymentName string) (*appsv1.Deployment, error) {
return pollDeployment(h, namespace, deploymentName)
}