GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
894 stars 226 forks source link

Postubmit tests fail for direct controller that haven't implemented Export #2301

Open ziyue-101 opened 3 months ago

ziyue-101 commented 3 months ago

Checklist

Bug Description

In the test, Get returns nil when a direct resource doesn't implement Export, and The Get is used in here to get the GCP unstructured object that later got dereferenced here. This is causing the gkehub direct controller,which doesn't have Export, to fail the post submit tests with nil pointer dereference. I suspect the issue is affecting all direct controllers.

Additional Diagnostic Information

N/A

Kubernetes Cluster Version

N/A

Config Connector Version

N/A

Config Connector Mode

namespaced mode (default)

Log Output

  --- FAIL: TestCreateNoChangeUpdateDelete/gkehub/basic-meshgkehubfeaturemembership (869.71s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x50e2e17]
goroutine 957 [running]:
testing.tRunner.func1.2({0x5749600, 0x9ad2920})
    /home/prow/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.linux-amd64/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
    /home/prow/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.linux-amd64/src/testing/testing.go:1634 +0x377
panic({0x5749600?, 0x9ad2920?})
    /home/prow/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.linux-amd64/src/runtime/panic.go:770 +0x132
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/dynamic_test.testUpdate({_, _}, _, {0xc0082db618, 0xc0082db630, {0xc007c96940, 0x8, 0x8}, {{{0xc0045aa330, 0x1c}, ...}, ...}, ...}, ...)
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/controller/dynamic/dynamic_controller_integration_test.go:415 +0xcd7
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/dynamic_test.testReconcileCreateNoChangeUpdateDelete({_, _}, _, {0xc0082db618, 0xc0082db630, {0xc007c96940, 0x8, 0x8}, {{{0xc0045aa330, 0x1c}, ...}, ...}, ...}, ...)
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/controller/dynamic/dynamic_controller_integration_test.go:570 +0x430
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/dynamic_test.TestCreateNoChangeUpdateDelete.func2({_, _}, _, {0xc0082db618, 0xc0082db630, {0xc007c96940, 0x8, 0x8}, {{{0xc0045aa330, 0x1c}, ...}, ...}, ...}, ...)
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/controller/dynamic/dynamic_controller_integration_test.go:213 +0x170
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/runner.RunAllWithDependenciesCreatedButNotObject.func1({_, _}, _, {0xc0082db618, 0xc0082db630, {0xc007c96940, 0x8, 0x8}, {{{0xc0045aa330, 0x1c}, ...}, ...}, ...}, ...)
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/test/runner/runner.go:84 +0x12e
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/runner.RunAll.func2({0x6b95080, 0xc005164000}, 0xc002700820, {{{0xc0045aa330, 0x1c}, {0xc0045aa34d, 0x7}, {0xc0045942d0, 0x17}}, {0xc0020a49dc, ...}, ...})
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/test/runner/runner.go:98 +0x2d0
github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture.runTestCase.func1(0xc002700820)
    /home/prow/go/src/cnrm.googlesource.com/cnrm/pkg/test/resourcefixture/test_runner.go:81 +0x11e
testing.tRunner(0xc002700820, 0xc002713340)
    /home/prow/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.linux-amd64/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 954
    /home/prow/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.linux-amd64/src/testing/testing.go:1742 +0x390
FAIL    github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/dynamic  881.050s

Steps to reproduce the issue

Check the test probe

YAML snippets

No response

ziyue-101 commented 3 months ago

/assign @justinsb Hi, Justin, as the current KCC oncall, I am assigning the bug to you, feel free to triage.

gemmahou commented 2 months ago

I plan to skip this test for now: https://github.com/GoogleCloudPlatform/k8s-config-connector/pull/2455