David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # voltctl common functions |
| 16 | |
| 17 | *** Settings *** |
| 18 | Documentation Library for various utilities |
| 19 | Library SSHLibrary |
| 20 | Library HttpLibrary.HTTP |
| 21 | Library String |
| 22 | Library DateTime |
| 23 | Library Process |
| 24 | Library Collections |
| 25 | Library RequestsLibrary |
| 26 | Library OperatingSystem |
| 27 | |
| 28 | *** Keywords *** |
| 29 | Lookup Service IP |
| 30 | [Arguments] ${namespace} ${name} |
| 31 | [Documentation] Uses kubeclt to resolve a service name to an IP |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 32 | ${rc} ${ip}= Run and Return Rc and Output |
| 33 | ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.clusterIP} |
David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame] | 34 | Should Be Equal as Integers ${rc} 0 |
| 35 | [Return] ${ip} |
| 36 | |
| 37 | Lookup Service PORT |
| 38 | [Arguments] ${namespace} ${name} |
| 39 | [Documentation] Uses kubeclt to resolve a service name to an PORT |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 40 | ${rc} ${port}= Run and Return Rc and Output |
| 41 | ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.ports[0].port} |
David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame] | 42 | Should Be Equal as Integers ${rc} 0 |
| 43 | [Return] ${port} |
suraj gour | d64356b | 2019-11-07 13:26:20 +0000 | [diff] [blame] | 44 | |
| 45 | Restart Pod |
| 46 | [Arguments] ${namespace} ${name} |
| 47 | [Documentation] Uses kubectl to force delete pod |
| 48 | ${rc} ${restart_pod_name}= Run and Return Rc and Output kubectl get pods --template $'{{range .items}}{{.metadata.name}}{{"\\n"}}{{end}}', -n ${namespace} | grep ${name} |
| 49 | Log ${restart_pod_name} |
| 50 | ${rc} ${output}= Run and Return Rc and Output kubectl delete pod ${restart_pod_name} -n ${namespace} --grace-period=0 --force |
| 51 | Log ${output} |