Skip to content

Commit

Permalink
docs: add a simple local development guide
Browse files Browse the repository at this point in the history
  • Loading branch information
joekr committed Mar 14, 2022
1 parent d5f1495 commit d8198f2
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
95 changes: 95 additions & 0 deletions docs/src/development/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Developer Guide

## Install prerequisites

1. Install [go][go]
- Get the latest patch version for go v1.17.
2. Install [KIND][kind]
- `GO111MODULE="on" go get sigs.k8s.io/kind@v<stableVersion>`.
3. Install [Kustomize][kustomize]
- `brew install kustomize` on macOS.
- `choco install kustomize` on Windows.
- [install instructions][kustomizelinux] on Linux
4. Install [envsubst][envsubst]
- `go get github.com/a8m/envsubst/cmd/envsubst`
5. Install make.
- `xcode-select --install` on macOS.
- `sudo apt-get install build-essential` on Ubuntu Linux

## 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:<GITHUB USERNAME>/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 <repo-path>/hack/auth-config-template.yaml <repo-path>/auth-config.yaml
```

Then modify the file with your information.

Then run the following commands:

```bash
export AUTH_CONFIG_DIR="<repo-path>/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=<tag>
export REGISTRY="<region>.ocir.io/<namespace>"
make docker-build
```

`region` for example, `phx` or `us-phoenix-1`. See the
[Available Endpoints](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.

![tenancy_namespace](../images/tenancy_namespace.png)

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>

Execute the following steps to install the image

```bash
make release-manifests
kubectl apply -f out/infrastructure-oci/v0.1.1-development/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
Binary file added docs/src/images/tenancy_namespace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions hack/auth-config-template.yaml
Original file line number Diff line number Diff line change
@@ -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: <region>
tenancy: <tenancy OCID>
user: <user OCID>
key: |
-----BEGIN RSA PRIVATE KEY-----
<key info>
-----END RSA PRIVATE KEY-----
fingerprint: <fingerprint>

useInstancePrincipals: false

0 comments on commit d8198f2

Please sign in to comment.