Skip to content

Commit eed3e59

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

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-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
@@ -31,3 +31,4 @@
3131
- [Custom Networking](./networking/custom-networking.md)
3232
- [Reference](./reference/reference.md)
3333
- [Glossary](./reference/glossary.md)
34+
- [Developer Guide](./development/development.md)

docs/src/development/development.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Developer Guide
2+
3+
## Install prerequisites
4+
5+
1. Install [go][go]
6+
- Get the latest patch version for go v1.17.
7+
1. Install [KIND][kind]
8+
- `GO111MODULE="on" go get sigs.k8s.io/kind@v<stableVersion>`.
9+
1. Install [Kustomize][kustomize]
10+
- `brew install kustomize` on macOS.
11+
- `choco install kustomize` on Windows.
12+
- [install instructions][kustomizelinux] on Linux
13+
1. Install [envsubst][envsubst]
14+
1. Install make.
15+
1. Install direnv
16+
- `brew install direnv` on macOS.
17+
18+
## Fork and get the source
19+
20+
Fork the [cluster-api-provider-oci repo](https://github.com/oracle/cluster-api-provider-oci):
21+
22+
```bash
23+
cd "$(go env GOPATH)"/src
24+
mkdir sigs.k8s.io
25+
cd sigs.k8s.io/
26+
git clone [email protected]:<GITHUB USERNAME>/cluster-api-provider-oci.git
27+
cd cluster-api-provider-oci
28+
git remote add upstream [email protected]:orale/cluster-api-provider-oci.git
29+
git fetch upstream
30+
```
31+
32+
## Running local management cluster for development
33+
34+
The simplest way to test the code is to run it from local.
35+
If you have `capoci-controller-manager` running in your management cluster, please scale down the deployment:
36+
```bash
37+
kubectl scale deployment/capoci-controller-manager --replicas=0 -n cluster-api-provider-oci-system
38+
```
39+
Create and modify the auth-config.yaml file:
40+
```bash
41+
cp <repo-path>/hack/auth-config-template.yaml <repo-path>/auth-config.yaml
42+
```
43+
Then modify the file with your information.
44+
45+
Then run the following commands:
46+
```bash
47+
export AUTH_CONFIG_DIR="<repo-path>/auth-config.yaml"
48+
make run
49+
```
50+
The above step will run the code locally using your local management cluster.
51+
52+
If you want to run your changes using a docker built image execute the following steps:
53+
54+
```bash
55+
export TAG=<tag>
56+
export REGISTRY="<region-key>.ocir.io/<namespace>"
57+
make docker-build
58+
```
59+
`region-key` 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
60+
documentation.
61+
62+
`namespace` is the auto-generated Object Storage namespace string of the tenancy (as shown on the Tenancy Information page)
63+
that owns the repository to which you want to push the image.
64+
65+
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
66+
67+
Execute the following steps to install the image
68+
69+
```bash
70+
make release-manifests
71+
kubectl apply -f out/infrastructure-oci/v0.1.0-alpha1/infrastructure-components.yaml
72+
```
73+
74+
[go]: https://golang.org/doc/install
75+
[go.mod]: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/go.mod
76+
[kind]: https://sigs.k8s.io/kind
77+
[kustomize]: https://github.com/kubernetes-sigs/kustomize
78+
[kustomizelinux]: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md
79+
[envsubst]: https://github.com/a8m/envsubst

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: <tenancy OCID>
5+
user: <user OCID>
6+
key: |
7+
-----BEGIN RSA PRIVATE KEY-----
8+
<key info>
9+
-----END RSA PRIVATE KEY-----
10+
fingerprint: <fingerprint>
11+
12+
useInstancePrincipals: false

0 commit comments

Comments
 (0)