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