From eac083b86edbfd6e1b8d3bd5ef0d70c2384e65e3 Mon Sep 17 00:00:00 2001 From: vincent-pli Date: Sat, 17 Sep 2022 19:38:30 +0800 Subject: [PATCH] Add APIBinding to make controller work --- Makefile | 8 +------- {test/e2e => config/kcp}/apibinding.yaml | 8 +++++--- config/kcp/kustomization.yaml | 1 + config/kcp/kustomizeconfig.yaml | 5 +++++ 4 files changed, 12 insertions(+), 10 deletions(-) rename {test/e2e => config/kcp}/apibinding.yaml (64%) diff --git a/Makefile b/Makefile index 76deb15..22aa8e9 100644 --- a/Makefile +++ b/Makefile @@ -127,15 +127,9 @@ run-test-e2e: ## Run end-to-end tests on a cluster. .PHONY: ready-deployment ready-deployment: KUBECONFIG = $(ARTIFACT_DIR)/kcp.kubeconfig -ready-deployment: kind-image install deploy apibinding ## Deploy the controller-manager and wait for it to be ready. +ready-deployment: kind-image install deploy ## Deploy the controller-manager and wait for it to be ready. $(KCP_KUBECTL) --namespace "controller-runtime-example-system" rollout status deployment/controller-runtime-example-controller-manager -# TODO(skuznets|ncdc): this APIBinding is not needed, but here only to work around https://github.com/kcp-dev/kcp/issues/1183 - remove it once that is fixed -.PHONY: apibinding -apibinding: - $( eval WORKSPACE = $(shell $(KCP_KUBECTL) kcp workspace . --short)) - sed 's/WORKSPACE/$(WORKSPACE)/' ./test/e2e/apibinding.yaml | $(KCP_KUBECTL) apply -f - - $(KCP_KUBECTL) wait --for=condition=Ready apibinding/data.my.domain .PHONY: kind-image kind-image: docker-build ## Load the controller-manager image into the kind cluster. diff --git a/test/e2e/apibinding.yaml b/config/kcp/apibinding.yaml similarity index 64% rename from test/e2e/apibinding.yaml rename to config/kcp/apibinding.yaml index d2ba7fa..891309d 100644 --- a/test/e2e/apibinding.yaml +++ b/config/kcp/apibinding.yaml @@ -5,9 +5,11 @@ metadata: spec: reference: workspace: - path: WORKSPACE exportName: data.my.domain - acceptedPermissionClaims: + permissionClaims: - resource: "secrets" + state: "Accepted" - resource: "configmaps" - - resource: "namespaces" \ No newline at end of file + state: "Accepted" + - resource: "namespaces" + state: "Accepted" \ No newline at end of file diff --git a/config/kcp/kustomization.yaml b/config/kcp/kustomization.yaml index 2d402b8..1a515de 100644 --- a/config/kcp/kustomization.yaml +++ b/config/kcp/kustomization.yaml @@ -3,6 +3,7 @@ resources: - apiexport.yaml - clusterrole.yaml - clusterrolebinding.yaml + - apibinding.yaml configurations: - kustomizeconfig.yaml diff --git a/config/kcp/kustomizeconfig.yaml b/config/kcp/kustomizeconfig.yaml index cfd8094..c23b66e 100644 --- a/config/kcp/kustomizeconfig.yaml +++ b/config/kcp/kustomizeconfig.yaml @@ -3,3 +3,8 @@ nameReference: fieldSpecs: - kind: APIExport path: spec/latestResourceSchemas +- kind: APIExport + fieldSpecs: + - kind: APIBinding + path: spec/reference/workspace/exportName +