Skip to content

Commit a2eaea1

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

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-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

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