Prerequisite
- Install kubectl
- Install kustomize
v3.1.0+
- Outscale account with ak/sk Outscale Access Key and Secret Key
- A Kubernetes cluster:
- Container registry to store container image
- Registry secret registry-secret
Configuration
Clone
Please clone the project
git clone https://github.com/outscale-dev/cluster-api-provider-outscale
User Credentials configuration
This step wil deploy user credential secret Put your credentials in osc-secret.yaml and apply:
/usr/local/bin/kubectl apply -f osc-secret.yaml
Registry credentials configuration
If you use a private registry (docker registry, harbor, dockerhub, quay.io, ….) with credentials, registry credentials must be named regcred and must be deployed in cluster-api-provider-outscale-system namespace.
kubectl get secret regcred -n cluster-api-provider-outscale-system
NAME TYPE DATA AGE
regcred kubernetes.io/dockerconfigjson 1 52s
If you want to change it with another name, you can do so in this file cluster-api-provider-outscale/config/default:
value: [{ name: regcred }]
Build and deploy
Deploying Cluster Api
Please look at cluster-api section about deployment of cert-manager and cluster-api
Or you can use this to deploy cluster-api with cert-manager:
make deploy-clusterapi
Build, Push and Deploy
This step will build and push image to your public or private registry and deploy it.
Environment variable
Set those environment variable with yours:
export K8S_CONTEXT=phandalin
export CONTROLLER_IMAGE=my-registry/controller
-
K8S_CONTEXT is your context in your kubeconfig file.
-
CONTROLLER_IMAGE is the project path where the image will be stored. Tilt will add a tag each time it build an new image.
CAPM
Please run to generate capm.yaml:
IMG=my-registry/controller:latest make capm
- IMG is the CONTROLLER_IMAGE with CONTROLLER_IMAGE_TAG. Tilt will change the tag each time it build an new image.
Tilt
Please launch tilt at the project’s root folder:
[root@cidev-admin cluster-api-provider-outscale]# tilt up
Tilt started on http://localhost:10350/
v0.25.3, built 2022-03-04
(space) to open the browser
(s) to stream logs (--stream=true)
(t) to open legacy terminal mode (--legacy=true)
(ctrl-c) to exit
You can track your docker build and controller log in your web browser.
Check your cluster is deployed
[root@cidev-admin cluster-api-provider-outscale]# kubectl get pod -n cluster-api-provider-outscale-system
NAME READY STATUS RESTARTS AGE
cluster-api-provider-outscale-controller-manager-7d5c48d67t6d7f 2/2 Running 0 22s
Update api
In order to test the change of an api, please do:
make manifest
make generate
make capm
kubectl apply -f capm.yaml
Develop
Install project in order to devellop
:warning: In order to install tools (clusterctl, …) with makefile, you need to have installed golang to download binaries golang
You must install those project with :
make install-dev-prerequisites
Optionally, you can install those project(kind, [gh], [packer], [kubebuildertool]):
make install-packer
make install-gh
make install-kind
make install-kubebuildertool
CleanUp
Delete cluster
This step will delete your cluster
kubectl delete -f example/cluster-template.yaml
Delete Cluster Api Outscale controller manager
This step will delete the outscale controller manager
IMG=my-registry/controller:my-tag make undeploy
Delete Cluster Api
Please look at cluster-api section about deployment of cert-manager and cluster-api
Or you can use this to undeploy cluster-api with cert-manager:
make deploy-clusterapi