Skip to content

Commit

Permalink
Add support for deploying on existing cluster
Browse files Browse the repository at this point in the history
Signed-off-by: adrianc <adrianc@nvidia.com>
  • Loading branch information
adrianchiris committed Aug 16, 2023
1 parent 4973441 commit 43797b8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [Install Prerequisites](#install-prerequisites)
- [Create local k8s development environment](#create-local-k8s-development-environment)
- [Cleanup local k8s development environment](#cleanup-local-k8s-development-environment)
- [Deploy onto an existing k8s cluster](#deploy-onto-an-existing-k8s-cluster)

## Overview

Expand Down Expand Up @@ -206,8 +207,9 @@ local changes onto a local k8s cluster.
#### Install Prerequisites

1. [install Docker](https://docs.docker.com/engine/install/)
2. [install minikube](https://minikube.sigs.k8s.io/docs/start/)
3. [install skaffold](https://skaffold.dev/docs/install/#standalone-binary)
2. [install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/)
3. [install minikube](https://minikube.sigs.k8s.io/docs/start/)
4. [install skaffold](https://skaffold.dev/docs/install/#standalone-binary)

#### Create local k8s development environment

Expand All @@ -222,3 +224,20 @@ To trigger a rebuild, press any key in the current shell.
```shell
task -o interleaved localdev:clean
```

### Deploy onto an existing k8s cluster

For this deployment option you should provide the following environment variables

`LOCALDEV_IMAGE_REPO`: image repository which skaffold will use.
`LOCALDEV_KUBECONFIG`: optional, path to kubeconfig file which will be used by skaffold to access k8s cluster.
`LOCALDEV_KUBE_CONTEXT`: optional. name of kube context which will be used by skaffold to access k8s cluster.

```shell
LOCALDEV_IMAGE_REPO=quay.io/myuser task -o interleaved localdev:deploy
```

To trigger a rebuild, press any key in the current shell.

>__NOTE__: if `LOCALDEV_KUBECONFIG` and `LOCALDEV_KUBE_CONTEXT` are not provided, the current context pointed by
> kubectl will be used.
10 changes: 10 additions & 0 deletions taskfiles/LocalDev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@
clean:
desc: clean local k8s dev cluster
cmd: minikube --profile nfd-dev delete

deploy:
desc: deploy on pre-created cluster
vars:
LOCALDEV_IMAGE_REPO: '{{.LOCALDEV_IMAGE_REPO | default "harbor.mellanox.com/cloud-orchestration-dev"}}'
#LOCALDEV_KUBECONFIG: "/path/to/kubeconfig" <- optional, pass in via env var
#LOCALDEV_KUBECONTEXT: "kube-context-name" <- optional, pass in via env var
cmd: |
export SK_FLAGS="{{if .LOCALDEV_KUBECONFIG}}--kubeconfig={{.LOCALDEV_KUBECONFIG}}{{else}}{{if .LOCALDEV_KUBECONTEXT}}--kube-context={{.LOCALDEV_KUBECONTEXT}}{{end}}{{end}}"
skaffold dev --trigger=manual --default-repo={{.LOCALDEV_IMAGE_REPO}} $SK_FLAGS

0 comments on commit 43797b8

Please sign in to comment.