Skip to content

Commit

Permalink
Improve the Helm chart (#31)
Browse files Browse the repository at this point in the history
* fix(helm): improve the chart
  • Loading branch information
bsctl authored Jun 11, 2023
1 parent e0b3fa2 commit a2a6984
Show file tree
Hide file tree
Showing 21 changed files with 198 additions and 110 deletions.
File renamed without changes
4 changes: 2 additions & 2 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
with:
version: 3.3.4
- name: Linting Chart
run: helm lint ./charts/console
run: helm lint ./charts/kamaji-console
- name: Setup Chart Linting
id: lint
uses: helm/[email protected]
- name: Helm Chart README check
id: helm-docs
run: |-
make -C charts/console helm-docs
make -C charts/kamaji-console helm-docs
if [[ $(git diff --stat) != '' ]]; then
echo -e '\033[0;31mDocumentation outdated! (Run make helm-docs locally and commit)\033[0m ❌'
git diff --color
Expand Down
46 changes: 22 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
# Clastix Dashboard
# Kamaji Console

View and control Kamaji with a simple user interface from the web.

![Kamaji Dashboard](.github/images/screen.png)
![Kamaji Console](.github/images/screen.png)

## How to use

Create a `.env` file with the information contained in [.env.example](.env.example)
## Deploy on Kubernetes

A sample manifest is available: `deploy/kamaji-console.yaml`. To deploy the console in the admin cluster, edit the manifest according to your environment and apply:

```bash
$ npm install
$ npm run dev
kubectl apply -f deploy/
```

The dashboard should be run in an environment with a default connection to kubenretes API.
Alternatively, install with Helm:

## Storybook
helm repo add clastix https://clastix.github.io/charts
helm repo update
helm install console clastix/kamaji-console -n kamaji-system --create-namespace

This repo contains visual UI tests using storybook. To run storybook
## Development

Create a `.env` file with the information contained in [.env.example](.env.example)

```bash
$ npm run storybook
$ npm install
$ npm run dev
```

## Features

1. Login with credentials or social login
2. Connect to TCP control plan`
The console should be run in an environment with a default connection to kubenretes API.

## Deploy on Kubernetes
## Storybook

A sample manifest is available: `./deploy/kamaji-dashboard.yaml`. To deploy the dashboard in the admin cluster, edit the manifest according to your environment and apply:
This repo contains visual UI tests using storybook. To run storybook

```bash
kubectl apply -f deploy/
$ npm run storybook
```

Assuming you have an Ingress Controller in place, the dashboard will be published as `https://kamaji.labs.clastix.io/ui`.

Enjoy!

## Connect to a child cluster

When reading child cluster resources, such as node, the dashboard uses the TCP kubeconfig in order to connect to the child cluster.
When running in dev mode, using `npm run dev`, the dashboard uses raw kubeconfig to connect to the cluster, in this way you should check that the child kubernetes API are reachable from your local development tool.
When reading child cluster resources, such as node, the console uses the TCP kubeconfig in order to connect to the child cluster.
When running in dev mode, using `npm run dev`, the console uses raw kubeconfig to connect to the cluster, in this way you should check that the child kubernetes API are reachable from your local development tool.

When build and deployed using docker, the dashboard supposes to be runned inside parent kubernetes cluster, so it connects to the TCP using the tcp service fqdn in order to talk with child cluster kubernetes api.
When build and deployed using docker, the console supposes to be runned inside parent kubernetes cluster, so it connects to the TCP using the tcp service fqdn in order to talk with child cluster kubernetes api.
File renamed without changes.
19 changes: 10 additions & 9 deletions charts/console/Chart.yaml → charts/kamaji-console/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
apiVersion: v2
name: console
description: Kamaji is a tool aimed to build and operate Kubernetes at scale
with a fraction of the operational burden. This chart install a console for Kamaji.
home: https://github.com/clastix/console
icon: https://github.com/clastix/console/raw/master/public/icon.png
name: kamaji-console
description: Kamaji deploys and operates Kubernetes at scale with a fraction of the operational burden. This chart install a console for Kamaji.
home: https://github.com/clastix/kamaji-console
icon: https://github.com/clastix/kamaji-console/raw/main/.github/images/icon.png
sources:
- https://github.com/clastix/console
- https://github.com/clastix/kamaji-console
annotations:
catalog.cattle.io/certified: partner
catalog.cattle.io/release-name: clastix-console
catalog.cattle.io/display-name: Clastix Console
catalog.cattle.io/release-name: kamaji-console
catalog.cattle.io/display-name: Kamaji Console
kubeVersion: ">=1.21.0-0"
maintainers:
- email: [email protected]
name: Ludovico Russo
- email: [email protected]
name: Dario Tranchitella
- email: [email protected]
Expand All @@ -29,7 +30,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.1
version: 0.0.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
File renamed without changes.
41 changes: 13 additions & 28 deletions charts/console/README.md → charts/kamaji-console/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# console
# kamaji-console

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)
![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)

Kamaji is a tool aimed to build and operate Kubernetes at scale with a fraction of the operational burden. This chart install a console for Kamaji.
Kamaji deploys and operates Kubernetes at scale with a fraction of the operational burden. This chart install a console for Kamaji.

## Install the console

Expand All @@ -25,7 +25,7 @@ data:
ADMIN_PASSWORD: <password>
# Secret used to sign the browser session
JWT_SECRET: <jwtSecret>
# URL where the console is accessible
# URL where the console is accessible: https://<hostname>/ui
NEXTAUTH_URL: <nextAuthUrl>
EOF
```
Expand All @@ -36,38 +36,22 @@ To install the Chart with the release name `kamaji-console` in the `kamaji-syste

helm repo add clastix https://clastix.github.io/charts
helm repo update
helm install kamaji-console clastix/console -n kamaji-system --create-namespace
helm install console clastix/kamaji-console -n kamaji-system --create-namespace

Show the status:

helm status kamaji-console -n kamaji-system
helm status console -n kamaji-system

Upgrade the Chart

helm upgrade kamaji-console -n kamaji-system clastix/console
helm upgrade console -n kamaji-system clastix/kamaji-console

Uninstall the Chart

helm uninstall kamaji-console -n kamaji-system
helm uninstall console -n kamaji-system

## Customize the installation

There are two methods for specifying overrides of values during Chart installation: `--values` and `--set`.

The `--values` option is the preferred method because it allows you to keep your overrides in a YAML file, rather than specifying them all on the command line.
Create a copy of the YAML file `values.yaml` and add your overrides to it.

Specify your overrides file when you install the Chart:

helm upgrade kamaji-console --install --namespace kamaji-system --create-namespace kamaji-system --values myvalues.yaml

The values in your overrides file `myvalues.yaml` will override their counterparts in the Chart's values.yaml file.
Any values in `values.yaml` that weren't overridden will keep their defaults.

If you only need to make minor customizations, you can specify them on the command line by using the `--set` option. For example:

helm upgrade kamaji-console --install --namespace kamaji-system --create-namespace kamaji-system --set replicas=2

Here the values you can override:

## Values
Expand All @@ -82,18 +66,18 @@ Here the values you can override:
| credentialsSecret.email | string | `""` | |
| credentialsSecret.generate | bool | `false` | |
| credentialsSecret.jwtSecret | string | `""` | |
| credentialsSecret.name | string | `"console"` | |
| credentialsSecret.name | string | `"kamaji-console"` | |
| credentialsSecret.nextAuthUrl | string | `""` | |
| credentialsSecret.password | string | `""` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"clastix/console"` | |
| image.repository | string | `"clastix/kamaji-console"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | type=kubernetes.io/dockerconfigjson |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0].host | string | `"clastix.local"` | |
| ingress.hosts[0].host | string | `"kamaji.localhost"` | |
| ingress.hosts[0].paths[0].path | string | `"/ui"` | |
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| ingress.tls | list | `[]` | |
Expand All @@ -116,9 +100,10 @@ Here the values you can override:

| Name | Email | Url |
| ---- | ------ | --- |
| Ludovico Russo | <[email protected]> | |
| Dario Tranchitella | <[email protected]> | |
| Adriano Pezzuto | <[email protected]> | |

## Source Code

* <https://github.com/clastix/console>
* <https://github.com/clastix/kamaji-console>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data:
ADMIN_PASSWORD: <password>
# Secret used to sign the browser session
JWT_SECRET: <jwtSecret>
# URL where the console is accessible
# URL where the console is accessible: https://<hostname>/ui
NEXTAUTH_URL: <nextAuthUrl>
EOF
```
Expand All @@ -37,38 +37,22 @@ To install the Chart with the release name `kamaji-console` in the `kamaji-syste

helm repo add clastix https://clastix.github.io/charts
helm repo update
helm install kamaji-console clastix/console -n kamaji-system --create-namespace
helm install console clastix/kamaji-console -n kamaji-system --create-namespace

Show the status:

helm status kamaji-console -n kamaji-system
helm status console -n kamaji-system

Upgrade the Chart

helm upgrade kamaji-console -n kamaji-system clastix/console
helm upgrade console -n kamaji-system clastix/kamaji-console

Uninstall the Chart

helm uninstall kamaji-console -n kamaji-system
helm uninstall console -n kamaji-system

## Customize the installation

There are two methods for specifying overrides of values during Chart installation: `--values` and `--set`.

The `--values` option is the preferred method because it allows you to keep your overrides in a YAML file, rather than specifying them all on the command line.
Create a copy of the YAML file `values.yaml` and add your overrides to it.

Specify your overrides file when you install the Chart:

helm upgrade kamaji-console --install --namespace kamaji-system --create-namespace kamaji-system --values myvalues.yaml

The values in your overrides file `myvalues.yaml` will override their counterparts in the Chart's values.yaml file.
Any values in `values.yaml` that weren't overridden will keep their defaults.

If you only need to make minor customizations, you can specify them on the command line by using the `--set` option. For example:

helm upgrade kamaji-console --install --namespace kamaji-system --create-namespace kamaji-system --set replicas=2

Here the values you can override:

{{ template "chart.valuesSection" . }}
Expand Down
30 changes: 30 additions & 0 deletions charts/kamaji-console/app-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Kamaji - Managed Kubernetes Service

Kamaji is a tool aimed to build and operate a Managed Kubernetes Service with a fraction of the operational burden.

Useful links:
- [Kamaji Github repository](https://github.com/clastix/kamaji)
- [Kamaji Documentation](https://github.com/clastix/kamaji/docs/)

## Requirements

* Kubernetes v1.22+
* Helm v3

# Installation

To install the Chart with the release name `kamaji`:

helm upgrade --install --namespace kamaji-system --create-namespace clastix/kamaji

Show the status:

helm status kamaji -n kamaji-system

Upgrade the Chart

helm upgrade kamaji -n kamaji-system clastix/kamaji

Uninstall the Chart

helm uninstall kamaji -n kamaji-system
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "console.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
echo http://$NODE_IP:$NODE_PORT/ui
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "console.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "console.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
echo http://$SERVICE_IP:{{ .Values.service.port }}/ui
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "console.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
echo "Visit http://127.0.0.1:8080/ui to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "console.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: kamaji-console
{{- include "console.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
Expand All @@ -43,19 +33,12 @@ spec:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a2a6984

Please sign in to comment.