// rootCauseRe is a regular expression that matches known failure root causes
varrootCauseRe=regexp.MustCompile(`^error: |eviction manager: pods.* evicted|unknown flag: --|forbidden.*no providers available|eviction manager:.*evicted|tls: bad certificate|kubelet.*no API client|kubelet.*No api server|STDIN.*127.0.0.1:8080|failed to create listener|address already in use|unable to evict any pods|eviction manager: unexpected error`)
// rootCauses are regular expressions that match known failures
varrootCauses=[]string{
`^error: `,
`eviction manager: pods.* evicted`,
`unknown flag: --`,
`forbidden.*no providers available`,
`eviction manager:.*evicted`,
`tls: bad certificate`,
`kubelet.*no API client`,
`kubelet.*No api server`,
`STDIN.*127.0.0.1:8080`,
`failed to create listener`,
`address already in use`,
`unable to evict any pods`,
`eviction manager: unexpected error`,
`Resetting AnonymousAuth to false`,
`CrashLoopBackOff`,
`Unable to register node.*forbidden`,
`Failed to initialize CSINodeInfo.*forbidden`,
`Failed to admit pod`,
`failed to "StartContainer"`,
`kubelet.*forbidden.*cannot \w+ resource`,
`leases.*forbidden.*cannot \w+ resource`,
}
// rootCauseRe combines rootCauses into a single regex
{"no-objects-passed-to-apply #4010",false,"error: no objects passed to apply"},
{"bad-certificate #4251",true,"log.go:172] http: TLS handshake error from 127.0.0.1:49200: remote error: tls: bad certificate"},
{"ephemeral-eviction #5355",true," eviction_manager.go:419] eviction manager: unexpected error when attempting to reduce ephemeral-storage pressure: wanted to free 9223372036854775807 bytes, but freed 0 bytes space with errors in image deletion"},
{"anonymous-auth",true,"AnonymousAuth is not allowed with the AlwaysAllow authorizer. Resetting AnonymousAuth to false. You should use a different authorizer"},
{"disk-pressure #7073",true,"eviction_manager.go:159] Failed to admit pod kindnet-jpzzf_kube-system(b63b1ee0-0fc6-428f-8e67-e357464f579c) - node has conditions: [DiskPressure]"},
{"csi timeout",true,`Failed to initialize CSINodeInfo: error updating CSINode annotation: timed out waiting for the condition; caused by: csinodes.storage.k8s.io "m01" is forbidden: User "system:node:m01" cannot get resource "csinodes" in API group "storage.k8s.io" at the cluster scope`},
{"node registration permissions",true,`Unable to register node "m01" with API server: nodes is forbidden: User "system:node:m01" cannot create resource "nodes" in API group "" at the cluster scope`},
{"regular kubelet refused",false,`kubelet_node_status.go:92] Unable to register node "m01" with API server: Post https://localhost:8443/api/v1/nodes: dial tcp 127.0.0.1:8443: connect: connection refused`},
{"regular csi refused",false,`Failed to initialize CSINodeInfo: error updating CSINode annotation: timed out waiting for the condition; caused by: Get https://localhost:8443/apis/storage.k8s.io/v1/csinodes/m01: dial tcp 127.0.0.1:8443: connect: connection refused`},
{"apiserver crashloop",true,`pod_workers.go:191] Error syncing pod 9f8ee739bd14e8733f807eb2be99768f ("kube-apiserver-m01_kube-system(9f8ee739bd14e8733f807eb2be99768f)"), skipping: failed to "StartContainer" for "kube-apiserver" with CrashLoopBackOff: "back-off 10s restarting failed container=kube-apiserver pod=kube-apiserver-m01_kube-system(9f8ee739bd14e8733f807eb2be99768f)`},
{"kubelet node timeout",false,`failed to ensure node lease exists, will retry in 6.4s, error: Get https://localhost:8443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/m01?timeout=10s: dial tcp 127.0.0.1:8443: connect: connection refused`},
{"rbac misconfiguration",true,`leases.coordination.k8s.io "m01" is forbidden: User "system:node:m01" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "kube-node-lease"`},
{"regular controller init",false,`error retrieving resource lock kube-system/kube-controller-manager: endpoints "kube-controller-manager" is forbidden: User "system:kube-controller-manager" cannot get resource "endpoints" in API group "" in the namespace "kube-system"`},
{"regular scheduler services init",false,` k8s.io/client-go/informers/factory.go:135: Failed to list *v1.Service: services is forbidden: User "system:kube-scheduler" cannot list resource "services" in API group "" at the cluster scope`},
{"regular scheduler nodes init",false,`k8s.io/client-go/informers/factory.go:135: Failed to list *v1.Node: nodes is forbidden: User "system:kube-scheduler" cannot list resource "nodes" in API group "" at the cluster scope`},
{"kubelet rbac fail",true,`k8s.io/kubernetes/pkg/kubelet/kubelet.go:526: Failed to list *v1.Node: nodes "m01" is forbidden: User "system:node:m01" cannot list resource "nodes" in API group "" at the cluster scope`},