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

Merged
merged 45 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 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
2895c05
build busola prod
dbadura Jan 13, 2025
6b71bd6
fix job
dbadura Jan 13, 2025
1c2c190
adjust other tests
dbadura Jan 13, 2025
d22af69
tmp fix for lighthouse
dbadura Jan 13, 2025
22c968a
add sudo
dbadura Jan 13, 2025
baca096
upgrade playwritht
dbadura Jan 13, 2025
b06c739
fix lighthouse
dbadura Jan 13, 2025
55fcd90
improve tests
dbadura Jan 13, 2025
51d846e
revert changes
dbadura Jan 13, 2025
25205d1
fix
dbadura Jan 13, 2025
4183c33
Merge branch 'main' into busola-k8s
dbadura Jan 14, 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
19 changes: 19 additions & 0 deletions .github/scripts/setup_local_busola.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# This script returns the id of the draft release

# standard bash error handling
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

npm ci
npm run build
cp -r build backend/core-ui
cd backend
npm run build
IS_DOCKER=true npm run start:prod > busola.log &
export DOMAIN=http://localhost:3001
echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done
24 changes: 5 additions & 19 deletions .github/workflows/pull-integration-cluster-k3d.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: PR Integration Cluster Tests

on:
on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
types: [ opened, edited, synchronize, reopened, ready_for_review ]
paths:
- ".github/workflows/pull-integration-cluster-k3d.yml"
- "resources/**"
Expand Down Expand Up @@ -39,28 +39,15 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: Setup Busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
.github/scripts/setup_local_busola.sh
- name: run_tests
shell: bash
run: |
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3000
serve -s build > busola.log &

pushd backend
npm start > backend.log &
popd

echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
sleep 10

export CYPRESS_DOMAIN=http://localhost:3001
cd tests/integration
npm ci && npm run "test:cluster"
- name: Uploads artifacts
Expand All @@ -76,6 +63,5 @@ jobs:
with:
name: busola-logs-${{ github.job }}
path: |
backend/backend.log
busola.log
retention-days: 90
24 changes: 5 additions & 19 deletions .github/workflows/pull-integration-namespace-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,15 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: Setup Busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
- name: run_tests
.github/scripts/setup_local_busola.sh
- name: Run tests
shell: bash
run: |
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3000
serve -s build > busola.log &

pushd backend
npm start > backend.log &
popd

echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
sleep 10

export CYPRESS_DOMAIN=http://localhost:3001
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
cd tests/integration
npm ci && npm run "test:namespace"
- name: Uploads artifacts
Expand All @@ -76,6 +63,5 @@ jobs:
with:
name: busola-logs-${{ github.job }}
path: |
backend/backend.log
busola.log
retention-days: 90
6 changes: 3 additions & 3 deletions .github/workflows/pull-kyma-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: Setup Busola
shell: bash
run: |
./.github/scripts/setup-busola.sh | tee busola-build.log
.github/scripts/setup-busola.sh | tee busola-build.log
env:
ENV: dev
- name: run_tests
- name: Run tests
shell: bash
run: |
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
Expand Down
21 changes: 3 additions & 18 deletions .github/workflows/pull-lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: Run busola
shell: bash
run: |
set -e
npm ci
npm run build
npm i -g serve
- name: run_tests
.github/scripts/setup_local_busola.sh
- name: Run lighthouse tests
shell: bash
run: |
k3d kubeconfig get k3dCluster > tests/lighthouse/fixtures/kubeconfig.yaml
export DOMAIN=http://localhost:3000
serve -s build > busola.log &

pushd backend
npm start > backend.log &
popd

echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done
sleep 10

cd tests/lighthouse
npm ci && npx playwright install --with-deps && npm run "test"
- name: Upload Busola logs
Expand All @@ -62,6 +48,5 @@ jobs:
with:
name: busola-logs-${{ github.job }}
path: |
backend/backend.log
busola.log
retention-days: 90
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.

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
2 changes: 2 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ yarn-error.log*

backend-production.js
backend-production.js.LICENSE*
core-ui
busola.log
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.

Loading
Loading