Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 1 | // usage |
| 2 | // |
| 3 | // stage('test stage') { |
| 4 | // steps { |
| 5 | // volthaDeploy([ |
| 6 | // onosReplica: 3 |
| 7 | // ]) |
| 8 | // } |
| 9 | // } |
| 10 | |
| 11 | |
| 12 | def call(Map config) { |
| 13 | // NOTE use params or directule extraHelmFlags?? |
| 14 | def defaultConfig = [ |
| 15 | onosReplica: 1, |
| 16 | atomixReplica: 1, |
| 17 | kafkaReplica: 1, |
| 18 | etcdReplica: 1, |
| 19 | infraNamespace: "infra", |
| 20 | workflow: "att", |
| 21 | extraHelmFlags: "", |
| 22 | ] |
| 23 | |
| 24 | if (!config) { |
| 25 | config = [:] |
| 26 | } |
| 27 | |
| 28 | def cfg = defaultConfig + config |
| 29 | |
| 30 | println "Deploying VOLTHA Infra with the following parameters: ${cfg}." |
| 31 | |
| 32 | sh """ |
| 33 | kubectl create namespace ${cfg.infraNamespace} || true |
| 34 | kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=$KUBECONFIG" || true |
| 35 | """ |
| 36 | // TODO support multiple replicas |
| 37 | sh """ |
| 38 | helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra onf/voltha-infra ${cfg.extraHelmFlags} \ |
| 39 | -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml |
| 40 | """ |
| 41 | } |