2 # Copyright 2020 Huawei Technologies Co., Ltd.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 - name: Doing deployment setup for edge gallery
26 file: ../../../config.yml
29 - name: Setting pull image path
30 # yamllint disable rule:line-length
31 command: kubectl create secret docker-registry swrregcred --docker-server=https://swr.ap-southeast-1.myhuaweicloud.com/v2/ --docker-username={{ vardata.swrusr.name}} --docker-password={{ vardata.swrpass.name}}
32 # yamllint disable rule:line-length
34 chdir: /tmp/eg_mep/deploy/
37 command: cp -r /tmp/remote-platform/cni/macvlan /opt/cni/bin/
39 chdir: /tmp/eg_mep/deploy/
41 - name: Setup local-host
42 command: cp -r /tmp/remote-platform/cni/host-local /opt/cni/bin/
44 chdir: /tmp/eg_mep/deploy/
46 - name: Create mep namespace
47 command: kubectl create ns mep
51 - name: Create generic pg secret
52 # yamllint disable rule:line-length
53 command: kubectl -n mep create secret generic pg-secret --from-literal=pg_admin_pwd={{ vardata.adminpwd.name}} --from-literal=kong_pg_pwd={{ vardata.kongpgpwd.name}} --from-file=server.key=/tmp/.mep_tmp_cer/mepserver_tls.key --from-file=server.crt=/tmp/.mep_tmp_cer/mepserver_tls.crt
54 # yamllint disable rule:line-length
58 - name: Create mep generic for mep ssl
59 # yamllint disable rule:line-length
60 command: kubectl -n mep create secret generic mep-ssl --from-literal=cert_pwd={{ vardata.firstvar.name}} --from-file=server.cer=/tmp/.mep_tmp_cer/mepserver_tls.crt --from-file=server_key.pem=/tmp/.mep_tmp_cer/mepserver_encryptedtls.key --from-file=trust.cer=/tmp/.mep_tmp_cer/ca.crt
61 # yamllint disable rule:line-length
65 - name: Create mep seret generic
66 # yamllint disable rule:line-length
67 command: kubectl -n mep create secret generic mepauth-secret --from-file=server.crt=/tmp/.mep_tmp_cer/mepserver_tls.crt --from-file=server.key=/tmp/.mep_tmp_cer/mepserver_tls.key --from-file=ca.crt=/tmp/.mep_tmp_cer/ca.crt --from-file=jwt_publickey=/tmp/.mep_tmp_cer/jwt_publickey --from-file=jwt_encrypted_privatekey=/tmp/.mep_tmp_cer/jwt_encrypted_privatekey
68 # yamllint disable rule:line-length
73 msg: Deploy_dns_metallb execution start
75 - name: Eg_Mep deployment execution of namesapce
76 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/metallb/namespace.yaml
78 chdir: /tmp/eg_mep/deploy/
80 - name: Eg_Mep deployment execution of metallb
81 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/metallb/metallb.yaml
83 chdir: /tmp/eg_mep/deploy/
85 - name: Eg_Mep deployment create secret
86 command: kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
88 chdir: /tmp/eg_mep/deploy/
90 - name: Eg_Mep deployment execution of config-mep
91 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/metallb/config-map.yaml
93 chdir: /tmp/eg_mep/deploy/
96 msg: Deploy_network_isolation_multus execution start
98 - name: Running multus yaml files
99 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/network-isolation/multus.yaml
101 chdir: /tmp/eg_mep/deploy/
103 - name: Running eg-sp-rbac yaml files
104 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/network-isolation/eg-sp-rbac.yaml
106 chdir: /tmp/eg_mep/deploy/
108 - name: Replacing image
110 path: /tmp/eg_mep/deploy/conf/edge/network-isolation/eg-sp-controller.yaml
111 regexp: 'edgegallery/edgegallery-secondary-ep-controller:latest'
112 replace: "swr.ap-southeast-1.myhuaweicloud.com/edgegallery/edgegallery-secondary-ep-controller:latest"
114 - name: Running eg-sp-controller yaml files
115 command: kubectl apply -f /tmp/eg_mep/deploy/conf/edge/network-isolation/eg-sp-controller.yaml
117 chdir: /tmp/eg_mep/deploy/
120 msg: Setup_interfaces execution start
122 - name: Link eg mep macvlan
123 command: ip link add eg-mp1 link {{ vardata.interface1.name}} type macvlan mode bridge
125 chdir: /tmp/eg_mep/deploy/
129 - name: Link eg mep macvlan
130 command: ip addr add {{ vardata.ipaddregmep1.name}} dev eg-mp1
132 chdir: /tmp/eg_mep/deploy/
136 - name: Link eg me1 up
137 command: ip link set dev eg-mp1 up
139 chdir: /tmp/eg_mep/deploy/
143 - name: Link eg eg mm5 with eth1
144 command: ip link add eg-mm5 link {{ vardata.interface2.name}} type macvlan mode bridge
146 chdir: /tmp/eg_mep/deploy/
150 - name: Link eg eg mm5 ip addr
151 command: ip addr add {{ vardata.ipaddregmep5.name}} dev eg-mm5
153 chdir: /tmp/eg_mep/deploy/
157 - name: Link eg eg mm5 set dev
158 command: ip link set dev eg-mm5 up
160 chdir: /tmp/eg_mep/deploy/
164 - name: Delete mep name space
165 command: kubectl delete ns mep
167 chdir: /tmp/eg_mep/deploy/
172 msg: Pull helm repo start
174 - name: Edge gallery mep installation pull chart
175 # yamllint disable rule:line-length
176 command: helm install mep-edgegallery edgegallery/mep --set networkIsolation.phyInterface.mp1={{ vardata.interface1.name}} --set networkIsolation.phyInterface.mm5={{ vardata.interface2.name}} --set ssl.secretName=mep-ssl
177 # yamllint disable rule:line-length
179 chdir: /tmp/eg_mep/deploy/