| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # voltctl common functions |
| |
| *** Settings *** |
| Documentation Library for various utilities |
| Library SSHLibrary |
| Library HttpLibrary.HTTP |
| Library String |
| Library DateTime |
| Library Process |
| Library Collections |
| Library RequestsLibrary |
| Library OperatingSystem |
| |
| *** Keywords *** |
| Lookup Service IP |
| [Arguments] ${namespace} ${name} |
| [Documentation] Uses kubeclt to resolve a service name to an IP |
| ${rc} ${ip}= Run and Return Rc and Output |
| ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.clusterIP} |
| Should Be Equal as Integers ${rc} 0 |
| [Return] ${ip} |
| |
| Lookup Service PORT |
| [Arguments] ${namespace} ${name} |
| [Documentation] Uses kubeclt to resolve a service name to an PORT |
| ${rc} ${port}= Run and Return Rc and Output |
| ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.ports[0].port} |
| Should Be Equal as Integers ${rc} 0 |
| [Return] ${port} |
| |
| Restart Pod |
| [Arguments] ${namespace} ${name} |
| [Documentation] Uses kubectl to force delete pod |
| ${rc} ${restart_pod_name}= Run and Return Rc and Output kubectl get pods --template $'{{range .items}}{{.metadata.name}}{{"\\n"}}{{end}}', -n ${namespace} | grep ${name} |
| Log ${restart_pod_name} |
| ${rc} ${output}= Run and Return Rc and Output kubectl delete pod ${restart_pod_name} -n ${namespace} --grace-period=0 --force |
| Log ${output} |