Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(skaffold): Add Skaffold #150

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/