blob: aad754b5eaecbb85258612158a69c734fac4c13f [file] [log] [blame]
Matteo Scandolo42f6e572021-01-25 15:11:34 -08001// this keyword is dedicated to deploy a single VOLTHA stack with infra
2// If you need to deploy different configurations you can use the volthaInfraDeploy and volthaStackDeploy keywords
3
4def call(Map config) {
5 // note that I can't define this outside the function as there's no global scope in Groovy
6 def defaultConfig = [
7 onosReplica: 1,
8 atomixReplica: 1,
9 kafkaReplica: 1,
10 etcdReplica: 1,
11 bbsimReplica: 1,
12 infraNamespace: "infra",
13 volthaNamespace: "voltha",
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080014 stackName: "voltha",
15 stackId: 1,
Matteo Scandolo42f6e572021-01-25 15:11:34 -080016 workflow: "att",
Hardik Windlass810b6cf2022-02-24 09:21:18 +000017 withMacLearning: false,
Matteo Scandolo42f6e572021-01-25 15:11:34 -080018 extraHelmFlags: "",
Matteo Scandolofcfc60d2021-02-24 09:06:48 -080019 localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
Matteo Scandolo37f168b2021-04-15 16:20:46 -070020 dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
Matteo Scandolod82d1de2021-04-06 14:55:58 -070021 kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
Hardik Windlass230fca62022-05-04 08:50:35 +053022 withVolthaInfra: true,
23 withVolthaStack: true,
Matteo Scandolo42f6e572021-01-25 15:11:34 -080024 ]
25
26 if (!config) {
27 config = [:]
28 }
29
30 def cfg = defaultConfig + config
31
Matteo Scandolo37f168b2021-04-15 16:20:46 -070032 if (cfg.dockerRegistry != "") {
Matteo Scandolo5244aaa2021-04-28 09:28:58 -070033 def registryFlags = " --set global.image_registry=${cfg.dockerRegistry}/ "
34 registryFlags += " --set etcd.image.registry=${cfg.dockerRegistry} "
35 registryFlags += " --set kafka.image.registry=${cfg.dockerRegistry} "
36 registryFlags += " --set kafka.zookeper.image.registry=${cfg.dockerRegistry} "
37 registryFlags += " --set onos-classic.image.repository=${cfg.dockerRegistry}/voltha/voltha-onos "
38 registryFlags += " --set onos-classic.atomix.image.repository=${cfg.dockerRegistry}/atomix/atomix "
39 registryFlags += " --set freeradius.images.radius.registry=${cfg.dockerRegistry}/ "
40
Andrea Campanellab29ca1e2021-05-06 17:45:27 +020041 // we want to always leave the user provided flags at the end, to override changes
Matteo Scandolo5244aaa2021-04-28 09:28:58 -070042 cfg.extraHelmFlags = registryFlags + " " + cfg.extraHelmFlags
Matteo Scandolo37f168b2021-04-15 16:20:46 -070043 }
44
Andrea Campanellab29ca1e2021-05-06 17:45:27 +020045 // Add helm repositories
46 println "Updating helm repos"
47
48 sh """
49 helm repo add onf https://charts.opencord.org
50 helm repo update
51 """
52
Matteo Scandolo42f6e572021-01-25 15:11:34 -080053 println "Deploying VOLTHA with the following parameters: ${cfg}."
54
Hardik Windlass230fca62022-05-04 08:50:35 +053055 if (cfg.withVolthaInfra) {
56 volthaInfraDeploy(cfg)
57 }
Matteo Scandolo42f6e572021-01-25 15:11:34 -080058
Hardik Windlass230fca62022-05-04 08:50:35 +053059 if (cfg.withVolthaStack) {
60 volthaStackDeploy(cfg)
61 }
Matteo Scandolo42f6e572021-01-25 15:11:34 -080062}