From 73bcbb1c400c7ce651b0bc26ec0a5598e7dcf0ab Mon Sep 17 00:00:00 2001 From: Joe Kratzat Date: Wed, 9 Mar 2022 14:48:57 -0500 Subject: [PATCH] docs: add a simple local development guide --- .gitignore | 3 + docs/src/SUMMARY.md | 1 + docs/src/development/development.md | 91 +++++++++++++++++++++++++++++ hack/auth-config-template.yaml | 12 ++++ 4 files changed, 107 insertions(+) create mode 100644 docs/src/development/development.md create mode 100644 hack/auth-config-template.yaml diff --git a/.gitignore b/.gitignore index 5b304658d..e0a6776f9 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ test/e2e/data/infrastructure-oci/v1beta1/cluster-template-bare-metal.yaml test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-seclist.yaml test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-nsg.yaml test/e2e/data/infrastructure-oci/v1beta1/cluster-template-multiple-node-nsg.yaml + +# local development files +auth-config.yaml diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 03f621db3..e15257533 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -29,5 +29,6 @@ - [Using Calico](./networking/calico.md) - [Using Antrea](./networking/antrea.md) - [Custom Networking](./networking/custom-networking.md) +- [Developer Guide](./development/development.md) - [Reference](./reference/reference.md) - [Glossary](./reference/glossary.md) diff --git a/docs/src/development/development.md b/docs/src/development/development.md new file mode 100644 index 000000000..41ba2e24c --- /dev/null +++ b/docs/src/development/development.md @@ -0,0 +1,91 @@ +# Developer Guide + +## Install prerequisites + +1. Install [go][go] + - Get the latest patch version for go v1.17. +1. Install [KIND][kind] + - `GO111MODULE="on" go get sigs.k8s.io/kind@v`. +1. Install [Kustomize][kustomize] + - `brew install kustomize` on macOS. + - `choco install kustomize` on Windows. + - [install instructions][kustomizelinux] on Linux +1. Install [envsubst][envsubst] + - `go get github.com/a8m/envsubst/cmd/envsubst` +1. Install make. + +## Fork and get the source + +Fork the [cluster-api-provider-oci repo](https://github.com/oracle/cluster-api-provider-oci): + +```bash +cd "$(go env GOPATH)"/src +mkdir sigs.k8s.io +cd sigs.k8s.io/ +git clone git@github.com:/cluster-api-provider-oci.git +cd cluster-api-provider-oci +git remote add upstream git@github.com:orale/cluster-api-provider-oci.git +git fetch upstream +``` + +## Running local management cluster for development + +The simplest way to test the code is to run it from local. +If you have `capoci-controller-manager` running in your management cluster, +please scale down the deployment: + +```bash +kubectl scale deployment/capoci-controller-manager --replicas=0 -n cluster-api-provider-oci-system +``` + +Create and modify the auth-config.yaml file: + +```bash +cp /hack/auth-config-template.yaml /auth-config.yaml +``` + +Then modify the file with your information. + +Then run the following commands: + +```bash +export AUTH_CONFIG_DIR="/auth-config.yaml" +make run +``` + +The above step will run the code locally using your local management cluster. + +If you want to run your changes using a docker built image, execute the +following steps: + +```bash +export TAG= +export REGISTRY=".ocir.io/" +make docker-build +``` + +`region` 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 documentation. + +`namespace` is the auto-generated Object Storage namespace string of the tenancy +(as shown on the Tenancy Information page) that owns the repository to which you +want to push the image. + +Push the resulting docker image to the repository. For more info on how to push +to OCIR see + + +Execute the following steps to install the image + +```bash +make release-manifests +kubectl apply -f out/infrastructure-oci/v0.0.1-alpha1/infrastructure-components.yaml +``` + +[go]: https://golang.org/doc/install +[go.mod]: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/go.mod +[kind]: https://sigs.k8s.io/kind +[kustomize]: https://github.com/kubernetes-sigs/kustomize +[kustomizelinux]: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md +[envsubst]: https://github.com/a8m/envsubst diff --git a/hack/auth-config-template.yaml b/hack/auth-config-template.yaml new file mode 100644 index 000000000..b1e261924 --- /dev/null +++ b/hack/auth-config-template.yaml @@ -0,0 +1,12 @@ +# see Region Identifier in https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm +# for a list of regions +region: +tenancy: +user: +key: | + -----BEGIN RSA PRIVATE KEY----- + + -----END RSA PRIVATE KEY----- +fingerprint: + +useInstancePrincipals: false \ No newline at end of file