You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+94-1Lines changed: 94 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,13 @@ GitHub provides additional document on [forking a repository](https://help.githu
40
40
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41
41
42
42
## Setting Up a Local Development Environment
43
+
44
+
By following the steps for [externally running a controller](#running-the-controller-external-to-the-cluster) or
45
+
[running the controller inside a `KinD` cluster](#running-the-controller-inside-a-kind-cluster-with-ko), you can set up
46
+
a local environment to test your contributions before submitting a pull request.
47
+
48
+
### Running the controller external to the cluster
49
+
43
50
To test and run the project with your local changes, follow these steps to set up a development environment:
44
51
45
52
1. Install Dependencies: Ensure you have the necessary dependencies installed, including:
@@ -64,7 +71,93 @@ To test and run the project with your local changes, follow these steps to set u
64
71
```
65
72
This will connect to the default Kubernetes context in your local kubeconfig (`~/.kube/config`). Ensure the context is pointing to your local cluster.
66
73
67
-
By following these steps, you can setup a local environment to test your contributions before submitting a pull request.
74
+
### Running the controller inside a [`KinD`][kind] cluster with [`ko`][ko]
75
+
76
+
[ko]: https://ko.build
77
+
[kind]: https://kind.sigs.k8s.io/
78
+
79
+
1. Create a `KinD` cluster.
80
+
81
+
```sh
82
+
kind create cluster
83
+
```
84
+
85
+
2. Create the `kro-system` namespace.
86
+
87
+
```sh
88
+
kubectl create namespace kro-system
89
+
```
90
+
91
+
3. Set the `KO_DOCKER_REPO` env var.
92
+
93
+
```sh
94
+
export KO_DOCKER_REPO=kind.local
95
+
```
96
+
97
+
> _Note_, if not using the default kind cluster name, set KIND_CLUSTER_NAME
98
+
99
+
```sh
100
+
export KIND_CLUSTER_NAME=my-other-cluster
101
+
```
102
+
4. Apply the Kro CRDs.
103
+
104
+
```sh
105
+
make manifests
106
+
kubectl apply -f ./helm/crds
107
+
```
108
+
109
+
5. Render and apply the local helm chart.
110
+
111
+
```sh
112
+
helm template kro ./helm \
113
+
--namespace kro-system \
114
+
--set image.pullPolicy=Never \
115
+
--set image.ko=true | ko apply -f -
116
+
```
117
+
118
+
### Dev Environment Hello World
119
+
120
+
1. Create a `NoOp` ResourceGraph using the `ResourceGraphDefinition`.
121
+
122
+
```sh
123
+
kubectl apply -f - <<EOF
124
+
apiVersion: kro.run/v1alpha1
125
+
kind: ResourceGraphDefinition
126
+
metadata:
127
+
name: noop
128
+
spec:
129
+
schema:
130
+
apiVersion: v1alpha1
131
+
kind: NoOp
132
+
spec: {}
133
+
status: {}
134
+
resources: []
135
+
EOF
136
+
```
137
+
138
+
Inspect that the `ResourceGraphDefinition` was created, and also the newly created CRD `NoOp`.
139
+
140
+
```sh
141
+
kubectl get ResourceGraphDefinition noop
142
+
kubectl get crds | grep noops
143
+
```
144
+
145
+
3. Create an instance of the new `NoOp` kind.
146
+
147
+
```sh
148
+
kubectl apply -f - <<EOF
149
+
apiVersion: kro.run/v1alpha1
150
+
kind: NoOp
151
+
metadata:
152
+
name: demo
153
+
EOF
154
+
```
155
+
156
+
And inspect the new instance,
157
+
158
+
```shell
159
+
kubectl get noops -oyaml
160
+
```
68
161
69
162
## Finding contributions to work on
70
163
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
0 commit comments