Skip to content

Commit

Permalink
Add openshft-console
Browse files Browse the repository at this point in the history
  • Loading branch information
kvaps committed Dec 16, 2024
1 parent e44bece commit 5c9bf36
Show file tree
Hide file tree
Showing 27 changed files with 1,174 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/platform/bundles/paas-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ releases:
dependsOn: []
{{- end }}

- name: console
releaseName: console
chart: cozy-console
namespace: cozy-console
dependsOn: [cilium,kubeovn]

- name: kamaji
releaseName: kamaji
chart: cozy-kamaji
Expand Down
6 changes: 6 additions & 0 deletions packages/core/platform/bundles/paas-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ releases:
dependsOn: []
{{- end }}

- name: console
releaseName: console
chart: cozy-console
namespace: cozy-console
dependsOn: [cilium,kubeovn]

{{- if $oidcEnabled }}
- name: keycloak
releaseName: keycloak
Expand Down
3 changes: 3 additions & 0 deletions packages/system/console/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: cozy-console
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
5 changes: 5 additions & 0 deletions packages/system/console/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export NAME=console
export NAMESPACE=cozy-$(NAME)

include ../../../scripts/common-envs.mk
include ../../../scripts/package.mk
23 changes: 23 additions & 0 deletions packages/system/console/charts/openshift-console/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
7 changes: 7 additions & 0 deletions packages/system/console/charts/openshift-console/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
appVersion: 4.20.0
description: OpenShift Cluster Console UI
icon: https://avatars0.githubusercontent.com/u/792337?s=200&v=4
name: openshift-console
type: application
version: 0.3.6
75 changes: 75 additions & 0 deletions packages/system/console/charts/openshift-console/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# OpenShift Console (Bridge)

[Bridge](https://github.com/openshift/console) is the OpenShift console.

## TL;DR

```console
$ helm repo add av1o https://av1o.gitlab.io/charts
$ helm install bridge av1o/openshift-console
```

## Introduction

This chart bootstraps a deployment of the OpenShift Console on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

The OpenShift Console is designed for running on OpenShift, however it works perfectly fine in native Kubernetes. Since the Console is unable to use the default OpenShift OAuth2, this chart is expecting a Dex deployment which is configured to generate OIDC tokens for the Kubernetes API server.
This behaviour can be configured with the `extraEnv` map.

## Prerequisites

- Kubernetes 1.12+
- Helm 3

## Installing the Chart
To install the chart with the release name `my-release`:

```console
$ helm install my-release av1o/openshift-console
```

The command deploys the console on the Kubernetes cluster in the default configuration.

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

## Parameters

The following table lists the configurable parameters of the OpenShift Console chart and their default values.

| Parameter | Description | Default |
|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `replicaCount` | Number of pods to run | 1 |
| `image.registry` | Docker image registry | `quay.io` |
| `image.repository` | Docker image name | `openshift/origin-console` |
| `image.pullPolicy` | Docker image pull policy | `IfNotPresent` |
| `image.tag` | Docker image tag | `${CHART_VERSION}` |
| `imagePullSecrets` | Specify Image pull secrets | `[]` |
| `podAnnotations` | Map of annotations to add to the pods | See `values.yaml` |
| `podSecurityContext` | Map of security context to add to the pod | See `values.yaml` |
| `securityContext` | Map of security context to add to the container | See `values.yaml` |
| `service.type` | Service type | `ClusterIP` |
| `extraEnv` | Map of environment variables to include in the container | `{}` |
| `console.dex.host` | HTTP(S) address of the Dex instance | `https://dex.example.org` |
| `console.baseUrl` | HTTP(S) address of the Console | `https://console.example.org` |
| `console.impersonateOpenShift` | Install CRDs to trick the Console into showing some OpenShift-exclusive actions which work on Kubernetes. Note: requires `cluster-admin` | `false` |
| `console.oidc.enabled` | Enable OIDC authentication | `true` |
| `console.oidc.issuerUrl` | Issuer of the OIDC server | `https://dex.example.org` |
| `console.oidc.clientId` | OIDC client ID | `kubernetes` |
| `console.oidc.clientSecret` | OIDC client secret | `hunter2` |
| `rbac.enabled` | Install RBAC to trick the Console into behaving closer to how OpenShift does. Required `cluster-admin` and `console.impersonateOpenShift=true` | `false` |
| `ingress.className` | IngressClass resource to use. | |
| `sidecars` | Arbitrary sidecars to include as-is | `[]` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

### Version `0.2.X`

Version `0.2.0` and above require the `networking.k8s.io/v1` API for Ingress which is available in Kubernetes 1.19 and above.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "kubernetes.default.svc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sidecars:
- name: your-image-name
image: your-image
imagePullPolicy: Always
ports:
- name: portname
containerPort: 1234
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "openshift-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
{{- 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 "openshift-console.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "openshift-console.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "openshift-console.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "openshift-console.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "openshift-console.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "openshift-console.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "openshift-console.labels" -}}
helm.sh/chart: {{ include "openshift-console.chart" . }}
{{ include "openshift-console.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "openshift-console.selectorLabels" -}}
app.kubernetes.io/name: {{ include "openshift-console.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "openshift-console.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "openshift-console.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Renders a value that contains template.
Usage:
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.console.impersonateOpenShift }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: apps.apps.openshift.io
spec:
group: apps.openshift.io
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties: {}
scope: Namespaced
names:
plural: apps
singular: app
kind: OpenShift
{{- end }}
Loading

0 comments on commit 5c9bf36

Please sign in to comment.