Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit ffeda3d

Browse files
authored
feat: add cleanup for kubernetes dev env (#59)
Signed-off-by: Kfir Toledo <[email protected]>
1 parent 94b55cb commit ffeda3d

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

DEVELOPMENT.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ make environment.dev.kind
4343

4444
This will create a `kind` cluster (or re-use an existing one) using the system's
4545
local container runtime and deploy the development stack into the `default`
46-
namespace.
46+
namespace.
4747

4848
There are several ways to access the gateway:
4949

@@ -56,15 +56,15 @@ $ kubectl --context kind-gie-dev port-forward service/inference-gateway 8080:80
5656
> **Warning**: This method doesn't work on `podman` correctly, as `podman` support
5757
> with `kind` is not fully implemented yet.
5858
```sh
59-
# Determine the k8s node address
59+
# Determine the k8s node address
6060
$ kubectl --context kind-gie-dev get node -o yaml | grep address
6161
# The service is accessible over port 80 of the worker IP address.
6262
```
6363

6464
**LoadBalancer**
6565

6666
```sh
67-
# Install and run cloud-provider-kind:
67+
# Install and run cloud-provider-kind:
6868
$ go install sigs.k8s.io/cloud-provider-kind@latest && cloud-provider-kind &
6969
$ kubectl --context kind-gie-dev get service inference-gateway
7070
# Wait for the LoadBalancer External-IP to become available. The service is accessible over port 80.
@@ -250,3 +250,20 @@ make environment.dev.kubernetes
250250
```
251251

252252
And test the changes.
253+
254+
### Cleanup Environment
255+
256+
To clean up the development environment and remove all deployed resources in your namespace, run:
257+
258+
```sh
259+
make clean.environment.dev.kubernetes
260+
```
261+
262+
**Warning**: This cleanup doesn't remove any custom pull `Secrets` you may have added. If you are
263+
done with this environment, you may want to remove those manually as well.
264+
265+
If you also want to remove the namespace entirely, run:
266+
267+
```sh
268+
kubectl delete namespace ${NAMESPACE}
269+
```

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ test: check-ginkgo ## Run tests
428428
post-deploy-test: ## Run post deployment tests
429429
echo Success!
430430
@echo "Post-deployment tests passed."
431-
431+
432432
.PHONY: lint
433433
lint: check-golangci-lint ## Run lint
434434
@printf "\033[33;1m==== Running linting ====\033[0m\n"
@@ -776,15 +776,15 @@ environment.dev.kubernetes: check-kubectl check-kustomize check-envsubst
776776
# ------------------------------------------------------------------------------
777777
# Kubernetes Development Environment - Teardown
778778
#
779-
# Tears down the namespace, and therefore the development environment.
779+
# Tears down the development environment.
780780
# ------------------------------------------------------------------------------
781781
.PHONY: clean.environment.dev.kubernetes
782782
clean.environment.dev.kubernetes: check-kubectl check-kustomize check-envsubst
783783
ifndef NAMESPACE
784784
$(error "Error: NAMESPACE is required but not set")
785785
endif
786-
@echo "INFO: deleting namespace $(NAMESPACE)"
787-
kubectl delete namespace $(NAMESPACE)
786+
@echo "INFO: cleaning up dev environment in $(NAMESPACE)"
787+
kustomize build deploy/environments/dev/kubernetes-kgateway | envsubst | kubectl -n "${NAMESPACE}" delete -f -
788788

789789
# -----------------------------------------------------------------------------
790790
# TODO: these are old aliases that we still need for the moment, but will be

0 commit comments

Comments
 (0)