Skip to content

Commit

Permalink
Adding instructions on how to start kro in kind with ko locally
Browse files Browse the repository at this point in the history
  • Loading branch information
n3wscott committed Feb 5, 2025
1 parent b9f0419 commit 19b5de5
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Dockerfile.cross

!vendor/**/zz_generated.*

rendered/

# editor and IDE paraphernalia
.idea
.vscode
Expand All @@ -35,4 +37,4 @@ cover.html
.design
.DS_Store
TODO.*
# package-lock.json
# package-lock.json
4 changes: 4 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.deployment.securityContext | nindent 12 }}
{{- if .Values.image.ko }}
image: "ko://github.com/kro-run/kro/cmd/controller"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: metricsport
Expand Down
6 changes: 4 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ fullnameOverride: ""
image:
# The location of the container image repository
repository: ghcr.io/kro-run/kro/controller
# Image pull policy (IfNotPresent: pull the image only if it is not present locally)
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "0.2.0"
# Ignores the repository and tag settings and uses the controllers ko entrypoint.
ko: false
# Image pull policy (IfNotPresent: pull the image only if it is not present locally)
pullPolicy: IfNotPresent

# List of secrets for pulling images from a private registry
imagePullSecrets: []
Expand Down
92 changes: 92 additions & 0 deletions website/docs/examples/kind/01-Installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
sidebar_position: 10
---

# Local development with [`ko`][ko] and [`KinD`][kind]
[ko]: https://ko.build
[kind]: https://kind.sigs.k8s.io/

## Installing Kro

1. Create a `KinD` cluster.

```sh
kind create cluster
```

2. Create the `kro-system` namespace.

```sh
kubectl create namespace kro-system
```

3. Set the `KO_DOCKER_REPO` env var.

```sh
export KO_DOCKER_REPO=kind.local
```

> _Note_, if not using the default kind cluster name, set KIND_CLUSTER_NAME
```sh
export KIND_CLUSTER_NAME=my-other-cluster
```
4. Apply the Kro CRDs.

```sh
make manifests
kubectl apply -f ./helm/crds
```

5. Render and apply the local helm chart.

```sh
helm template kro ./helm \
--namespace kro-system \
--set image.pullPolicy=Never \
--set image.ko=true | ko apply -f -
```

## Hello World

1. Create a `NoOp` ResourceGraph using the `ResourceGraphDefinition`.

```sh
kubectl apply -f - <<EOF
apiVersion: kro.run/v1alpha1
kind: ResourceGraphDefinition
metadata:
name: noop
spec:
schema:
apiVersion: v1alpha1
kind: NoOp
spec: {}
status: {}
resources: []
EOF
```
Inspect that the `ResourceGraphDefinition` was created, and also the newly created CRD `NoOp`.
```sh
kubectl get ResourceGraphDefinition noop
kubectl get crds | grep noops
```
3. Create an instance of the new `NoOp` kind.
```sh
kubectl apply -f - <<EOF
apiVersion: kro.run/v1alpha1
kind: NoOp
metadata:
name: demo
EOF
```
And inspect the new instance,
```shell
kubectl get noops -oyaml
```
10 changes: 10 additions & 0 deletions website/docs/examples/kind/category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"label": "KinD Examples",
"position": 500,
"link": {
"type": "generated-index",
"description": "Examples of using Kro with KinD"
},
"collapsible": true,
"collapsed": true
}
4 changes: 2 additions & 2 deletions website/docs/examples/kubernetes/category.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"label": "Kubernetes Examples",
"position": 200,
"position": 600,
"link": {
"type": "generated-index",
"description": "Examples of using Kro with Kubernetes"
},
"collapsible": true,
"collapsed": true
}
}

0 comments on commit 19b5de5

Please sign in to comment.