Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
transponders
· 8c03968b
Mohammad Ismaeel
authored
Apr 22, 2024
auto discovery
8c03968b
Show whitespace changes
Inline
Side-by-side
deploy/component.sh
View file @
8c03968b
...
...
@@ -40,6 +40,21 @@ export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"}
# Automated steps start here
########################################################################################################################
DOCKER_BUILD
=
"docker build"
DOCKER_MAJOR_VERSION
=
$(
docker
--version
|
grep
-o
-E
"Docker version [0-9]+
\.
"
|
grep
-o
-E
"[0-9]+"
|
cut
-c
1-3
)
if
[[
$DOCKER_MAJOR_VERSION
-ge
23
]]
;
then
# If Docker version >= 23, build command was migrated to docker-buildx
# In Ubuntu, in practice, means to install package docker-buildx together with docker.io
# Check if docker-buildx plugin is installed
docker buildx version 1>/dev/null 2>/dev/null
if
[[
$?
-ne
0
]]
;
then
echo
"Docker buildx command is not installed. Check: https://docs.docker.com/build/architecture/#install-buildx"
echo
"If you installed docker through APT package docker.io, consider installing also package docker-buildx"
exit
1
;
fi
DOCKER_BUILD
=
"docker buildx build"
fi
# Constants
GITLAB_REPO_URL
=
"labs.etsi.org:5050/tfs/controller"
TMP_FOLDER
=
"./tmp"
...
...
@@ -60,17 +75,17 @@ for COMPONENT in $TFS_COMPONENTS; do
BUILD_LOG
=
"
$TMP_LOGS_FOLDER
/build_
${
COMPONENT
}
.log"
if
[
"
$COMPONENT
"
==
"ztp"
]
||
[
"
$COMPONENT
"
==
"policy"
]
;
then
docker build
-t
"
$IMAGE_NAME
"
-f
./src/
"
$COMPONENT
"
/Dockerfile ./src/
"
$COMPONENT
"
/
>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$IMAGE_NAME
"
-f
./src/
"
$COMPONENT
"
/Dockerfile ./src/
"
$COMPONENT
"
/
>
"
$BUILD_LOG
"
elif
[
"
$COMPONENT
"
==
"pathcomp"
]
;
then
BUILD_LOG
=
"
$TMP_LOGS_FOLDER
/build_
${
COMPONENT
}
-frontend.log"
docker build
-t
"
$COMPONENT
-frontend:
$TFS_IMAGE_TAG
"
-f
./src/
"
$COMPONENT
"
/frontend/Dockerfile
.
>>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$COMPONENT
-frontend:
$TFS_IMAGE_TAG
"
-f
./src/
"
$COMPONENT
"
/frontend/Dockerfile
.
>>
"
$BUILD_LOG
"
BUILD_LOG
=
"
$TMP_LOGS_FOLDER
/build_
${
COMPONENT
}
-backend.log"
docker build
-t
"
$COMPONENT
-backend:
$TFS_IMAGE_TAG
"
-f
./src/
"
$COMPONENT
"
/backend/Dockerfile
.
>>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$COMPONENT
-backend:
$TFS_IMAGE_TAG
"
-f
./src/
"
$COMPONENT
"
/backend/Dockerfile
.
>>
"
$BUILD_LOG
"
# next command is redundant, but helpful to keep cache updated between rebuilds
docker build
-t
"
$COMPONENT
-backend:
$TFS_IMAGE_TAG
-builder"
--target
builder
-f
./src/
"
$COMPONENT
"
/backend/Dockerfile
.
>>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$COMPONENT
-backend:
$TFS_IMAGE_TAG
-builder"
--target
builder
-f
./src/
"
$COMPONENT
"
/backend/Dockerfile
.
>>
"
$BUILD_LOG
"
else
docker build
-t
"
$IMAGE_NAME
"
-f
./src/
"
$COMPONENT
"
/Dockerfile
.
>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$IMAGE_NAME
"
-f
./src/
"
$COMPONENT
"
/Dockerfile
.
>
"
$BUILD_LOG
"
fi
if
[
-n
"
$TFS_REGISTRY_IMAGES
"
]
;
then
...
...
deploy/crdb.sh
View file @
8c03968b
...
...
@@ -158,9 +158,19 @@ function crdb_undeploy_single() {
function
crdb_drop_database_single
()
{
echo
"Drop database if exists"
CRDB_PORT_SQL
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.ports[?(@.name=="sql")].port}'
)
CRDB_CLIENT_URL
=
"postgresql://
${
CRDB_USERNAME
}
:
${
CRDB_PASSWORD
}
@cockroachdb-0:
${
CRDB_PORT_SQL
}
/defaultdb?sslmode=require"
kubectl
exec
-it
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-0
--
\
if
[[
-z
"
${
GITLAB_CI
}
"
]]
;
then
#kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o yaml
CRDB_HOST
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.clusterIP}'
)
CRDB_PORT
=
$(
kubectl
--namespace
${
CRDB_NAMESPACE
}
get service cockroachdb-public
-o
'jsonpath={.spec.ports[?(@.name=="sql")].port}'
)
else
CRDB_HOST
=
"127.0.0.1"
CRDB_PORT
=
${
CRDB_EXT_PORT_SQL
}
fi
CRDB_CLIENT_URL
=
"postgresql://
${
CRDB_USERNAME
}
:
${
CRDB_PASSWORD
}
@
${
CRDB_HOST
}
:
${
CRDB_PORT
}
/defaultdb?sslmode=require"
echo
"CRDB_CLIENT_URL=
${
CRDB_CLIENT_URL
}
"
kubectl
exec
-i
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-0
--
\
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--url
=
${
CRDB_CLIENT_URL
}
\
--execute
"DROP DATABASE IF EXISTS
${
CRDB_DATABASE
}
;"
echo
...
...
@@ -343,7 +353,7 @@ function crdb_undeploy_cluster() {
function
crdb_drop_database_cluster
()
{
echo
"Drop database if exists"
kubectl
exec
-i
t
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-client-secure
--
\
kubectl
exec
-i
--namespace
${
CRDB_NAMESPACE
}
cockroachdb-client-secure
--
\
./cockroach sql
--certs-dir
=
/cockroach/cockroach-certs
--host
=
cockroachdb-public
--execute
\
"DROP DATABASE IF EXISTS
${
CRDB_DATABASE
}
;"
echo
...
...
deploy/mock_blockchain.sh
View file @
8c03968b
...
...
@@ -58,9 +58,24 @@ echo "Processing '$COMPONENT' component..."
IMAGE_NAME
=
"
$COMPONENT
:
$IMAGE_TAG
"
IMAGE_URL
=
$(
echo
"
$REGISTRY_IMAGE
/
$IMAGE_NAME
"
|
sed
's,//,/,g'
|
sed
's,http:/,,g'
)
DOCKER_BUILD
=
"docker build"
DOCKER_MAJOR_VERSION
=
$(
docker
--version
|
grep
-o
-E
"Docker version [0-9]+
\.
"
|
grep
-o
-E
"[0-9]+"
|
cut
-c
1-3
)
if
[[
$DOCKER_MAJOR_VERSION
-ge
23
]]
;
then
# If Docker version >= 23, build command was migrated to docker-buildx
# In Ubuntu, in practice, means to install package docker-buildx together with docker.io
# Check if docker-buildx plugin is installed
docker buildx version 1>/dev/null 2>/dev/null
if
[[
$?
-ne
0
]]
;
then
echo
"Docker buildx command is not installed. Check: https://docs.docker.com/build/architecture/#install-buildx"
echo
"If you installed docker through APT package docker.io, consider installing also package docker-buildx"
exit
1
;
fi
DOCKER_BUILD
=
"docker buildx build"
fi
echo
" Building Docker image..."
BUILD_LOG
=
"
$TMP_LOGS_FOLDER
/build_
${
COMPONENT
}
.log"
docker build
-t
"
$IMAGE_NAME
"
-f
./src/dlt/mock_blockchain/Dockerfile
.
>
"
$BUILD_LOG
"
$DOCKER_BUILD
-t
"
$IMAGE_NAME
"
-f
./src/dlt/mock_blockchain/Dockerfile
.
>
"
$BUILD_LOG
"
if
[
-n
"
$REGISTRY_IMAGE
"
]
;
then
echo
" Pushing Docker image to '
$REGISTRY_IMAGE
'..."
...
...
deploy/qdb.sh
View file @
8c03968b
...
...
@@ -160,10 +160,17 @@ function qdb_undeploy() {
}
function
qdb_drop_tables
()
{
echo
"Drop tables, if exist"
if
[[
-z
"
${
GITLAB_CI
}
"
]]
;
then
#kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o yaml
QDB_HOST
=
$(
kubectl
--namespace
${
QDB_NAMESPACE
}
get service questdb-public
-o
'jsonpath={.spec.clusterIP}'
)
QDB_PORT
=
$(
kubectl
--namespace
${
QDB_NAMESPACE
}
get service questdb-public
-o
'jsonpath={.spec.ports[?(@.name=="http")].port}'
)
else
QDB_HOST
=
"127.0.0.1"
QDB_PORT
=
${
QDB_EXT_PORT_HTTP
}
fi
echo
"Drop tables, if exist"
curl
"http://
${
QDB_HOST
}
:
${
QDB_PORT
}
/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+
${
QDB_TABLE_MONITORING_KPIS
}
+;"
echo
curl
"http://
${
QDB_HOST
}
:
${
QDB_PORT
}
/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+
${
QDB_TABLE_SLICE_GROUPS
}
+;"
...
...
deploy/tfs.sh
View file @
8c03968b
...
...
@@ -299,8 +299,13 @@ for COMPONENT in $TFS_COMPONENTS; do
VERSION
=
$(
grep
-i
"
${
GITLAB_REPO_URL
}
/
${
COMPONENT
}
-gateway:"
"
$MANIFEST
"
|
cut
-d
":"
-f4
)
sed
-E
-i
"s#image:
$GITLAB_REPO_URL
/
$COMPONENT
-gateway:
${
VERSION
}
#image:
$IMAGE_URL
#g"
"
$MANIFEST
"
else
if
[
"
$TFS_SKIP_BUILD
"
!=
"YES"
]
;
then
IMAGE_URL
=
$(
echo
"
$TFS_REGISTRY_IMAGES
/
$COMPONENT
:
$TFS_IMAGE_TAG
"
|
sed
's,//,/,g'
|
sed
's,http:/,,g'
)
VERSION
=
$(
grep
-i
"
${
GITLAB_REPO_URL
}
/
${
COMPONENT
}
:"
"
$MANIFEST
"
|
cut
-d
":"
-f4
)
else
VERSION
=
$(
grep
-i
"
${
GITLAB_REPO_URL
}
/
${
COMPONENT
}
:"
"
$MANIFEST
"
|
cut
-d
":"
-f4
)
IMAGE_URL
=
$(
echo
"
$TFS_REGISTRY_IMAGES
/
$COMPONENT
:
$VERSION
"
|
sed
's,//,/,g'
|
sed
's,http:/,,g'
)
fi
sed
-E
-i
"s#image:
$GITLAB_REPO_URL
/
$COMPONENT
:
${
VERSION
}
#image:
$IMAGE_URL
#g"
"
$MANIFEST
"
fi
...
...
@@ -364,7 +369,13 @@ for COMPONENT in $TFS_COMPONENTS; do
echo
"Waiting for '
$COMPONENT
' component..."
COMPONENT_OBJNAME
=
$(
echo
"
${
COMPONENT
}
"
|
sed
"s/
\_
/-/"
)
kubectl
wait
--namespace
$TFS_K8S_NAMESPACE
\
--for
=
'condition=available'
--timeout
=
300s deployment/
${
COMPONENT_OBJNAME
}
service
--for
=
'condition=available'
--timeout
=
90s deployment/
${
COMPONENT_OBJNAME
}
service
WAIT_EXIT_CODE
=
$?
if
[[
$WAIT_EXIT_CODE
!=
0
]]
;
then
echo
" Failed to deploy '
${
COMPONENT
}
' component, exit code '
${
WAIT_EXIT_CODE
}
', exiting..."
kubectl logs
--namespace
$TFS_K8S_NAMESPACE
deployment/
${
COMPONENT_OBJNAME
}
service
--all-containers
=
true
exit
$WAIT_EXIT_CODE
fi
printf
"
\n
"
done
...
...
manifests/bgpls_speakerservice.yaml
0 → 100644
View file @
8c03968b
# 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
:
bgpls-speakerservice
spec
:
selector
:
matchLabels
:
app
:
bgpls-speakerservice
replicas
:
1
template
:
metadata
:
labels
:
app
:
bgpls-speakerservice
spec
:
terminationGracePeriodSeconds
:
5
containers
:
-
name
:
server
image
:
localhost:32000/tfs/bgpls_speaker:dev
imagePullPolicy
:
Always
ports
:
-
containerPort
:
20030
-
containerPort
:
9192
env
:
-
name
:
LOG_LEVEL
value
:
"
INFO"
readinessProbe
:
exec
:
command
:
[
"
/bin/grpc_health_probe"
,
"
-addr=:20030"
]
livenessProbe
:
exec
:
command
:
[
"
/bin/grpc_health_probe"
,
"
-addr=:20030"
]
resources
:
requests
:
cpu
:
250m
memory
:
128Mi
limits
:
cpu
:
1000m
memory
:
1024Mi
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
bgpls-speakerservice
labels
:
app
:
bgpls-speakerservice
spec
:
type
:
ClusterIP
selector
:
app
:
bgpls-speakerservice
ports
:
-
name
:
grpc
protocol
:
TCP
port
:
20030
targetPort
:
20030
-
name
:
metrics
protocol
:
TCP
port
:
9192
targetPort
:
9192
manifests/cachingservice.yaml
View file @
8c03968b
manifests/contextservice.yaml
View file @
8c03968b
manifests/dbscanservingservice.yaml
View file @
8c03968b
manifests/deviceservice.yaml
View file @
8c03968b
manifests/dltservice.yaml
View file @
8c03968b
manifests/e2e_orchestratorservice.yaml
View file @
8c03968b
manifests/forecasterservice.yaml
View file @
8c03968b
manifests/interdomainservice.yaml
View file @
8c03968b
manifests/l3_attackmitigatorservice.yaml
View file @
8c03968b
...
...
@@ -35,7 +35,7 @@ spec:
-
containerPort
:
9192
env
:
-
name
:
LOG_LEVEL
value
:
"
DEBUG
"
value
:
"
INFO
"
readinessProbe
:
exec
:
command
:
[
"
/bin/grpc_health_probe"
,
"
-addr=:10002"
]
...
...
manifests/l3_centralizedattackdetectorservice.yaml
View file @
8c03968b
...
...
@@ -35,7 +35,7 @@ spec:
-
containerPort
:
9192
env
:
-
name
:
LOG_LEVEL
value
:
"
DEBUG
"
value
:
"
INFO
"
-
name
:
BATCH_SIZE
value
:
"
256"
-
name
:
CAD_CLASSIFICATION_THRESHOLD
...
...
manifests/l3_distributedattackdetectorservice.yaml
View file @
8c03968b
...
...
@@ -34,7 +34,7 @@ spec:
-
containerPort
:
10000
env
:
-
name
:
LOG_LEVEL
value
:
"
DEBUG
"
value
:
"
INFO
"
readinessProbe
:
exec
:
command
:
[
"
/bin/grpc_health_probe"
,
"
-addr=:10000"
]
...
...
manifests/load_generatorservice.yaml
View file @
8c03968b
manifests/mock_blockchain.yaml
View file @
8c03968b
manifests/monitoringservice.yaml
View file @
8c03968b
Prev
1
2
3
4
5
…
28
Next