Add cnf for firewall with network of sriov
[multicloud/k8s.git] / deployments / _functions.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright 2019 © Samsung Electronics Co., Ltd.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 function stop_all {
12     docker-compose kill
13     docker-compose down
14 }
15
16 function start_mongo {
17     docker-compose up -d mongo
18     export DATABASE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=mongo"))
19     export no_proxy=${no_proxy:-},${DATABASE_IP}
20     export NO_PROXY=${NO_PROXY:-},${DATABASE_IP}
21 }
22
23 function generate_k8sconfig {
24 cat << EOF > k8sconfig.json
25 {
26     "database-address": "${DATABASE_IP}",
27     "database-type": "mongo",
28     "plugin-dir": "plugins",
29     "service-port": "9015"
30 }
31 EOF
32 }
33
34 function start_all {
35     docker-compose up -d
36 }