Skip to content

Commit e77fae7

Browse files
work
Signed-off-by: Steve Kuznetsov <[email protected]>
1 parent 09292e4 commit e77fae7

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

pkg/controller/install/deployment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ func (i *StrategyDeploymentInstaller) deploymentForSpec(name string, spec appsv1
152152
dep.Spec.Template.SetAnnotations(annotations)
153153

154154
// Set custom labels before CSV owner labels
155+
dep.SetLabels(specLabels)
155156
if dep.Labels == nil {
156157
dep.Labels = map[string]string{}
157158
}
158159
dep.Labels[OLMManagedLabelKey] = OLMManagedLabelValue
159-
dep.SetLabels(specLabels)
160160

161161
ownerutil.AddNonBlockingOwner(dep, i.owner)
162162
ownerutil.AddOwnerLabelsForKind(dep, i.owner, v1alpha1.ClusterServiceVersionKind)

pkg/controller/install/deployment_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ func TestInstallStrategyDeploymentCheckInstallErrors(t *testing.T) {
353353
dep.Spec.Template.SetAnnotations(map[string]string{"test": "annotation"})
354354
dep.Spec.RevisionHistoryLimit = &revisionHistoryLimit
355355
dep.SetLabels(labels.CloneAndAddLabel(dep.ObjectMeta.GetLabels(), DeploymentSpecHashLabelKey, HashDeploymentSpec(dep.Spec)))
356+
dep.Labels[OLMManagedLabelKey] = OLMManagedLabelValue
356357
dep.Status.Conditions = append(dep.Status.Conditions, appsv1.DeploymentCondition{
357358
Type: appsv1.DeploymentAvailable,
358359
Status: corev1.ConditionTrue,

test/e2e/catalog_e2e_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
783783
Expect(err).ShouldNot(HaveOccurred())
784784

785785
By("Wait for the CatalogSource to be ready")
786-
source, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
786+
source, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced())
787787
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")
788788

789789
// the gRPC endpoints are not exposed from the pod, and there's no simple way to get at them -

test/e2e/csv_e2e_test.go

+22-1
Original file line numberDiff line numberDiff line change
@@ -4402,21 +4402,43 @@ func newMockExtServerDeployment(labelName string, mGVKs []mockGroupVersionKind)
44024402
type csvConditionChecker func(csv *operatorsv1alpha1.ClusterServiceVersion) bool
44034403

44044404
func buildCSVConditionChecker(phases ...operatorsv1alpha1.ClusterServiceVersionPhase) csvConditionChecker {
4405+
var lastPhase operatorsv1alpha1.ClusterServiceVersionPhase
4406+
var lastReason operatorsv1alpha1.ConditionReason
4407+
var lastMessage string
4408+
lastTime := time.Now()
4409+
44054410
return func(csv *operatorsv1alpha1.ClusterServiceVersion) bool {
44064411
conditionMet := false
44074412
for _, phase := range phases {
44084413
conditionMet = conditionMet || csv.Status.Phase == phase
44094414
}
4415+
phase, reason, message := csv.Status.Phase, csv.Status.Reason, csv.Status.Message
4416+
if phase != lastPhase || reason != lastReason || message != lastMessage {
4417+
ctx.Ctx().Logf("waited %s for CSV %s/%s: to be in phases %s, in phase %s (%s): %s", time.Since(lastTime), csv.Namespace, csv.Name, phases, phase, reason, message)
4418+
lastPhase, lastReason, lastMessage = phase, reason, message
4419+
lastTime = time.Now()
4420+
}
44104421
return conditionMet
44114422
}
44124423
}
44134424

44144425
func buildCSVReasonChecker(reasons ...operatorsv1alpha1.ConditionReason) csvConditionChecker {
4426+
var lastPhase operatorsv1alpha1.ClusterServiceVersionPhase
4427+
var lastReason operatorsv1alpha1.ConditionReason
4428+
var lastMessage string
4429+
lastTime := time.Now()
4430+
44154431
return func(csv *operatorsv1alpha1.ClusterServiceVersion) bool {
44164432
conditionMet := false
44174433
for _, reason := range reasons {
44184434
conditionMet = conditionMet || csv.Status.Reason == reason
44194435
}
4436+
phase, reason, message := csv.Status.Phase, csv.Status.Reason, csv.Status.Message
4437+
if phase != lastPhase || reason != lastReason || message != lastMessage {
4438+
ctx.Ctx().Logf("waited %s for CSV %s/%s: to have reasons %s, in phase %s (%s): %s", time.Since(lastTime), csv.Namespace, csv.Name, reasons, phase, reason, message)
4439+
lastPhase, lastReason, lastMessage = phase, reason, message
4440+
lastTime = time.Now()
4441+
}
44204442
return conditionMet
44214443
}
44224444
}
@@ -4438,7 +4460,6 @@ func fetchCSV(c versioned.Interface, name, namespace string, checker csvConditio
44384460
if err != nil {
44394461
return false, err
44404462
}
4441-
ctx.Ctx().Logf("CSV %s/%s: phase %s (%s): %s", namespace, name, fetchedCSV.Status.Phase, fetchedCSV.Status.Reason, fetchedCSV.Status.Message)
44424463
return checker(fetchedCSV), nil
44434464
}).Should(BeTrue())
44444465

0 commit comments

Comments
 (0)