Skip to content

Controller-runtime and custom cache #25

Closed
@fgiloux

Description

@fgiloux

Trying to setup a custom cache to filter APIBindings it seems that the resulting URL is not properly processed.

options.NewCache = cache.BuilderWithOptions(cache.Options{
		SelectorsByObject: cache.SelectorsByObject{
			&apisv1alpha1.APIBinding{}: {
				Field: fields.SelectorFromSet(fields.Set{
					"spec.reference.workspace.exportName": "settings-configuration.pipeline-service.io",
					"spec.reference.workspace.path":       "root:pipeline-service:management",
				}),
			},
		},
	})

gives

W0909 17:14:34.487460 1472564 reflector.go:324] pkg/mod/k8s.io/client-go@v0.24.3/tools/cache/reflector.go:167: failed to list *v1alpha1.APIBinding: forbidden: User "kcp-admin" cannot get path "/services/apiexport/root:pipeline-service:management/settings-configuration.pipeline-service.io/apis/apis.kcp.dev/v1alpha1/apibindings": Path not resolved to a valid virtual workspace
E0909 17:14:34.487484 1472564 reflector.go:138] pkg/mod/k8s.io/client-go@v0.24.3/tools/cache/reflector.go:167: Failed to watch *v1alpha1.APIBinding: failed to list *v1alpha1.APIBinding: forbidden: User "kcp-admin" cannot get path "/services/apiexport/root:pipeline-service:management/settings-configuration.pipeline-service.io/apis/apis.kcp.dev/v1alpha1/apibindings": Path not resolved to a valid virtual workspace

and also for other resources that my controller owns

W0909 17:14:34.050696 1472564 reflector.go:324] pkg/mod/k8s.io/client-go@v0.24.3/tools/cache/reflector.go:167: failed to list *v1.NetworkPolicy: forbidden: User "kcp-admin" cannot get path "/services/apiexport/root:pipeline-service:management/settings-configuration.pipeline-service.io/apis/networking.k8s.io/v1/networkpolicies": Path not resolved to a valid virtual workspace
E0909 17:14:34.050739 1472564 reflector.go:138] pkg/mod/k8s.io/client-go@v0.24.3/tools/cache/reflector.go:167: Failed to watch *v1.NetworkPolicy: failed to list *v1.NetworkPolicy: forbidden: User "kcp-admin" cannot get path "/services/apiexport/root:pipeline-service:management/settings-configuration.pipeline-service.io/apis/networking.k8s.io/v1/networkpolicies": Path not resolved to a valid virtual workspace

Without custom cache it works and the url is

https://xxx.xxx.xxx.xxx:6443/services/apiexport/root:pipeline-service:management/settings-configuration.pipeline-service.io"

I haven't had time to investigate and I am not excluding that I did something wrong but this is the only modification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions