blob: 4f828fd37b98613c47dbf588680400ddea053526 [file] [log] [blame]
Matteo Scandolo42f6e572021-01-25 15:11:34 -08001// usage
2//
3// stage('test stage') {
4// steps {
5// volthaDeploy([
6// onosReplica: 3
7// ])
8// }
9// }
10
11
12def 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: "",
Matteo Scandolofcfc60d2021-02-24 09:06:48 -080022 localCharts: false,
Matteo Scandolo42f6e572021-01-25 15:11:34 -080023 ]
24
25 if (!config) {
26 config = [:]
27 }
28
29 def cfg = defaultConfig + config
30
Matteo Scandolofcfc60d2021-02-24 09:06:48 -080031 def volthaInfraChart = "onf/voltha-infra"
32
33 if (cfg.localCharts) {
34 volthaInfraChart = "$WORKSPACE/voltha-helm-charts/voltha-infra"
35
36 sh """
37 pushd $WORKSPACE/voltha-helm-charts/voltha-infra
38 helm dep update
39 popd
40 """
41 }
42
Matteo Scandolo42f6e572021-01-25 15:11:34 -080043 println "Deploying VOLTHA Infra with the following parameters: ${cfg}."
44
45 sh """
46 kubectl create namespace ${cfg.infraNamespace} || true
47 kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=$KUBECONFIG" || true
48 """
49 // TODO support multiple replicas
50 sh """
Matteo Scandoloed1afdd2021-04-02 16:25:45 -070051 helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra ${volthaInfraChart} \
Matteo Scandolo660e4af2021-04-02 11:16:09 -070052 --set onos-classic.replicas=${cfg.onosReplica},onos-classic.atomix.replicas=${cfg.atomixReplica} \
Matteo Scandoloed1afdd2021-04-02 16:25:45 -070053 -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml ${cfg.extraHelmFlags}
Matteo Scandolo42f6e572021-01-25 15:11:34 -080054 """
55}