From 3c37e8cc3ca3b7487a048656ae471d0246f28f14 Mon Sep 17 00:00:00 2001
From: Nikos Makris <nimakris@uth.gr>
Date: Fri, 13 Sep 2024 17:18:33 +0200
Subject: [PATCH] Fixes for running the master branch on the UTH nodes

---
 README.md                                     | 19 ++++++++++++++++++-
 lpg.yaml                                      |  3 ++-
 roles/5g/base/files/gen_oai.py                |  4 ++--
 roles/5g/base/tasks/main.yaml                 |  6 +++---
 roles/5g/base/templates/manifest.yaml         |  4 ++--
 .../cadvisor/templates/cadvisor.yaml.j2       |  8 ++++----
 6 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 052b118..1cb0947 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,23 @@
 
 ## Deployment node
 
+```console
+sudo apt install docker.io
+```
+
+If there is no id_rsa file, create it with the following command:
+
+```console
+ssh-keygen -t rsa
+```
+
+Then copy the .pub file to the $HOME/.ssh/authorized_hosts of all the nodes that will be managed by the deployment container
+```
+cat $HOME/.ssh/id_rsa.pub
+```
+
+To build the deployment container: 
+
 ```console
 docker build -t deployment_node -f Dockerfile .
 ```
@@ -47,4 +64,4 @@ ansible-playbook -i inventories/staging --extra-vars "@params.yaml" --extra-vars
 ## Deploy 5G network
 ```console
 ansible-playbook -i inventories/staging --extra-vars "@params.yaml" --extra-vars "@params.5g.yaml" --extra-vars "@secrets.yaml" --ask-vault-pass 5g.yaml 
-```
\ No newline at end of file
+```
diff --git a/lpg.yaml b/lpg.yaml
index 4a840cf..67c2a58 100644
--- a/lpg.yaml
+++ b/lpg.yaml
@@ -4,7 +4,8 @@
     prometheus_basic_auth_password: "{{ secrets['prometheus_basic_auth_password'] }}"
     grafana_password: "{{ secrets['grafana_password'] }}"
   roles:
+    - docker/tasks
     - grafana-loki-prometheus/prometheus
     - grafana-loki-prometheus/loki
     - grafana-loki-prometheus/grafana
-    
\ No newline at end of file
+    
diff --git a/roles/5g/base/files/gen_oai.py b/roles/5g/base/files/gen_oai.py
index de2b458..a5b6d38 100644
--- a/roles/5g/base/files/gen_oai.py
+++ b/roles/5g/base/files/gen_oai.py
@@ -134,7 +134,7 @@ def render(templatepath, gcn):
 
 # ==============================================================================
 # load configurations
-with open('roles/5g/templates/manifest.yaml', "r") as file:
+with open('roles/5g/base/templates/manifest.yaml', "r") as file:
   tpls = yaml.safe_load(file)
 
 core = yaml.safe_load(os.environ['params_5g'])
@@ -157,4 +157,4 @@ for item in tpls["templates"]:
     content = render(path, gcn)
   else:
     content = readFile("/".join([tpls["output_dir"], path ]))
-  createFile(content, item['output'])
\ No newline at end of file
+  createFile(content, item['output'])
diff --git a/roles/5g/base/tasks/main.yaml b/roles/5g/base/tasks/main.yaml
index ca6a7dc..664e3f6 100644
--- a/roles/5g/base/tasks/main.yaml
+++ b/roles/5g/base/tasks/main.yaml
@@ -10,8 +10,8 @@
     args:
       chdir: oai-cn5g-fed
 
-  - name: generate OAI files
-    ansible.builtin.shell: python3 roles/5g/files/gen_oai.py
+  - name: generate OAI files 
+    ansible.builtin.shell: python3 roles/5g/base/files/gen_oai.py
     environment:
       params_5g:
         GCN: '{{ GCN }}'
@@ -39,4 +39,4 @@
 # # Deploy the UE
 # - name: Deploy the UE
 #   ansible.builtin.include_tasks: 'ue.yaml'
-#   when: GCN.UE is defined and GCN.UE.present
\ No newline at end of file
+#   when: GCN.UE is defined and GCN.UE.present
diff --git a/roles/5g/base/templates/manifest.yaml b/roles/5g/base/templates/manifest.yaml
index 1907319..a21c559 100644
--- a/roles/5g/base/templates/manifest.yaml
+++ b/roles/5g/base/templates/manifest.yaml
@@ -1,4 +1,4 @@
-output_dir: roles/5g/templates/oai-cn5g-fed/charts
+output_dir: roles/5g/base/templates/oai-cn5g-fed/charts
 templates:
   - template: oai-5g-core/oai-5g-basic/config.yaml.j2
     output: ./oai-cn5g-fed/charts/oai-5g-core/oai-5g-basic/config.yaml
@@ -22,4 +22,4 @@ templates:
   - template: oai-5g-ran/oai-gnb/templates/configmap.yaml
     output: ./oai-cn5g-fed/charts/oai-5g-ran/oai-gnb/templates/configmap.yaml
   - template: oai-5g-ran/oai-gnb/templates/deployment.yaml
-    output: ./oai-cn5g-fed/charts/oai-5g-ran/oai-gnb/templates/deployment.yaml
\ No newline at end of file
+    output: ./oai-cn5g-fed/charts/oai-5g-ran/oai-gnb/templates/deployment.yaml
diff --git a/roles/post-5g-bp-cluster-monitoring/cadvisor/templates/cadvisor.yaml.j2 b/roles/post-5g-bp-cluster-monitoring/cadvisor/templates/cadvisor.yaml.j2
index 3827fdd..4c9eb3f 100644
--- a/roles/post-5g-bp-cluster-monitoring/cadvisor/templates/cadvisor.yaml.j2
+++ b/roles/post-5g-bp-cluster-monitoring/cadvisor/templates/cadvisor.yaml.j2
@@ -21,11 +21,11 @@ spec:
         - containerPort: 8080
         resources:
           limits:
-            cpu: 200m
-            memory: 200Mi
+            cpu: 300m
+            memory: 400Mi
           requests:
-            cpu: 100m
-            memory: 100Mi
+            cpu: 150m
+            memory: 200Mi
         volumeMounts:
         - name: rootfs
           mountPath: /rootfs
-- 
GitLab