|
| 1 | +# Developer Guide |
| 2 | + |
| 3 | +## Install prerequisites |
| 4 | + |
| 5 | +1. Install [go][go] |
| 6 | + - Get the latest patch version for go v1.17. |
| 7 | +1. Install [KIND][kind] |
| 8 | + - `GO111MODULE="on" go get sigs.k8s.io/kind@v<stableVersion>`. |
| 9 | +1. Install [Kustomize][kustomize] |
| 10 | + - `brew install kustomize` on macOS. |
| 11 | + - `choco install kustomize` on Windows. |
| 12 | + - [install instructions][kustomizelinux] on Linux |
| 13 | +1. Install [envsubst][envsubst] |
| 14 | +1. Install make. |
| 15 | +1. Install direnv |
| 16 | + - `brew install direnv` on macOS. |
| 17 | + |
| 18 | +## Fork and get the source |
| 19 | + |
| 20 | +Fork the [cluster-api-provider-oci repo](https://github.com/oracle/cluster-api-provider-oci): |
| 21 | + |
| 22 | +```bash |
| 23 | +cd "$(go env GOPATH)"/src |
| 24 | +mkdir sigs.k8s.io |
| 25 | +cd sigs.k8s.io/ |
| 26 | +git clone [email protected]: <GITHUB USERNAME >/cluster-api-provider-oci.git |
| 27 | +cd cluster-api-provider-oci |
| 28 | +git remote add upstream [email protected]:orale/cluster-api-provider-oci.git |
| 29 | +git fetch upstream |
| 30 | +``` |
| 31 | + |
| 32 | +## Running local management cluster for development |
| 33 | + |
| 34 | +The simplest way to test the code is to run it from local. |
| 35 | +If you have `capoci-controller-manager` running in your management cluster, please scale down the deployment: |
| 36 | +```bash |
| 37 | +kubectl scale deployment/capoci-controller-manager --replicas=0 -n cluster-api-provider-oci-system |
| 38 | +``` |
| 39 | +Create and modify the auth-config.yaml file: |
| 40 | +```bash |
| 41 | +cp <repo-path>/hack/auth-config-template.yaml <repo-path>/auth-config.yaml |
| 42 | +``` |
| 43 | +Then modify the file with your information. |
| 44 | + |
| 45 | +Then run the following commands: |
| 46 | +```bash |
| 47 | +export AUTH_CONFIG_DIR="<repo-path>/auth-config.yaml" |
| 48 | +make run |
| 49 | +``` |
| 50 | +The above step will run the code locally using your local management cluster. |
| 51 | + |
| 52 | +If you want to run your changes using a docker built image execute the following steps: |
| 53 | + |
| 54 | +```bash |
| 55 | +export TAG=<tag> |
| 56 | +export REGISTRY="<region-key>.ocir.io/<namespace>" |
| 57 | +make docker-build |
| 58 | +``` |
| 59 | +`region-key` for example, phx. See the [Availability by Region](https://docs.oracle.com/en-us/iaas/Content/Registry/Concepts/registryprerequisites.htm#Availab) topic in the Oracle Cloud Infrastructure Registry |
| 60 | +documentation. |
| 61 | + |
| 62 | +`namespace` is the auto-generated Object Storage namespace string of the tenancy (as shown on the Tenancy Information page) |
| 63 | +that owns the repository to which you want to push the image. |
| 64 | + |
| 65 | +Push the resulting docker image to the repository. For more info on how to push to OCIR see https://www.oracle.com/webfolder/technetwork/tutorials/obe/oci/registry/index.html |
| 66 | + |
| 67 | +Execute the following steps to install the image |
| 68 | + |
| 69 | +```bash |
| 70 | +make release-manifests |
| 71 | +kubectl apply -f out/infrastructure-oci/v0.1.0-alpha1/infrastructure-components.yaml |
| 72 | +``` |
| 73 | + |
| 74 | +[go]: https://golang.org/doc/install |
| 75 | +[go.mod]: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/go.mod |
| 76 | +[kind]: https://sigs.k8s.io/kind |
| 77 | +[kustomize]: https://github.com/kubernetes-sigs/kustomize |
| 78 | +[kustomizelinux]: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md |
| 79 | +[envsubst]: https://github.com/a8m/envsubst |
0 commit comments