Skip to content

Commit 73bcbb1

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

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

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

hack/auth-config-template.yaml

Lines changed: 12 additions & 0 deletions
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)