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