Skip to content

Commit

Permalink
feat(skaffold): Add Skaffold (#150)
Browse files Browse the repository at this point in the history
* feat(skaffold): Add Skaffold configuration

Also introduce the CONTRIBUTING.md file, which provides instruction about running it.

* Update CONTRIBUTING.md

Co-authored-by: Jesper Svendsen <99078145+jesper7@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jesper Svendsen <99078145+jesper7@users.noreply.github.com>

* Apply review

---------

Co-authored-by: Marcin Jasion <mjasion@users.noreply.github.com>
Co-authored-by: Jesper Svendsen <99078145+jesper7@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 9, 2023
1 parent b5d0739 commit 3d59ad4
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.tgz
override.yaml
.idea
/charts/studio/local-values.yaml
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Development environment

Get the latest development version. Fork and clone the repo:

```cli
$ git clone git@github.com:<your-username>/helm-charts.git
```
Install [Helm](https://helm.sh/docs/intro/install/) and [Skaffold](https://skaffold.dev/docs/install/).

Install a local Kubernetes cluster:
- [Docker Desktop](https://docs.docker.com/desktop/kubernetes/) - recommended
- [Kind](https://kind.sigs.k8s.io/docs/user/configuration/) - it needs additional configuration
to expose ingress 👇
- K3d - not supported yet


### Kind cluster
Kind does not expose ports by default. To enable this, you need to create the cluster with
the following command:

```cli
$ kind create cluster --config kind-config.yaml
```

That's it. You should be ready to make changes, run tests, and make commits! 🎉

## Running skaffold
Run skaffold in the root of the repo:

```cli
$ skaffold dev
```
Wait for the deployment to finish. You can check the status of the deployment in console.
When it is ready, open the browser and go to http://localhost. You should see the Studio page.

> [!NOTE]
> Skaffold contains a configuration to install `ingress-nginx` for kind and
> docker-desktop. The profile will be used automatically when you run skaffold with the `dev` profile
> and the name of the current `kubeContext` matches `kind-*` or `docker-desktop`.
### Skaffold profile - `local`

If you want to run skaffold with `local` profile, you need to create `local-values.yaml` file in
`charts/studio/local-values.yaml`. The values should contain the overrides for the values of the
chart.

To use the profile, run skaffold with following command:

```cli
$ skaffold dev -p local
```
11 changes: 11 additions & 0 deletions kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
35 changes: 35 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: skaffold/v4beta6
kind: Config
deploy:
helm:
releases:
- name: studio
chartPath: charts/studio
skipBuildDependencies: false
wait: true
valuesFiles:
- charts/studio/values.yaml
recreatePods: false
upgradeOnChange: true
kubectl: {}

profiles:
- name: local
patches:
- path: /deploy/helm/releases/0/valuesFiles/1
value: charts/studio/values-skaffold.yaml
op: add
- name: ingress-docker-desktop
activation:
- kubeContext: docker-desktop
manifests:
kustomize:
paths:
- skaffold/docker-desktop
- name: ingress-kind
activation:
- kubeContext: kind-(.*)
manifests:
kustomize:
paths:
- skaffold/kind
12 changes: 12 additions & 0 deletions skaffold/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

patches:
- patch: |-
- op: remove
path: /spec/template/spec/nodeSelector/ingress-ready
target:
kind: Deployment
13 changes: 13 additions & 0 deletions skaffold/docker-desktop/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base/
patches:
- patch: |-
- op: replace
path: /spec/type
value: LoadBalancer
target:
kind: Service
name: ingress-nginx-controller
5 changes: 5 additions & 0 deletions skaffold/kind/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base/

0 comments on commit 3d59ad4

Please sign in to comment.