Skip to content

Commit d8198f2

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

File tree

5 files changed

+111
-0
lines changed

5 files changed

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

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