Commit 963a9e55 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

Merge branch 'feat/app-management' into 'main'

feat: add helm charts and integrate with OOP platform

See merge request !1
parents 1fb6a7da a2fad30c
Loading
Loading
Loading
Loading

UI/.gitkeep

deleted100644 → 0
+0 −0

Empty file deleted.

deployment/Chart.yaml

0 → 100644
+15 −0
Original line number Diff line number Diff line
apiVersion: v2
name: portal
description: Helm chart for the Portal frontend (Next.js)
type: application
version: 0.1.0
appVersion: "1.0.0"
keywords:
  - frontend
  - oop
  - etsi
  - portal  
home: https://labs.etsi.org/rep/oop/code/dev-portal
maintainers:
  - name: OOP Team

deployment/README.md

0 → 100644
+85 −0
Original line number Diff line number Diff line
# Portal Helm Chart

Deploy the Portal frontend (Next.js) to Kubernetes.

## Prerequisites

- Helm 3
- Kubernetes cluster
- Portal image (build from `portal-gui/` or use a registry)

## Build the image

From the repo root:

```bash
docker build -t portal-gui:latest -f portal/portal-gui/Dockerfile portal/portal-gui
```

For **Kind**, load the image into the cluster:

```bash
kind load docker-image portal-gui:latest
```

## Install

```bash
cd portal/deployment
helm install portal .
```

Override the image tag to use your built image:

```bash
helm install portal . --set image.tag=latest
```

Set the OEG service URL (used by the frontend as `OEG_SERVICE_URL`):

```bash
helm install portal . \
  --set image.tag=latest \
  --set config.oegServiceUrl=http://oeg-service:8080
```

If the default NodePort is already in use, pick another (30000–32767):

```bash
helm install portal . --set service.nodePort=30081
```

## Upgrade

```bash
helm upgrade portal . --set image.tag=latest
```

## Get the URL

After install, Helm prints the URL. You can also run:

```bash
kubectl get svc -l app.kubernetes.io/name=portal -o jsonpath='http://{.items[0].spec.clusterIP}:{.items[0].spec.ports[0].port}'
```

For **NodePort**, use the node IP and `nodePort` (see `kubectl get svc -l app.kubernetes.io/name=portal`).

## Uninstall

```bash
helm uninstall portal
```

## Main values

| Value | Default | Description |
|-------|---------|-------------|
| `image.repository` | `portal-gui` | Image name |
| `image.tag` | `1.0.0` | Image tag |
| `config.oegServiceUrl` | `""` | OEG service base URL (env `OEG_SERVICE_URL`) |
| `service.type` | `NodePort` | Service type |
| `service.nodePort` | `30082` | NodePort (when type is NodePort) |
| `replicaCount` | `1` | Number of replicas |

See `values.yaml` for all options.
+16 −0
Original line number Diff line number Diff line
Portal frontend has been deployed.

1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "portal.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.
  kubectl get --namespace {{ .Release.Namespace }} svc {{ include "portal.fullname" . }} -w
{{- else if contains "ClusterIP" .Values.service.type }}
  kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "portal.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }}
  echo "Visit http://127.0.0.1:{{ .Values.service.port }}"
{{- end }}

OEG_SERVICE_URL is set to: {{ .Values.config.oegServiceUrl }}
+38 −0
Original line number Diff line number Diff line
{{- define "portal.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "portal.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 }}

{{- define "portal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{- define "portal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "portal.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "portal.configMapName" -}}
{{- include "portal.fullname" . }}-config
{{- end }}
Loading