Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

pass APIExport name as first arg to manager #9

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

robinbobbitt
Copy link
Contributor

Currently if you deploy the controller as documented in the README, the manager logs show the following failure:

1.6553980427444549e+09	ERROR	setup	error looking up virtual workspace URL	{"api-export": "--health-probe-bind-address=:8081", "error": "error getting APIExport \"--health-probe-bind-address=:8081\": apiexports.apis.kcp.dev \"--health-probe-bind-address=:8081\" is forbidden: User \"system:serviceaccount:controller-runtime-example-system:controller-runtime-example-controller-manager\" cannot get resource \"apiexports\" in API group \"apis.kcp.dev\" at the cluster scope"}

Note the wrong name for APIExport. The controller expects the APIExport name as the first arg to the manager container.

Signed-off-by: Robin Y Bobbitt [email protected]

@ncdc
Copy link
Member

ncdc commented Jun 16, 2022

@robinbobbitt thanks! If you wanted, we could do something like this, to support variable replacement instead of hard-coding the project name:

diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml
index 6930af0..6224b59 100644
--- a/config/default/kustomization.yaml
+++ b/config/default/kustomization.yaml
@@ -72,3 +72,6 @@ vars:
 #    kind: Service
 #    version: v1
 #    name: webhook-service
+
+configurations:
+  - kustomizeconfig.yaml
diff --git a/config/default/kustomizeconfig.yaml b/config/default/kustomizeconfig.yaml
new file mode 100644
index 0000000..b629681
--- /dev/null
+++ b/config/default/kustomizeconfig.yaml
@@ -0,0 +1,5 @@
+nameReference:
+- kind: APIExport
+  fieldSpecs:
+    - kind: Deployment
+      path: spec/template/spec/containers/args
diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml
index 131a314..7baab3a 100644
--- a/config/default/manager_auth_proxy_patch.yaml
+++ b/config/default/manager_auth_proxy_patch.yaml
@@ -32,3 +32,4 @@ spec:
         - "--health-probe-bind-address=:8081"
         - "--metrics-bind-address=127.0.0.1:8080"
         - "--leader-elect"
+        - data.my.domain

@robinbobbitt
Copy link
Contributor Author

Thanks @ncdc - will take a look!

@robinbobbitt
Copy link
Contributor Author

Thanks for the suggestion @ncdc .. Ready for another look.

@ncdc ncdc merged commit cbb3657 into kcp-dev:main Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants