Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 1 | // 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 | |
| 4 | def 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 Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 14 | stackName: "voltha", |
| 15 | stackId: 1, |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 16 | workflow: "att", |
Hardik Windlass | 810b6cf | 2022-02-24 09:21:18 +0000 | [diff] [blame] | 17 | withMacLearning: false, |
Hardik Windlass | c97ceae | 2022-05-13 10:12:55 +0530 | [diff] [blame] | 18 | withFttb: false, |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 19 | extraHelmFlags: "", |
Matteo Scandolo | fcfc60d | 2021-02-24 09:06:48 -0800 | [diff] [blame] | 20 | localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts) |
Matteo Scandolo | 37f168b | 2021-04-15 16:20:46 -0700 | [diff] [blame] | 21 | dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org" |
Matteo Scandolo | d82d1de | 2021-04-06 14:55:58 -0700 | [diff] [blame] | 22 | kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable |
Hardik Windlass | 230fca6 | 2022-05-04 08:50:35 +0530 | [diff] [blame] | 23 | withVolthaInfra: true, |
| 24 | withVolthaStack: true, |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 25 | ] |
| 26 | |
| 27 | if (!config) { |
| 28 | config = [:] |
| 29 | } |
| 30 | |
| 31 | def cfg = defaultConfig + config |
| 32 | |
Matteo Scandolo | 37f168b | 2021-04-15 16:20:46 -0700 | [diff] [blame] | 33 | if (cfg.dockerRegistry != "") { |
Matteo Scandolo | 5244aaa | 2021-04-28 09:28:58 -0700 | [diff] [blame] | 34 | def registryFlags = " --set global.image_registry=${cfg.dockerRegistry}/ " |
| 35 | registryFlags += " --set etcd.image.registry=${cfg.dockerRegistry} " |
| 36 | registryFlags += " --set kafka.image.registry=${cfg.dockerRegistry} " |
| 37 | registryFlags += " --set kafka.zookeper.image.registry=${cfg.dockerRegistry} " |
| 38 | registryFlags += " --set onos-classic.image.repository=${cfg.dockerRegistry}/voltha/voltha-onos " |
| 39 | registryFlags += " --set onos-classic.atomix.image.repository=${cfg.dockerRegistry}/atomix/atomix " |
| 40 | registryFlags += " --set freeradius.images.radius.registry=${cfg.dockerRegistry}/ " |
| 41 | |
Andrea Campanella | b29ca1e | 2021-05-06 17:45:27 +0200 | [diff] [blame] | 42 | // we want to always leave the user provided flags at the end, to override changes |
Matteo Scandolo | 5244aaa | 2021-04-28 09:28:58 -0700 | [diff] [blame] | 43 | cfg.extraHelmFlags = registryFlags + " " + cfg.extraHelmFlags |
Matteo Scandolo | 37f168b | 2021-04-15 16:20:46 -0700 | [diff] [blame] | 44 | } |
| 45 | |
Andrea Campanella | b29ca1e | 2021-05-06 17:45:27 +0200 | [diff] [blame] | 46 | // Add helm repositories |
| 47 | println "Updating helm repos" |
| 48 | |
| 49 | sh """ |
| 50 | helm repo add onf https://charts.opencord.org |
| 51 | helm repo update |
| 52 | """ |
| 53 | |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 54 | println "Deploying VOLTHA with the following parameters: ${cfg}." |
| 55 | |
Hardik Windlass | 230fca6 | 2022-05-04 08:50:35 +0530 | [diff] [blame] | 56 | if (cfg.withVolthaInfra) { |
| 57 | volthaInfraDeploy(cfg) |
| 58 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 59 | |
Hardik Windlass | 230fca6 | 2022-05-04 08:50:35 +0530 | [diff] [blame] | 60 | if (cfg.withVolthaStack) { |
| 61 | volthaStackDeploy(cfg) |
| 62 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 63 | } |