POC of cluster-api implementation for Kubedge PI Cluster
Quick notes taken during the creation of the cluster-api-provider-kubedge scaffolding creation
Install dep
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
sudo mv $HOME/bin/dep /usr/bin
Install kustomize
wget https://github.com/kubernetes-sigs/kustomize/releases/download/v1.0.11/kustomize_1.0.11_linux_amd64
mv kustomize_1.0.11_linux_amd64 kustomize
chmod +x kustomize
sudo mv kustomize /usr/bin/
Install kubebuilder (contains a copy of kubectl, etcd and kubeapi-server)
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v1.0.8/kubebuilder_1.0.8_linux_amd64.tar.gz
tar xvf kubebuilder_1.0.8_linux_amd64.tar.gz
mv kubebuilder_1.0.8_linux_amd64 kubebuilder
sudo mv kubebuilder /usr/local
Ensure the local kubelete and kubernetes cluster is stopped
sudo systemctl stop kubelet
docker stop $(docker ps -qa)
export PATH=$PATH:/usr/local/kubebuilder/bin
cd cluster-api-provider-kubedge/
kubebuilder init --domain kubedge.cloud --license apache2 --owner "The Kubernetes Authors"
git add .
git commit -m "Generate scaffolding."
git push
kubebuilder create api --group kubedge --version v1alpha1 --kind AirshipClusterProviderSpec
kubebuilder create api --group kubedge --version v1alpha1 --kind AirshipClusterProviderStatus
kubebuilder create api --group kubedge --version v1alpha1 --kind AirshipMachineProviderStatus
kubebuilder create api --group kubedge --version v1alpha1 --kind AirshipMachineProviderSpec
vi cmd/manager/main.go
mkdir -p pkg/cloud/kubedge/actuators/cluster/
mkdir -p pkg/cloud/kubedge/actuators/machine/
vi pkg/cloud/kubedge/actuators/cluster/actuator.go
vi pkg/cloud/kubedge/actuators/machine/actuator.go
vi pkg/controller/add_cluster_controller.go
vi pkg/controller/add_machine_controller.go
vi Makefile
dep ensure
export IMG=kubedge2/cluster-api-provider-kubedge
dep ensure
make
make docker-build IMG=${IMG}
git add .
git commit -m "Add CRDs and build image"
git push
If you used brute force, git add . the repository becomes bulky. In order to keep the scrict minimum
git rm -fr vendor/
git rm -fr bin/
git commit
git push origin --force --all
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch vendor" HEAD
git push origin --force --all
git clone https://github.com/kubedge/cluster-api-provider-kubedge.git
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch bin" HEAD
git push origin --force --all
git clone https://github.com/kubedge/cluster-api-provider-kubedge.git
List of commands used to rebuild and publish the images.
export IMG=kubedge2/cluster-api-provider-kubedge
dep ensure
make
make docker-build IMG=${IMG}
make docker-push IMG=${IMG}
List of commands to deploy and test.
Ensure that /usr/local/kubebuilder is no longer in your path if you are using the same machine
kubectl get nodes
kubectl apply -f provider-components.yaml
kubectl get all --all-namespaces
kubectl logs pod/cluster-api-provider-kubedge-controller-manager-0 -n cluster-api-provider-kubedge-system manager
TBD