Skip to content

Commit 7014c0c

Browse files
mjudeikisntnn
authored andcommitted
Move kcp/ to contrib/kcp/
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com> Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
1 parent d9225a4 commit 7014c0c

40 files changed

Lines changed: 732 additions & 39 deletions

kcp/Makefile renamed to contrib/kcp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SHELL := /usr/bin/env bash -e
1818
GO_INSTALL = ../hack/go-install.sh
1919

2020
ROOT_DIR=$(abspath ..)
21-
TOOLS_DIR=../hack/tools
21+
TOOLS_DIR=../../hack/tools
2222
TOOLS_GOBIN_DIR := $(abspath $(TOOLS_DIR))
2323
GOBIN_DIR=$(abspath ../bin )
2424
PATH := $(GOBIN_DIR):$(TOOLS_GOBIN_DIR):$(PATH)

kcp/README.md renamed to contrib/kcp/README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# kcp
1+
# kcp
22

3-
kcp folder contains isolated set of tooling to bootstrap the kube-bind to allow it to work with kcp instance.
3+
kcp folder contains isolated set of tooling to bootstrap the kube-bind to allow it to work with kcp instance.
44
It is split into separate package to avoid vendoring pollution.
55

6-
kcp requires initial setup to be run before it can be used.
6+
kcp requires initial setup to be run before it can be used.
77
This includes setting up workspace/provider and setting up all the APIResourceSchemas and APIExports.
88

99
It was its own GO module to avoid kcp dependencies in the main kube-bind module.
@@ -23,18 +23,19 @@ It will do the following:
2323

2424
# How to run
2525

26-
1. Start kcp
27-
2. Bootstrap kcp:
26+
1. Start dex
27+
2. Start kcp
28+
3. Bootstrap kcp:
2829
```bash
2930
cp .kcp/admin.kubeconfig .kcp/backend.kubeconfig
3031
export KUBECONFIG=.kcp/backend.kubeconfig
3132
./bin/kcp-init --kcp-kubeconfig $KUBECONFIG
3233
```
33-
3. Run the backend:
34+
4. Run the backend:
3435
```
3536
k ws use :root:kube-bind
3637
37-
bin/backend \
38+
./bin/backend \
3839
--multicluster-runtime-provider kcp \
3940
--server-url=$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}") \
4041
--oidc-issuer-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
@@ -49,15 +50,15 @@ bin/backend \
4950
```
5051

5152

52-
4. Copy the kubeconfig to the provider and create provider workspace:
53+
5. Copy the kubeconfig to the provider and create provider workspace:
5354
```bash
5455
cp .kcp/admin.kubeconfig .kcp/provider.kubeconfig
5556
export KUBECONFIG=.kcp/provider.kubeconfig
5657
k ws use :root
5758
kubectl ws create provider --enter
5859
```
5960

60-
5. Bind the APIExport to the workspace
61+
6. Bind the APIExport to the provider workspace
6162
```bash
6263
kubectl kcp bind apiexport root:kube-bind:kube-bind.io --accept-permission-claim clusterrolebindings.rbac.authorization.k8s.io \
6364
--accept-permission-claim clusterroles.rbac.authorization.k8s.io \
@@ -68,13 +69,14 @@ kubectl kcp bind apiexport root:kube-bind:kube-bind.io --accept-permission-claim
6869
--accept-permission-claim namespaces.core \
6970
--accept-permission-claim roles.rbac.authorization.k8s.io \
7071
--accept-permission-claim rolebindings.rbac.authorization.k8s.io \
71-
--accept-permission-claim apiresourceschemas.apis.kcp.io
72+
--accept-permission-claim apiresourceschemas.apis.kcp.io
7273
```
7374

74-
7. Create CRD:
75+
7. Create CRD in provider:
7576
```bash
76-
kubectl create -f kcp/deploy/examples/apiexport.yaml
77-
kubectl create -f kcp/deploy/examples/apiresourceschema.yaml
77+
kubectl create -f kcp/deploy/examples/apiexport.yaml
78+
kubectl create -f kcp/deploy/examples/apiresourceschema-cowboys.yaml
79+
kubectl create -f kcp/deploy/examples/apiresourceschema-sheriffs.yaml
7880
# recursive bind
7981
kubectl kcp bind apiexport root:provider:cowboys-stable
8082
```
@@ -84,7 +86,7 @@ kubectl kcp bind apiexport root:provider:cowboys-stable
8486
```bash
8587
kubectl get logicalcluster
8688
# NAME PHASE URL AGE
87-
# cluster Ready https://192.168.2.166:6443/clusters/2xh2v3gzjhn4tmve
89+
# cluster Ready https://192.168.2.166:6443/clusters/2xh2v3gzjhn4tmve
8890
```
8991

9092
9. Now we gonna initiate consumer:
@@ -101,7 +103,7 @@ kubectl ws create consumer --enter
101103
./bin/kubectl-bind http://127.0.0.1:8080/clusters/2vgrh380y0cq38du/exports --dry-run -o yaml > apiserviceexport.yaml
102104

103105
# Extract secret for binding process. Note that secret name is not the same as output from command above. Check secret
104-
# name by running `kubectl get secret -n kube-bind`
106+
# name by running `kubectl get secret -n kube-bind`
105107
kubectl get secret kubeconfig-wvvsb -n kube-bind -o jsonpath='{.data.kubeconfig}' | base64 -d > remote.kubeconfig
106108

107109
./bin/kubectl-bind apiservice --remote-kubeconfig remote.kubeconfig -f apiserviceexport.yaml --skip-konnector --remote-namespace kube-bind-m5zx4
@@ -137,9 +139,9 @@ kubectl apply -f kcp/deploy/examples/cowboy.yaml
137139
## Debug
138140
139141
```bash
140-
cp .kcp/admin.kubeconfig .kcp/debug.kubeconfig
142+
cp .kcp/admin.kubeconfig .kcp/debug.kubeconfig
141143
export KUBECONFIG=.kcp/debug.kubeconfig
142144
k ws use :root:kube-bind
143145
144-
k -s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" api-resources
145-
k -s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" get crd
146+
k -s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" api-resources
147+
k -s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" get crd
File renamed without changes.

kcp/bootstrap/config/config/clusterworkspace-kube-bind-provider.yaml renamed to contrib/kcp/bootstrap/config/config/clusterworkspace-kube-bind-provider.yaml

File renamed without changes.

kcp/bootstrap/config/config/clusterworkspace-kube-bind.yaml renamed to contrib/kcp/bootstrap/config/config/clusterworkspace-kube-bind.yaml

File renamed without changes.
File renamed without changes.

kcp/bootstrap/config/core/resources/1-namespace.yaml renamed to contrib/kcp/bootstrap/config/core/resources/1-namespace.yaml

File renamed without changes.

kcp/bootstrap/config/core/resources/2-clusterrolebinding.yaml renamed to contrib/kcp/bootstrap/config/core/resources/2-clusterrolebinding.yaml

File renamed without changes.

kcp/bootstrap/config/core/resources/3-serviceaccount.yaml renamed to contrib/kcp/bootstrap/config/core/resources/3-serviceaccount.yaml

File renamed without changes.

0 commit comments

Comments
 (0)