From 4557f110be3cf8d2137e373f6a874a20aa4e32c9 Mon Sep 17 00:00:00 2001
From: dgiannopoulos <dimitris.giannopoulos@hotmail.com>
Date: Thu, 4 Jul 2024 11:13:34 +0300
Subject: [PATCH] feat: removed PVs, updated docs

---
 kubernetes/helm/README.md                     | 28 ++++---------
 .../openslice/templates/oasapi-pv-pvc.yaml    | 39 -------------------
 .../helm/openslice/templates/oasapi.yaml      |  7 ----
 .../helm/openslice/templates/osom-pv-pvc.yaml | 39 -------------------
 kubernetes/helm/openslice/templates/osom.yaml |  7 ----
 5 files changed, 8 insertions(+), 112 deletions(-)
 delete mode 100644 kubernetes/helm/openslice/templates/oasapi-pv-pvc.yaml
 delete mode 100644 kubernetes/helm/openslice/templates/osom-pv-pvc.yaml

diff --git a/kubernetes/helm/README.md b/kubernetes/helm/README.md
index 303f11d..b3459eb 100644
--- a/kubernetes/helm/README.md
+++ b/kubernetes/helm/README.md
@@ -1,21 +1,3 @@
-<!-- 
-### Additional Configuration
-
-- **Ingress Controller**: An Nginx ingress controller is required. If you use another type of ingress controller, you'll need to modify `[repo-root]/kubernetes/helm/openslice/templates/openslice-ingress.yaml` to conform to your ingress controller's requirements.
-  
-- **Storage Class**: Define your type of `storageClass` in `[repo-root]/kubernetes/helm/openslice/values.yaml` under `storageClass`. If this is not defined, the PVs (Persistent Volumes) will be created and managed manually by the Helm chart.
-
-- **Domain/IP Address**: You need to have a domain or an IP address to access the application. This should be defined in `[repo-root]/kubernetes/helm/openslice/values.yaml` under `rooturl`.
-
-# Install helm chart
-```
-helm install myopenslice ./openslice --namespace openslice --create-namespace
-```
-
-# Uninstall helm chart
-```
-helm uninstall myopenslice --namespace openslice
-``` -->
 # OpenSlice Installation Guide with Kubernetes
 
 ## Requirements
@@ -31,14 +13,20 @@ helm uninstall myopenslice --namespace openslice
 ### Software Requirements:
 
 * **git:** For cloning the project repository.
-* **Kubernetes:** A running cluster where OpenSlice will be deployed.
+* **Kubernetes:** A running cluster where OpenSlice will be deployed. 
+    * **Disclaimer:** The current manual setup of Persistent Volumes using `hostPath` is designed to operate with **only a single worker node**. This setup will not support data persistence if a pod is rescheduled to another node.
 * **Helm:** For managing the deployment of OpenSlice.
-* **Ingress Controller:** Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource. An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic. You must have an Ingress controller to satisfy an Ingress. 
+* **Ingress Controller:** Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource. An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic. You must have an Ingress controller to satisfy an Ingress.
     * An Nginx ingress controller is required, which can be installed using [this guide](https://docs.nginx.com/nginx-ingress-controller/installation/installing-nic/installation-with-helm/). 
     * If you use another type of ingress controller, you'll need to modify `[repo-root]/kubernetes/helm/openslice/templates/openslice-ingress.yaml` to conform to your ingress controller's requirements.
 * **Network Load Balancer:** Required for exposing the service (e.g., GCP, AWS, Azure, MetalLB).
 * **Domain/IP Address:** Necessary for accessing the application. This should be configured in `[repo-root]/kubernetes/helm/openslice/values.yaml` under `rooturl`.
 
+### Additional Configuration
+
+* **Storage Class:** In a production environment, specify your `storageClass` in `[repo-root]/kubernetes/helm/openslice/values.yaml` under `storageClass`. If not defined, PVs will be created and managed manually.
+    * **Disclaimer:** Before deploying, confirm that your storage system supports claims of one 10G and two 1G volumes.
+
 ## Preparing the environment
 
 ### 1. Setting Up A Kubernetes Cluster
diff --git a/kubernetes/helm/openslice/templates/oasapi-pv-pvc.yaml b/kubernetes/helm/openslice/templates/oasapi-pv-pvc.yaml
deleted file mode 100644
index 7b14641..0000000
--- a/kubernetes/helm/openslice/templates/oasapi-pv-pvc.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  namespace: {{ .Release.Namespace }}
-  labels:
-    app: {{ include "openslice.fullname" . }}
-    org.etsi.osl.service: oasapi
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    {{- include "openslice.labels" . | nindent 4 }}
-  name: {{ include "openslice.fullname" . }}-oasapi-claim0
-spec:
-  storageClassName: {{ .Values.storageClass | default "oasapi-pv-manual" }}
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: "100Mi"
----
-{{- if or (not .Values.storageClass) (eq .Values.storageClass "manual") }}
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  namespace: {{ .Release.Namespace }}
-  labels:
-    app: {{ include "openslice.fullname" . }}
-    org.etsi.osl.service: oasapi
-    type: local
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    {{- include "openslice.labels" . | nindent 4 }}
-  name: {{ include "openslice.fullname" . }}-oasapi-pv-volume
-spec:
-  storageClassName: "oasapi-pv-manual"
-  capacity:
-    storage: "100Mi"
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/dockerdata-nfs/oasapi"
-{{- end }}
diff --git a/kubernetes/helm/openslice/templates/oasapi.yaml b/kubernetes/helm/openslice/templates/oasapi.yaml
index 32e1d13..ea1ffac 100644
--- a/kubernetes/helm/openslice/templates/oasapi.yaml
+++ b/kubernetes/helm/openslice/templates/oasapi.yaml
@@ -61,18 +61,11 @@ spec:
             {{- toYaml .Values.resources | nindent 12 }}
           ports:
             - containerPort: 13101
-          volumeMounts:
-            - mountPath: /root
-              name: {{ include "openslice.fullname" . }}-oasapi-claim0
           readinessProbe:
             httpGet:
               path: /oas-api/swagger-ui/index.html
               port: 13101
       restartPolicy: Always
-      volumes:
-        - name: {{ include "openslice.fullname" . }}-oasapi-claim0
-          persistentVolumeClaim:
-            claimName: {{ include "openslice.fullname" . }}-oasapi-claim0
 ---
 apiVersion: v1
 kind: Service
diff --git a/kubernetes/helm/openslice/templates/osom-pv-pvc.yaml b/kubernetes/helm/openslice/templates/osom-pv-pvc.yaml
deleted file mode 100644
index 97e8061..0000000
--- a/kubernetes/helm/openslice/templates/osom-pv-pvc.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  namespace: {{ .Release.Namespace }}
-  labels:
-    app: {{ include "openslice.fullname" . }}
-    org.etsi.osl.service: osom
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    {{- include "openslice.labels" . | nindent 4 }}
-  name: {{ include "openslice.fullname" . }}-osom-claim0
-spec:
-  storageClassName: {{ .Values.storageClass | default "osom-pv-manual" }}
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: "1Gi"
----
-{{- if or (not .Values.storageClass) (eq .Values.storageClass "manual") }}
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  namespace: {{ .Release.Namespace }}
-  labels:
-    app: {{ include "openslice.fullname" . }}
-    org.etsi.osl.service: osom
-    type: local
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    {{- include "openslice.labels" . | nindent 4 }}
-  name: {{ include "openslice.fullname" . }}-osom-pv-volume
-spec:
-  storageClassName: "osom-pv-manual"
-  capacity:
-    storage: "1Gi"
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/dockerdata-nfs/osom"
-{{- end }}
diff --git a/kubernetes/helm/openslice/templates/osom.yaml b/kubernetes/helm/openslice/templates/osom.yaml
index a5d3ab3..a7b758e 100644
--- a/kubernetes/helm/openslice/templates/osom.yaml
+++ b/kubernetes/helm/openslice/templates/osom.yaml
@@ -42,14 +42,7 @@ spec:
             {{- toYaml .Values.resources | nindent 12 }}
           ports:
             - containerPort: 13100
-          volumeMounts:
-            - mountPath: /root
-              name: {{ include "openslice.fullname" . }}-osom-claim0
       restartPolicy: Always
-      volumes:
-        - name: {{ include "openslice.fullname" . }}-osom-claim0
-          persistentVolumeClaim:
-            claimName: {{ include "openslice.fullname" . }}-osom-claim0
 ---
 apiVersion: v1
 kind: Service
-- 
GitLab