banzaicloud/koperator

Failed to list KafkaTopics

jkurek1 opened this issue · 3 comments

Describe the bug
Topic creation does not work in version v0.20.1. In version v.0.20.0 works perfectly. Getting error:

admission webhook "kafkatopics.kafka.banzaicloud.io" denied the request: API failure while retrieving KafkaTopic list, please try again

Operator manager logs:

{"level":"info","ts":"2022-01-03T22:57:40.834Z","logger":"webhooks","msg":"AdmissionReview for Kind=kafka.banzaicloud.io/v1alpha1, Kind=KafkaTopic, Namespace=kafka Name=test-topic UID=5bc73149-b92b-4325-bc88-ad406210e41e patchOperation=CREATE UserInfo={masterclient  [system:masters system:authenticated] map[]}"}
{"level":"info","ts":"2022-01-03T22:57:40.834Z","logger":"webhooks","msg":"Doing pre-admission validation of kafka topic test-topic"}
{"level":"info","ts":"2022-01-03T22:57:40.834Z","logger":"webhooks","msg":"failed to list KafkaTopics"}

Steps to reproduce the issue:
Create new topic:

apiVersion: kafka.banzaicloud.io/v1alpha1
kind: KafkaTopic
metadata:
  name: test-topic
  namespace: kafka
spec:
  clusterRef:
    name: kafka
  name: test-topic
  partitions: 3
  replicationFactor: 2
  config:
    "retention.ms": "604800000"
    "cleanup.policy": "delete"

Expected behavior
New topic should be created.

Screenshots

Additional context
version v0.20.1

Thanks for opening this issue, can you please share the details of your update process?

@baluchicken We have the same problem. Our update process is based on using ArgoCD to sync the Helm chart, so we updated the operator image version in values.yaml and the chart version in requirements.yaml to 0.20.1 and then synched. When sync was made, CRD:s, operator and cruise-control was re-deployed. After that, we can't create topic any longer.

We have kube-rbac-proxy v0.8.0 in values.yaml and ghcr.io/banzaicloud/kafka:2.13-3.0.0 in KafkaCluster definition. The Kubernetes version we are running is 1.21.5.

Also, we tried to upgrade to 0.20.2 to see if that helped, but that only gave us a different set of error messages:

{"level":"info","ts":"2022-03-15T10:40:53.131Z","logger":"webhooks","msg":"AdmissionReview for Kind=kafka.banzaicloud.io/v1alpha1, Kind=KafkaTopic, Namespace=kafka Name=avanet.dlq.measurement UID=83af9f8b-4126-48da-b3bd-611eb2a05569 patchOperation=CREATE UserInfo={system:serviceaccount:argocd:argocd-application-controller 082795a4-9471-417b-b347-a89167e5fce0 [system:serviceaccounts system:serviceaccounts:argocd system:authenticated] map[authentication.kubernetes.io/pod-name:[argocd-application-controller-0] authentication.kubernetes.io/pod-uid:[8ebc0fad-7b7b-417b-822a-024f725c1eeb]]}"}
{"level":"info","ts":"2022-03-15T10:40:53.131Z","logger":"webhooks","msg":"Doing pre-admission validation of kafka topic avanet.dlq.measurement"}
{"level":"error","ts":"2022-03-15T10:40:53.132Z","logger":"webhooks","msg":"couldn't list KafkaTopic custom resources","error":"Index with name field:spec.name does not exist","stacktrace":"github.com/banzaicloud/koperator/pkg/webhook.(*webhookServer).validate\n\t/workspace/pkg/webhook/request.go:48\ngithub.com/banzaicloud/koperator/pkg/webhook.(*webhookServer).serve\n\t/workspace/pkg/webhook/request.go:85\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2425\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:40\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:101\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:76\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2425\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2879\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1930"}

Having checked the source code, it appears as if the offending commit may be: dc5c2b9#diff-fcb303ec23b243d7e673b68811084412b2c1ceab0274b00dad74604166bc0d30

@avamonitoring can you show what values do you pass to the Helm chart for deploying koperator?