Skip to content

Commit 05dabe7

Browse files
committed
docs: add a simple local development guide
1 parent d5f1495 commit 05dabe7

File tree

5 files changed

+108
-0
lines changed

5 files changed

+108
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ test/e2e/data/infrastructure-oci/v1beta1/cluster-template-bare-metal.yaml
4444
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-seclist.yaml
4545
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-nsg.yaml
4646
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-multiple-node-nsg.yaml
47+
48+
# local development files
49+
auth-config.yaml

docs/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
- [Using Calico](./networking/calico.md)
3030
- [Using Antrea](./networking/antrea.md)
3131
- [Custom Networking](./networking/custom-networking.md)
32+
- [Developer Guide](./development/development.md)
3233
- [Reference](./reference/reference.md)
3334
- [Glossary](./reference/glossary.md)

docs/src/development/development.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
![tenancy_namespace](../images/tenancy_namespace.png)
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

docs/src/images/tenancy_namespace.png

21.9 KB
Loading

hack/auth-config-template.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# see region identifier in https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm
2+
# for a list of regions
3+
region: <region>
4+
tenancy: ocid1.tenancy.oc1..<unique_ID>
5+
user: ocid1.user.oc1..<unique_ID>
6+
key: |
7+
-----BEGIN RSA PRIVATE KEY-----
8+
<your_private_key>
9+
-----END RSA PRIVATE KEY-----
10+
fingerprint: <your_private_key_fingerprint>
11+
12+
useInstancePrincipals: false

0 commit comments

Comments
 (0)