Closed
Description
hi,
When I use latest https://github.com/kcp-dev/controller-runtime, the controller runtime client List is fails with error "Index with name cluster does not exist".
Steps to reproduce:
in the project https://github.com/kcp-dev/controller-runtime-example, point to latest kcp-dev/controller-runtime, make change to compile the code and test the controller-runtime-example. you can use this branch to test https://github.com/prembhaskal/kcp-dev-controller-runtime-example/tree/client-list-issue
% export KUBECONFIG=/tmp/kcp.kubeconfig
% kubectl ws create prem-org --type organization
% kubectl ws prem-org
% cat /tmp/data-api-binding.yaml
apiVersion: apis.kcp.io/v1alpha1
kind: APIBinding
metadata:
name: data.my.domain
spec:
reference:
export:
name: data.my.domain
path: root
permissionClaims:
- resource: "secrets"
all: true
state: Accepted
- resource: "configmaps"
all: true
state: Accepted
- resource: "namespaces"
all: true
state: Accepted
% kubectl apply -f /tmp/data-api-binding.yaml
% # create configmap with needed labels and data, check the output of the controller and see if anything wierd happens there.
% cat /tmp/test-cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: syncer-config
labels:
name: syncer-config
data:
agent-target-cluster: "root:045aa3c9-017c-4824-a410-561b1e2ddef3:soumik-demo:cg-1"
agent-target-name: "downstream"
agent-target-namespace: "default"
upstream-context: base
secretData: syncer-config
% kubectl apply -f /tmp/test-cm.yaml
error seen
2024-01-29T23:23:54+05:30 INFO Update: updated configMap {"controller": "configmap", "controllerGroup": "", "controllerKind": "ConfigMap", "ConfigMap": {"name":"syncer-config","namespace":"default"}, "namespace": "default", "name": "syncer-config", "reconcileID": "38ae15cb-9d1c-433d-a3d6-645970009745", "cluster": "29qso51vovx9kz1x"}
2024-01-29T23:23:54+05:30 INFO Get: retrieved configMap {"controller": "configmap", "controllerGroup": "", "controllerKind": "ConfigMap", "ConfigMap": {"name":"syncer-config","namespace":"default"}, "namespace": "default", "name": "syncer-config", "reconcileID": "2b6493be-d719-4b86-9870-2ee1aa72fcea", "cluster": "29qso51vovx9kz1x"}
2024-01-29T23:23:54+05:30 ERROR unable to list configmaps {"controller": "configmap", "controllerGroup": "", "controllerKind": "ConfigMap", "ConfigMap": {"name":"syncer-config","namespace":"default"}, "namespace": "default", "name": "syncer-config", "reconcileID": "2b6493be-d719-4b86-9870-2ee1aa72fcea", "cluster": "29qso51vovx9kz1x", "error": "Index with name cluster does not exist"}
github.com/kcp-dev/controller-runtime-example/controllers.(*ConfigMapReconciler).Reconcile
/Users/bpremkumar/code/github.com/prembhaskal/kcp-dev-controller-runtime-example/controllers/configmap_controller.go:87
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
/Users/bpremkumar/go/pkg/mod/github.com/kcp-dev/controller-runtime@v0.16.3-0.20231012112853-49fa562ad688/pkg/internal/controller/controller.go:119
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
/Users/bpremkumar/go/pkg/mod/github.com/kcp-dev/controller-runtime@v0.16.3-0.20231012112853-49fa562ad688/pkg/internal/controller/controller.go:316
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/Users/bpremkumar/go/pkg/mod/github.com/kcp-dev/controller-runtime@v0.16.3-0.20231012112853-49fa562ad688/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/Users/bpremkumar/go/pkg/mod/github.com/kcp-dev/controller-runtime@v0.16.3-0.20231012112853-49fa562ad688/pkg/internal/controller/controller.go:227
I had created a ticket here kcp-dev/controller-runtime-example#38 but i think the issue and fix belongs more here.
Please let me know so that i can close the ticket on example repo and continue it here.
Metadata
Metadata
Assignees
Labels
No labels