Skip to content

Commit 8ab6385

Browse files
committed
fix kubeconfig doing
1 parent 24005da commit 8ab6385

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

backend/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func parseKCPServerURL(ctx context.Context, clusterConfig *rest.Config) (string,
152152
clusterID := pathParts[5]
153153

154154
// Construct new URL with cluster path
155-
u.Path = "/api/clusters/" + clusterID
155+
u.Path = "/clusters/" + clusterID
156156

157157
return u.String(), nil
158158
}

backend/http/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ func (h *handler) handleCallback(w http.ResponseWriter, r *http.Request) {
305305
secure := false
306306

307307
http.SetCookie(w, session.MakeCookie(r, cookieName, encoded, secure, 1*time.Hour))
308+
// These are UI paths, not API paths, hence no /api/ prefix. UI will call the API for data.
308309
if authCode.ProviderClusterID == "" {
309310
http.Redirect(w, r, "/resources?s="+cookieName, http.StatusFound)
310311
} else {

kcp/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ bin/backend \
4545
--oidc-issuer-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \
4646
--oidc-issuer-client-id=kube-bind \
4747
--oidc-issuer-url=http://127.0.0.1:5556/dex \
48-
--oidc-callback-url=http://127.0.0.1:8080/callback \
48+
--oidc-callback-url=http://127.0.0.1:8080/api/callback \
4949
--pretty-name="BigCorp.com" \
5050
--namespace-prefix="kube-bind-" \
5151
--cookie-signing-key=bGMHz7SR9XcI9JdDB68VmjQErrjbrAR9JdVqjAOKHzE= \
5252
--cookie-encryption-key=wadqi4u+w0bqnSrVFtM38Pz2ykYVIeeadhzT34XlC1Y= \
5353
--schema-source apiresourceschemas \
54-
--consumer-scope=namespaced
54+
--consumer-scope=namespaced --frontend http://localhost:3000
5555
```
5656

5757

@@ -91,7 +91,7 @@ kubectl kcp bind apiexport root:provider:cowboys-stable
9191
```bash
9292
kubectl get logicalcluster
9393
# NAME PHASE URL AGE
94-
# cluster Ready https://192.168.2.166:6443/clusters/1a2ysx9kyac9gubl
94+
# cluster Ready https://192.168.2.166:6443/clusters/h3tp9nwm225v19nz
9595
```
9696

9797
9. Now we gonna initiate consumer:
@@ -105,28 +105,27 @@ kubectl ws create consumer --enter
105105
10. Bind the thing:
106106

107107
```bash
108-
./bin/kubectl-bind http://127.0.0.1:8080/clusters/1a2ysx9kyac9gubl/exports --dry-run -o yaml > apiserviceexport.yaml
108+
./bin/kubectl-bind http://127.0.0.1:8080/api/clusters/h3tp9nwm225v19nz/exports --dry-run -o yaml > apiserviceexport.yaml
109109

110110
# Extract secret for binding process. Note that secret name is not the same as output from command above. Check secret
111111
# name by running `kubectl get secret -n kube-bind`
112-
kubectl get secret kubeconfig-tq87c -n kube-bind -o jsonpath='{.data.kubeconfig}' | base64 -d > remote.kubeconfig
112+
kubectl get secret kubeconfig-zjx72 -n kube-bind -o jsonpath='{.data.kubeconfig}' | base64 -d > remote.kubeconfig
113113

114-
./bin/kubectl-bind apiservice --remote-kubeconfig remote.kubeconfig -f kcp/deploy/examples/apiserviceexport-namespaced.yaml --skip-konnector --remote-namespace kube-bind-pd7m9
114+
./bin/kubectl-bind apiservice --remote-kubeconfig remote.kubeconfig -f kcp/deploy/examples/apiserviceexport-namespaced.yaml --skip-konnector --remote-namespace kube-bind-v9jlf
115115

116-
./bin/kubectl-bind apiservice --remote-kubeconfig remote.kubeconfig -f kcp/deploy/examples/apiserviceexport-cluster.yaml --skip-konnector --remote-namespace kube-bind-tnnfp
116+
./bin/kubectl-bind apiservice --remote-kubeconfig remote.kubeconfig -f kcp/deploy/examples/apiserviceexport-cluster.yaml --skip-konnector --remote-namespace kube-bind-2nkhf
117117

118118

119119
export KUBECONFIG=.kcp/consumer.kubeconfig
120120
go run ./cmd/konnector/ --lease-namespace default
121121
```
122122

123-
Create objects:
123+
Create objects:
124124
```
125125
kubectl apply -f kcp/deploy/examples/cowboy.yaml
126126
kubectl apply -f kcp/deploy/examples/sheriff.yaml
127127
```
128128

129-
130129
## Debug
131130

132131
```bash

0 commit comments

Comments
 (0)