F5Networks / k8s-bigip-ctlr

Repository for F5 Container Ingress Services for Kubernetes & OpenShift.
Apache License 2.0
357 stars 195 forks source link

CIS 2.15 crashes due to interface conversion panic #3312

Closed mikejoh closed 4 months ago

mikejoh commented 7 months ago

Setup Details

CIS Version: 2.15.0 Build: f5networks/k8s-bigip-ctlr:2.15.0 BIGIP Version: 15.1.7 Build 0.0.6 Final AS3 Version: 3.44 Agent Mode: AS3 Orchestration: K8S Orchestration Version: v1.27.11 Pool Mode: NodePort Additional Setup details: N/A

Description

During normal operations, for no obvious reason, the k8s-bigip-ctlr crashed with the following stack trace:

2024/02/28 08:47:00 [DEBUG] [AS3] posting request with taskId to https://<F5 hostname>/mgmt/shared/appsvcs/task/28ce64db-748d-4a5c-993e-7dd8f2f2981f
panic: interface conversion: interface {} is nil, not string

goroutine 15 [running]:
github.com/F5Networks/k8s-bigip-ctlr/v2/pkg/controller.(*PostManager).getTenantConfigStatus(0xc000112b40, {0xc0021e2060, 0x24})
    /go/src/github.com/F5Networks/k8s-bigip-ctlr/pkg/controller/postManager.go:239 +0xabc
github.com/F5Networks/k8s-bigip-ctlr/v2/pkg/controller.(*PostManager).pollTenantStatus(0xc000112b40)
    /go/src/github.com/F5Networks/k8s-bigip-ctlr/pkg/controller/postManager.go:624 +0x430
github.com/F5Networks/k8s-bigip-ctlr/v2/pkg/controller.(*Agent).postTenantsDeclaration(0xc000282100, {0xc00215c000, 0x4f5ef}, {0xc0018b27e0, 0x1, 0xc00102c990, 0x3, 0x27}, {0xc00222f6d0, 0x1, ...})
    /go/src/github.com/F5Networks/k8s-bigip-ctlr/pkg/controller/backend.go:346 +0x2ee
github.com/F5Networks/k8s-bigip-ctlr/v2/pkg/controller.(*Agent).agentWorker(0xc000282100)
    /go/src/github.com/F5Networks/k8s-bigip-ctlr/pkg/controller/backend.go:310 +0x6bd
created by github.com/F5Networks/k8s-bigip-ctlr/v2/pkg/controller.NewAgent
    /go/src/github.com/F5Networks/k8s-bigip-ctlr/pkg/controller/backend.go:89 +0x5b2

This is a similar if not exactly the same problem reported here: https://github.com/F5Networks/k8s-bigip-ctlr/issues/2514. That issue was closed after the reporter had restarted services in the F5 BIG-IP, the reporter also noted that accessing the URL referenced in the log (before panicing) resulted in a 5xx error.

Steps To Reproduce

I haven't found a way of reproducing this yet.

Expected Result

No panic due to interface conversion.

Actual Result

N/A

Diagnostic Information

N/A

Observations (if any)

The code referenced in the stack trace where the panic occurs is here: https://github.com/F5Networks/k8s-bigip-ctlr/blob/60ca50f145fc64f68d757cfa8c2ec9cdb35f0f99/pkg/controller/postManager.go#L512-L573

AFAICT there's a couple of places where we try to perform a type assertion, if there are assertions on nil interface values the code will panic.

trinaths commented 7 months ago

Created [CONTCNTR-4634] for internal tracking.

trinaths commented 4 months ago

Fixed in 2.16