kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

✨ Adding CAPI Provisioner to vc-manager #136

Closed christopherhein closed 3 years ago

christopherhein commented 3 years ago

What this PR does / why we need it: This adds integration points between VC and CAPN but more so CAPI as it doesn't use any CAPN components, solely reliant on CAPI's v1alpha4.Cluster{} resource. The templates/cluster-template-virtualcluster.yaml is a clusterctl --flavor for auto configuring the VirtualCluster CR with the cluster.

Testing:

  1. Clone CAPI master
  2. build master clusterctl
  3. Clone this branch
  4. Run local build https://github.com/kubernetes-sigs/cluster-api-provider-nested/tree/main/docs#create-docker-images-manifests-and-load-images
  5. cd virtualcluster/
  6. make build-images
  7. kind load docker-image virtualcluster/vn-agent-amd64 && kind load docker-image virtualcluster/syncer-amd64 && kind load docker-image virtualcluster/manager-amd64
  8. kubectl apply -f config/crd/
  9. kubectl apply -f config/setup/all_in_one_capi.yaml
  10. From this branch run: ../cluster-api/bin/clusterctl generate cluster ${CLUSTER_NAME} --from templates/cluster-template-virtualcluster.yaml | k apply -f -

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #81 Fixes #135

/milestone v0.1.x

christopherhein commented 3 years ago

/assign @Fei-Guo @charleszheng44 @weiling61

christopherhein commented 3 years ago

thanks @Fei-Guo updated based on your feedback.

Fei-Guo commented 3 years ago

LGTM. I will let Chao give a final approve.

charleszheng44 commented 3 years ago

@christopherhein Everything works as expected until I created a pod on the tenant cluster. The pod hangs in the pending state. Looks like the syncer can not connect to the tenant controlplane. I checked the syncer log and saw the following error message

I0617 16:08:03.453969       1 syncer.go:383] cluster default shutdown: Get "https://cluster-sample-apiserver:6443/api?timeout=30s": dial tcp 127.0.0.1:6443: connect: connection refused

That's wired. Because I was able to do port forwarding on svc/cluster-sample-apiserver 6443:6443

christopherhein commented 3 years ago

@christopherhein Everything works as expected until I created a pod on the tenant cluster. The pod hangs in the pending state. Looks like the syncer can not connect to the tenant controlplane. I checked the syncer log and saw the following error message

I0617 16:08:03.453969       1 syncer.go:383] cluster default shutdown: Get "https://cluster-sample-apiserver:6443/api?timeout=30s": dial tcp 127.0.0.1:6443: connect: connection refused

That's wired. Because I was able to do port forwarding on svc/cluster-sample-apiserver 6443:6443

@charleszheng44 It looks like you are using the wrong specs, can you delete that cluster then redo it making sure that the Cluster object includes the namespace in the controlPlaneEndpoint.host you'll see that commented about in - templates/cluster-template-virtualcluster.yaml - https://github.com/kubernetes-sigs/cluster-api-provider-nested/pull/136/files#diff-ec9ceefbdef73c7fb4f5a8ef98f5342b423b770ce83d208b185267d54ed2a10eR7-R12

k8s-ci-robot commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: charleszheng44, christopherhein

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/OWNERS)~~ [charleszheng44,christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
charleszheng44 commented 3 years ago

/lgtm