Skip to content

Commit c54dd54

Browse files
authored
Merge pull request #30129 from dgoodwin/repair-inclusterapiserver-on-hcp
OCPBUGS-60530: Fix panics in inclusterapi disruption during ROSA jobs
2 parents 1bac1f6 + 8ca907b commit c54dd54

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/monitortests/kubeapiserver/disruptioninclusterapiserver/monitortest.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ func (i *InvariantInClusterDisruption) StartCollection(ctx context.Context, admi
312312
_, hcpNamespace, err := exutil.GetHypershiftManagementClusterConfigAndNamespace()
313313
if err != nil {
314314
logrus.WithError(err).Error("failed to get hypershift management cluster config and namespace")
315+
return err
315316
}
316317

317318
// For Hypershift, only skip if it's specifically ARO HCP
@@ -351,6 +352,7 @@ func (i *InvariantInClusterDisruption) StartCollection(ctx context.Context, admi
351352
i.adminRESTConfig = adminRESTConfig
352353
i.kubeClient, err = kubernetes.NewForConfig(i.adminRESTConfig)
353354
if err != nil {
355+
log.WithError(err).Error("error constructing kube client in disruptionclusterapiserver monitortest")
354356
return fmt.Errorf("error constructing kube client: %v", err)
355357
}
356358

@@ -497,6 +499,10 @@ func (i *InvariantInClusterDisruption) Cleanup(ctx context.Context) error {
497499
return nil
498500
}
499501

502+
if i.kubeClient == nil {
503+
return nil
504+
}
505+
500506
log.Infof("removing monitoring namespace")
501507
nsClient := i.kubeClient.CoreV1().Namespaces()
502508
err := nsClient.Delete(ctx, i.namespaceName, metav1.DeleteOptions{})

test/extended/util/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ func NewCLIForMonitorTest(project string) *CLI {
226226
// allowed inside an `It` block. `AfterEach` and `BeforeEach` are not allowed there though.
227227
func NewHypershiftManagementCLI(project string) *CLI {
228228
kubeconfig, _, err := GetHypershiftManagementClusterConfigAndNamespace()
229+
// TODO: this is assuming to be executing within ginkgo, which is not always the case (monitortests)
229230
o.Expect(err).NotTo(o.HaveOccurred())
230231
return &CLI{
231232
kubeFramework: &framework.Framework{

0 commit comments

Comments
 (0)