Commit 17ea06ef authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/opt-cybersecurity' into 'develop'

Optical cybersecurity scenario

See merge request !97
parents 3cfe485c 4fef04d1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -28,9 +28,10 @@ include:
  - local: '/src/context/.gitlab-ci.yml'
  - local: '/src/device/.gitlab-ci.yml'
  - local: '/src/service/.gitlab-ci.yml'
  #- local: '/src/dbscanserving/.gitlab-ci.yml'
  #- local: '/src/opticalattackmitigator/.gitlab-ci.yml'
  #- local: '/src/opticalcentralizedattackdetector/.gitlab-ci.yml'
  - local: '/src/dbscanserving/.gitlab-ci.yml'
  - local: '/src/opticalattackmitigator/.gitlab-ci.yml'
  - local: '/src/opticalattackdetector/.gitlab-ci.yml'
  - local: '/src/opticalattackmanager/.gitlab-ci.yml'
  - local: '/src/automation/.gitlab-ci.yml'
  - local: '/src/policy/.gitlab-ci.yml'
  #- local: '/src/webui/.gitlab-ci.yml'
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ coverage==6.3
grpcio==1.47.*
grpcio-health-checking==1.47.*
grpcio-tools==1.47.*
grpclib[protobuf]
prettytable==3.5.0
prometheus-client==0.13.0
protobuf==3.20.*
+8 −0
Original line number Diff line number Diff line
@@ -175,6 +175,14 @@ echo "# Environment variables for TeraFlowSDN deployment" > $ENV_VARS_SCRIPT
PYTHONPATH=$(pwd)/src
echo "export PYTHONPATH=${PYTHONPATH}" >> $ENV_VARS_SCRIPT

echo "Create Redis secret..."
# first try to delete an old one if exists
kubectl delete secret redis-secrets --namespace=$TFS_K8S_NAMESPACE
REDIS_PASSWORD=`uuidgen`
kubectl create secret generic redis-secrets --namespace=$TFS_K8S_NAMESPACE \
    --from-literal=REDIS_PASSWORD=$REDIS_PASSWORD
echo "export REDIS_PASSWORD=${REDIS_PASSWORD}" >> $ENV_VARS_SCRIPT

for COMPONENT in $TFS_COMPONENTS; do
    echo "Processing '$COMPONENT' component..."

+64 −0
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cachingservice
spec:
  selector:
    matchLabels:
      app: cachingservice
  template:
    metadata:
      labels:
        app: cachingservice
    spec:
      containers:
      - name: redis
        image: redis:7.0-alpine
        env:
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: redis-secrets
              key: REDIS_PASSWORD
        ports:
        - containerPort: 6379
          name: client
        command: ["redis-server"]
        args:
        - --requirepass
        - $(REDIS_PASSWORD)
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
          limits:
            cpu: 500m
            memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
  name: cachingservice
spec:
  type: ClusterIP
  selector:
    app: cachingservice
  ports:
  - name: redis
    port: 6379
    targetPort: 6379
+36 −8
Original line number Diff line number Diff line
@@ -31,33 +31,61 @@ spec:
        image: labs.etsi.org:5050/tfs/controller/dbscanserving:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10006
        - containerPort: 10008
        - containerPort: 9192
        env:
        - name: LOG_LEVEL
          value: "DEBUG"
          value: "INFO"
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
            command: ["/bin/grpc_health_probe", "-addr=:10008"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
            command: ["/bin/grpc_health_probe", "-addr=:10008"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
            memory: 128Mi
          limits:
            cpu: 700m
            cpu: 1000m
            memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: dbscanservingservice
  labels:
    app: dbscanservingservice
spec:
  type: ClusterIP
  selector:
    app: dbscanservingservice
  ports:
  - name: grpc
    port: 10006
    targetPort: 10006
    port: 10008
    targetPort: 10008
  - name: metrics
    port: 9192
    targetPort: 9192
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: dbscanservingservice-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: dbscanservingservice
  minReplicas: 1
  maxReplicas: 20
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 80
  #behavior:
  #  scaleDown:
  #    stabilizationWindowSeconds: 30
Loading