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 26 commits into
base: main
Choose a base branch
from
Open
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
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)
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. Go to `localhost`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think of it. What does it mean?
Go to the localhost folder? Something else?


#### 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`.

Using shell.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do what? Maybe we don't need this sentence.


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

This file was deleted.

Loading
Loading