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: Add documentation about busola in k8s and adjust k8s configs #3547

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8d7152d
ingress works
dbadura Nov 22, 2024
4fc041e
wip
dbadura Dec 18, 2024
c34619e
first version od tests adjustement
dbadura Nov 25, 2024
13f3721
revert changes related to ci
dbadura Dec 18, 2024
c8ae781
wip
dbadura Dec 20, 2024
6e305b4
adjust k8s resources to use single image
dbadura Dec 30, 2024
b79c481
revert changes related to backend env
dbadura Dec 30, 2024
3f42b81
cleanup
dbadura Dec 30, 2024
7875c80
first istio steps
dbadura Dec 30, 2024
a995107
finish readme and use api rule
dbadura Dec 31, 2024
b5e436e
improve docs
dbadura Dec 31, 2024
bfb8321
remove not needed env
dbadura Dec 31, 2024
fcfde0b
Merge branch 'main' into busola-k8s
dbadura Dec 31, 2024
575accc
improve readme
dbadura Jan 2, 2025
c342b15
revert deletion of validation schemas
dbadura Jan 3, 2025
b1c5fc6
remove accident addition
dbadura Jan 3, 2025
b78c98d
improve cm location
dbadura Jan 3, 2025
18dc70e
remove backend address calculation
dbadura Jan 7, 2025
25ea0c8
Apply suggestions from code review
dbadura Jan 7, 2025
2c5c145
fix hpa and mention yq
dbadura Jan 7, 2025
a3da831
update info about k3d
dbadura Jan 7, 2025
8c6a293
Merge branch 'main' into busola-k8s
dbadura Jan 7, 2025
b0b31f3
fix local dev
dbadura Jan 8, 2025
0ce0f6c
Apply suggestions from code review
dbadura Jan 8, 2025
b4819a3
Change on to in
grego952 Jan 8, 2025
2606242
Remove reference to port 3001 on localhost in custom extension
pbochynski Jan 8, 2025
f2b87c8
better naming
dbadura Jan 8, 2025
063ef28
Update README.md
grego952 Jan 8, 2025
a26faa2
adjust running of integration tests
dbadura Jan 8, 2025
d52a6c9
fix hanging the tests
dbadura Jan 8, 2025
e646f99
redirect log
dbadura Jan 8, 2025
5f2e4bc
fix tests
dbadura Jan 8, 2025
95ecbe4
fix lighthouse
dbadura Jan 8, 2025
6036f88
Merge branch 'main' into busola-k8s
mrCherry97 Jan 9, 2025
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
48 changes: 15 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
IMG_NAME = busola-web
LOCAL_IMG_NAME = busola
IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(IMG_NAME)
LOCAL_IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(LOCAL_IMG_NAME)
KYMA_DASHBOARD_IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(KYMA_DASHBOARD_IMG_NAME)
TAG = $(DOCKER_TAG)
APP_NAME = busola
.DEFAULT_GOAL=help

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


.PHONY: resolve
resolve:
Expand All @@ -21,30 +21,12 @@ release: build-image push-image

release-local: build-image-local push-image-local

build-image:
docker build -t $(IMG_NAME) -f Dockerfile .

build-image-local:
docker build -t $(LOCAL_IMG_NAME) -f Dockerfile.local .

push-image:
docker tag $(IMG_NAME) $(IMG):$(TAG)
docker push $(IMG):$(TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Sign image with Cosign"
cosign version
cosign sign -key ${KMS_KEY_URL} $(REPO)$(IMG):$(TAG)
else
@echo "Image signing skipped"
endif

push-image-local:
docker tag $(LOCAL_IMG_NAME) $(LOCAL_IMG):$(TAG)
docker push $(LOCAL_IMG):$(TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Tag image with latest"
docker tag $(LOCAL_IMG_NAME) $(LOCAL_IMG):latest
docker push $(LOCAL_IMG):latest
else
@echo "Image tagging with latest skipped"
endif
build-image: ## Build busola backend image
docker build -t $(APP_NAME) -f Dockerfile .

install-busola-k3d: build-image ## Build busola web image and install it on local k3d cluster
$(eval HASH_TAG=$(shell docker images $(APP_NAME):latest --quiet))
docker tag $(APP_NAME) $(APP_NAME):$(HASH_TAG)

k3d image import $(APP_NAME):$(HASH_TAG) -c kyma
kubectl set image deployment busola busola=$(APP_NAME):$(HASH_TAG)
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ For the information on how to run tests and configure them, go to the [`tests`](
docker run --rm -it -p 3001:3001 -v <path to your kubeconfig>:/app/core-ui/kubeconfig/<your kubeconfig file name> --pid=host --name busola europe-docker.pkg.dev/kyma-project/prod/busola:latest
```

2. When you open Busola in your browser, go to `http://localhost:3001?kubeconfigID={YOUR_KUBECONFIG_FILE_NAME}`. Busola will try to download that file and add it for your Busola instance.
2. When you open Busola in your browser, visit `http://localhost:3001?kubeconfigID={YOUR_KUBECONFIG_FILE_NAME}`. Busola will try to download that file and add it for your Busola instance.

### Set active environment

Expand All @@ -178,6 +178,84 @@ For the information on how to run tests and configure them, go to the [`tests`](
docker run --rm -it -p 3001:3001 -v <path to your custom config>:/app/core-ui/environments/ --env ENVIRONMENT={your-env} --pid=host --name busola europe-docker.pkg.dev/kyma-project/prod/busola:latest
```

## Deploy Busola in the Kubernetes Cluster

To install Busola in the Kubernetes cluster, run:

```shell
(cd resources && kustomize build base/ | kubectl apply -f- )
```

To install Busola using a specific environment configuration, set the `ENVIRONMENT` shell environment variable and run:

```shell
(cd resources && kustomize build environments/${ENVIRONMENT} | kubectl apply -f- )
```

## Access Busola Installed on Kubernetes

### kubectl

The simplest method that always works is to use the capabilities of kubectl.

```shell
kubectl port-forward services/busola 3001:3001
```

### k3d

Prerequisites:

- K3d with exposed loadbalancer on port 80.
> **TIP:** To create K3d with exposed load balancer run: `k3d cluster create -p "80:80@loadbalancer"`.
> See [Exposing Services](https://k3d.io/v5.6.3/usage/exposing_services/) for more details.

1. Install Ingress resources:

```shell
(cd resources && kubectl apply -f ingress/ingress.yaml)
```

2. Visit `localhost`

#### Connect to the k3d Cluster With Busola Installed.

To connect to the same k3d cluster with Busola installed, download kubeconfig and change the cluster server address to `https://kubernetes.default.svc:443`.

Use shell to quickly process the file
grego952 marked this conversation as resolved.
Show resolved Hide resolved

Prerequisites:

- [yq](https://mikefarah.gitbook.io/yq)

Set the `K3D_CLUSTER_NAME` shell environment variable to the name of your cluster and run:

```shell
k3d kubeconfig get ${K3D_CLUSTER_NAME} > k3d-kubeconfig.yaml
yq --inplace '.clusters[].cluster.server = "https://kubernetes.default.svc:443"' k3d-kubeconfig.yaml
pbochynski marked this conversation as resolved.
Show resolved Hide resolved
```

### Kubernetes Cluster with Istio Installed

Prerequisites:

- Sidecar Proxy injection enabled, see [Enable Istio Sidecar Proxy Injection](https://kyma-project.io/#/istio/user/tutorials/01-40-enable-sidecar-injection?id=enable-istio-sidecar-proxy-injection).
- The API Gateway module installed, see [Quick Install](https://kyma-project.io/#/02-get-started/01-quick-install)

1. Install the Istio required resources:

```shell
(cd resources && kubectl apply -k istio)
```

2. To get the Busola address, run:

```shell
kubectl get virtualservices.networking.istio.io
```

and find the `busola-***` virtual service. Under `HOSTS,` there is an address where you can access the Busola page.

## Troubleshooting

> **TIP:** To solve most of the problems with Busola development, clear the browser cache or do a hard refresh of the website.
Expand Down
18 changes: 6 additions & 12 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
APP_NAME = busola-backend
IMG_NAME := $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(APP_NAME)
TAG := $(DOCKER_TAG)


build-image:
docker build -t $(APP_NAME) -f Dockerfile .
push-image:
docker tag $(APP_NAME):latest $(IMG_NAME):$(TAG)
docker push $(IMG_NAME):$(TAG)

release: build-image push-image
##@ General
.DEFAULT_GOAL=help
.PHONY: help
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
4 changes: 1 addition & 3 deletions examples/custom-extension/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ function fetchWrapper(url, options = {}) {
}

function proxyFetch(url, options = {}) {
const baseUrl = window.location.hostname.startsWith('localhost')
? 'http://localhost:3001/proxy'
: '/proxy';
const baseUrl = '/proxy';
const encodedUrl = encodeURIComponent(url);
const proxyUrl = `${baseUrl}?url=${encodedUrl}`;
return fetch(proxyUrl, options);
Expand Down
18 changes: 0 additions & 18 deletions resources/apply-resources-istio.sh

This file was deleted.

22 changes: 0 additions & 22 deletions resources/apply-resources.sh

This file was deleted.

53 changes: 0 additions & 53 deletions resources/base/backend/deployment.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions resources/base/backend/hpa.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions resources/base/backend/service.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
name: busola
labels:
app: busola
spec:
Expand All @@ -16,27 +16,28 @@ spec:
spec:
containers:
- name: busola
image: busola-web
imagePullPolicy: Always
image: busola
imagePullPolicy: IfNotPresent
env:
- name: ENVIRONMENT
valueFrom:
configMapKeyRef:
optional: true
key: ENVIRONMENT
name: environment
volumeMounts:
- name: config
mountPath: /app/core-ui/config
resources:
requests:
cpu: 100m
memory: 21Mi
ports:
- containerPort: 8080
volumeMounts:
- name: config
mountPath: /app/core-ui/config
- containerPort: 3001
volumes:
- name: config
configMap:
optional: true
name: busola-config
items:
- key: config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web
name: busola
labels:
app: busola
spec:
pbochynski marked this conversation as resolved.
Show resolved Hide resolved
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
name: busola
minReplicas: 1
maxReplicas: 11
metrics:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: web
name: busola
labels:
app: busola
spec:
ports:
- port: 8080
name: http-web
targetPort: 8080
- port: 3001
name: http-busola
targetPort: 3001
selector:
app: busola
Loading
Loading