Loading deploy/tfs.sh +21 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,26 @@ export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"} export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-""} # ----- App CockroachDB -------------------------------------------------------- # If not already set, set the namespace where CockroackDB will be deployed. export APP_CRDB_NAMESPACE=${APP_CRDB_NAMESPACE:-"app-crdb"} # If not already set, set the external port CockroackDB Postgre SQL interface will be exposed to. export APP_CRDB_EXT_PORT_SQL=${APP_CRDB_EXT_PORT_SQL:-"26257"} # If not already set, set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to. export APP_CRDB_EXT_PORT_HTTP=${APP_CRDB_EXT_PORT_HTTP:-"8081"} # If not already set, set the database username to be used by Context. export APP_CRDB_USERNAME=${APP_CRDB_USERNAME:-"tfs"} # If not already set, set the database user's password to be used by Context. export APP_CRDB_PASSWORD=${APP_CRDB_PASSWORD:-"tfs123"} # If not already set, set the database name to be used by Context. export APP_CRDB_DATABASE=${APP_CRDB_DATABASE:-"tfs"} # ----- CockroachDB ------------------------------------------------------------ # If not already set, set the namespace where CockroackDB will be deployed. Loading Loading @@ -141,6 +161,7 @@ kubectl create secret generic crdb-data --namespace ${TFS_K8S_NAMESPACE} --type= --from-literal=CRDB_NAMESPACE=${CRDB_NAMESPACE} \ --from-literal=CRDB_SQL_PORT=${CRDB_SQL_PORT} \ --from-literal=CRDB_DATABASE=${CRDB_DATABASE} \ --from-literal=CRDB_DATABASE_APP=${CRDB_DATABASE_APP} \ --from-literal=CRDB_USERNAME=${CRDB_USERNAME} \ --from-literal=CRDB_PASSWORD=${CRDB_PASSWORD} \ --from-literal=CRDB_SSLMODE=require Loading manifests/appservice.yaml 0 → 100644 +83 −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: appservice spec: selector: matchLabels: app: appservice #replicas: 1 template: metadata: labels: app: appservice spec: terminationGracePeriodSeconds: 5 containers: - name: server image: labs.etsi.org:5050/tfs/controller/app:latest imagePullPolicy: Always ports: - containerPort: 10060 - containerPort: 9192 - containerPort: 8005 env: - name: MB_BACKEND value: "nats" - name: LOG_LEVEL value: "INFO" envFrom: - secretRef: name: crdb-data - secretRef: name: nats-data readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10060"] livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10060"] resources: requests: cpu: 150m memory: 128Mi limits: cpu: 500m memory: 512Mi --- apiVersion: v1 kind: Service metadata: name: appservice labels: app: appservice spec: type: ClusterIP selector: app: appservice ports: - name: grpc protocol: TCP port: 10060 targetPort: 10060 - name: metrics protocol: TCP port: 9192 targetPort: 9192 - name: app port: 8005 targetPort: 8005 manifests/nginx_ingress_http.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -57,3 +57,10 @@ spec: name: nbiservice port: number: 8080 - path: /()(app/.*) - pathType: Prefix backend: service: name: appservice port: number: 8005 my_deploy.sh +3 −2 Original line number Diff line number Diff line Loading @@ -20,13 +20,13 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" export TFS_COMPONENTS="context device app pathcomp service slice nbi webui load_generator" # Uncomment to activate Monitoring #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" # Uncomment to activate BGP-LS Speaker #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" # Uncomment to activate Optical Controller # To manage optical connections, "service" requires "opticalcontroller" to be deployed Loading Loading @@ -100,6 +100,7 @@ export CRDB_PASSWORD="tfs123" # Set the database name to be used by Context. export CRDB_DATABASE="tfs" export CRDB_DATABASE_APP="tfs_app" # Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. # See ./deploy/all.sh or ./deploy/crdb.sh for additional details Loading proto/app.proto 0 → 100644 +53 −0 Original line number Diff line number Diff line syntax = "proto3"; package app; import "context.proto"; // Optare: Change this if you want to change App's structure or enums. // Optare: If a message (structure) is changed it must be changed in src/app/service/database enum QKDAppStatusEnum { QKDAPPSTATUS_ON = 0; QKDAPPSTATUS_DISCONNECTED = 1; QKDAPPSTATUS_OUT_OF_TIME = 2; QKDAPPSTATUS_ZOMBIE = 3; } enum QKDAppTypesEnum { QKDAPPTYPES_INTERNAL = 0; QKDAPPTYPES_CLIENT = 1; } message QKDLId { context.Uuid qkdl_uuid = 1; } message App { AppId app_id = 1; QKDAppStatusEnum app_status = 2; QKDAppTypesEnum app_type = 3; string server_app_id = 4; repeated string client_app_id = 5; repeated QKDLId backing_qkdl_id = 6; context.DeviceId local_device_id = 7; context.DeviceId remote_device_id = 8; } message AppId { context.ContextId context_id = 1; context.Uuid app_uuid = 2; } service AppService { rpc RegisterApp(App) returns (context.Empty) {} rpc ListApps (context.ContextId ) returns ( AppList ) {} } message AppList { repeated App apps = 1; } Loading
deploy/tfs.sh +21 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,26 @@ export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"} export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-""} # ----- App CockroachDB -------------------------------------------------------- # If not already set, set the namespace where CockroackDB will be deployed. export APP_CRDB_NAMESPACE=${APP_CRDB_NAMESPACE:-"app-crdb"} # If not already set, set the external port CockroackDB Postgre SQL interface will be exposed to. export APP_CRDB_EXT_PORT_SQL=${APP_CRDB_EXT_PORT_SQL:-"26257"} # If not already set, set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to. export APP_CRDB_EXT_PORT_HTTP=${APP_CRDB_EXT_PORT_HTTP:-"8081"} # If not already set, set the database username to be used by Context. export APP_CRDB_USERNAME=${APP_CRDB_USERNAME:-"tfs"} # If not already set, set the database user's password to be used by Context. export APP_CRDB_PASSWORD=${APP_CRDB_PASSWORD:-"tfs123"} # If not already set, set the database name to be used by Context. export APP_CRDB_DATABASE=${APP_CRDB_DATABASE:-"tfs"} # ----- CockroachDB ------------------------------------------------------------ # If not already set, set the namespace where CockroackDB will be deployed. Loading Loading @@ -141,6 +161,7 @@ kubectl create secret generic crdb-data --namespace ${TFS_K8S_NAMESPACE} --type= --from-literal=CRDB_NAMESPACE=${CRDB_NAMESPACE} \ --from-literal=CRDB_SQL_PORT=${CRDB_SQL_PORT} \ --from-literal=CRDB_DATABASE=${CRDB_DATABASE} \ --from-literal=CRDB_DATABASE_APP=${CRDB_DATABASE_APP} \ --from-literal=CRDB_USERNAME=${CRDB_USERNAME} \ --from-literal=CRDB_PASSWORD=${CRDB_PASSWORD} \ --from-literal=CRDB_SSLMODE=require Loading
manifests/appservice.yaml 0 → 100644 +83 −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: appservice spec: selector: matchLabels: app: appservice #replicas: 1 template: metadata: labels: app: appservice spec: terminationGracePeriodSeconds: 5 containers: - name: server image: labs.etsi.org:5050/tfs/controller/app:latest imagePullPolicy: Always ports: - containerPort: 10060 - containerPort: 9192 - containerPort: 8005 env: - name: MB_BACKEND value: "nats" - name: LOG_LEVEL value: "INFO" envFrom: - secretRef: name: crdb-data - secretRef: name: nats-data readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10060"] livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10060"] resources: requests: cpu: 150m memory: 128Mi limits: cpu: 500m memory: 512Mi --- apiVersion: v1 kind: Service metadata: name: appservice labels: app: appservice spec: type: ClusterIP selector: app: appservice ports: - name: grpc protocol: TCP port: 10060 targetPort: 10060 - name: metrics protocol: TCP port: 9192 targetPort: 9192 - name: app port: 8005 targetPort: 8005
manifests/nginx_ingress_http.yaml +7 −0 Original line number Diff line number Diff line Loading @@ -57,3 +57,10 @@ spec: name: nbiservice port: number: 8080 - path: /()(app/.*) - pathType: Prefix backend: service: name: appservice port: number: 8005
my_deploy.sh +3 −2 Original line number Diff line number Diff line Loading @@ -20,13 +20,13 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" export TFS_COMPONENTS="context device app pathcomp service slice nbi webui load_generator" # Uncomment to activate Monitoring #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" # Uncomment to activate BGP-LS Speaker #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" # Uncomment to activate Optical Controller # To manage optical connections, "service" requires "opticalcontroller" to be deployed Loading Loading @@ -100,6 +100,7 @@ export CRDB_PASSWORD="tfs123" # Set the database name to be used by Context. export CRDB_DATABASE="tfs" export CRDB_DATABASE_APP="tfs_app" # Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. # See ./deploy/all.sh or ./deploy/crdb.sh for additional details Loading
proto/app.proto 0 → 100644 +53 −0 Original line number Diff line number Diff line syntax = "proto3"; package app; import "context.proto"; // Optare: Change this if you want to change App's structure or enums. // Optare: If a message (structure) is changed it must be changed in src/app/service/database enum QKDAppStatusEnum { QKDAPPSTATUS_ON = 0; QKDAPPSTATUS_DISCONNECTED = 1; QKDAPPSTATUS_OUT_OF_TIME = 2; QKDAPPSTATUS_ZOMBIE = 3; } enum QKDAppTypesEnum { QKDAPPTYPES_INTERNAL = 0; QKDAPPTYPES_CLIENT = 1; } message QKDLId { context.Uuid qkdl_uuid = 1; } message App { AppId app_id = 1; QKDAppStatusEnum app_status = 2; QKDAppTypesEnum app_type = 3; string server_app_id = 4; repeated string client_app_id = 5; repeated QKDLId backing_qkdl_id = 6; context.DeviceId local_device_id = 7; context.DeviceId remote_device_id = 8; } message AppId { context.ContextId context_id = 1; context.Uuid app_uuid = 2; } service AppService { rpc RegisterApp(App) returns (context.Empty) {} rpc ListApps (context.ContextId ) returns ( AppList ) {} } message AppList { repeated App apps = 1; }