From ef9372b61555178d2a80df91e34af408246087f4 Mon Sep 17 00:00:00 2001
From: Lluis Gifre <lluis.gifre@cttc.es>
Date: Tue, 26 Jul 2022 15:52:28 +0000
Subject: [PATCH] Fixed
 L3_AttackMitigator/L3_CentralizedAttackDetector/L3_DistributedAttackDetector

- Fixed object names in L3_* manifest files
- Corrected object name in scale commands
---
 deploy_in_kubernetes.sh                            |  6 ++++--
 manifests/l3_attackmitigatorservice.yaml           | 10 +++++-----
 manifests/l3_centralizedattackdetectorservice.yaml | 10 +++++-----
 manifests/l3_distributedattackdetectorservice.yaml | 10 +++++-----
 4 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/deploy_in_kubernetes.sh b/deploy_in_kubernetes.sh
index c81bfc5f1..b6e0c8c1c 100755
--- a/deploy_in_kubernetes.sh
+++ b/deploy_in_kubernetes.sh
@@ -112,8 +112,10 @@ for COMPONENT in $COMPONENTS; do
     echo "  Deploying '$COMPONENT' component to Kubernetes..."
     DEPLOY_LOG="$TMP_LOGS_FOLDER/deploy_${COMPONENT}.log"
     kubectl --namespace $K8S_NAMESPACE apply -f "$MANIFEST" > "$DEPLOY_LOG"
-    kubectl --namespace $K8S_NAMESPACE scale deployment --replicas=0 ${COMPONENT}service >> "$DEPLOY_LOG"
-    kubectl --namespace $K8S_NAMESPACE scale deployment --replicas=1 ${COMPONENT}service >> "$DEPLOY_LOG"
+
+    COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/")
+    kubectl --namespace $K8S_NAMESPACE scale deployment --replicas=0 ${COMPONENT_OBJNAME}service >> "$DEPLOY_LOG"
+    kubectl --namespace $K8S_NAMESPACE scale deployment --replicas=1 ${COMPONENT_OBJNAME}service >> "$DEPLOY_LOG"
     printf "\n"
 done
 
diff --git a/manifests/l3_attackmitigatorservice.yaml b/manifests/l3_attackmitigatorservice.yaml
index a0d1b3295..2240776eb 100644
--- a/manifests/l3_attackmitigatorservice.yaml
+++ b/manifests/l3_attackmitigatorservice.yaml
@@ -15,15 +15,15 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: l3_attackmitigatorservice
+  name: l3-attackmitigatorservice
 spec:
   selector:
     matchLabels:
-      app: l3_attackmitigatorservice
+      app: l3-attackmitigatorservice
   template:
     metadata:
       labels:
-        app: l3_attackmitigatorservice
+        app: l3-attackmitigatorservice
     spec:
       terminationGracePeriodSeconds: 5
       containers:
@@ -52,11 +52,11 @@ spec:
 apiVersion: v1
 kind: Service
 metadata:
-  name: l3_attackmitigatorservice
+  name: l3-attackmitigatorservice
 spec:
   type: ClusterIP
   selector:
-    app: l3_attackmitigatorservice
+    app: l3-attackmitigatorservice
   ports:
   - name: grpc
     port: 10002
diff --git a/manifests/l3_centralizedattackdetectorservice.yaml b/manifests/l3_centralizedattackdetectorservice.yaml
index a41e76f2b..fa7ee9dcc 100644
--- a/manifests/l3_centralizedattackdetectorservice.yaml
+++ b/manifests/l3_centralizedattackdetectorservice.yaml
@@ -15,15 +15,15 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: l3_centralizedattackdetectorservice
+  name: l3-centralizedattackdetectorservice
 spec:
   selector:
     matchLabels:
-      app: l3_centralizedattackdetectorservice
+      app: l3-centralizedattackdetectorservice
   template:
     metadata:
       labels:
-        app: l3_centralizedattackdetectorservice
+        app: l3-centralizedattackdetectorservice
     spec:
       terminationGracePeriodSeconds: 5
       containers:
@@ -52,11 +52,11 @@ spec:
 apiVersion: v1
 kind: Service
 metadata:
-  name: l3_centralizedattackdetectorservice
+  name: l3-centralizedattackdetectorservice
 spec:
   type: ClusterIP
   selector:
-    app: l3_centralizedattackdetectorservice
+    app: l3-centralizedattackdetectorservice
   ports:
   - name: grpc
     port: 10001
diff --git a/manifests/l3_distributedattackdetectorservice.yaml b/manifests/l3_distributedattackdetectorservice.yaml
index 537915a39..6b28f68dd 100644
--- a/manifests/l3_distributedattackdetectorservice.yaml
+++ b/manifests/l3_distributedattackdetectorservice.yaml
@@ -15,15 +15,15 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: l3_distributedattackdetectorservice
+  name: l3-distributedattackdetectorservice
 spec:
   selector:
     matchLabels:
-      app: l3_distributedattackdetectorservice
+      app: l3-distributedattackdetectorservice
   template:
     metadata:
       labels:
-        app: l3_distributedattackdetectorservice
+        app: l3-distributedattackdetectorservice
     spec:
       terminationGracePeriodSeconds: 5
       containers:
@@ -52,11 +52,11 @@ spec:
 apiVersion: v1
 kind: Service
 metadata:
-  name: l3_distributedattackdetectorservice
+  name: l3-distributedattackdetectorservice
 spec:
   type: ClusterIP
   selector:
-    app: l3_distributedattackdetectorservice
+    app: l3-distributedattackdetectorservice
   ports:
   - name: grpc
     port: 10000
-- 
GitLab