| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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. |
| |
| version: "3" |
| |
| vars: |
| OS: "{{OS}}" |
| ARCH: "{{ARCH}}" |
| |
| env: |
| KUBECONFIG: |
| sh: | |
| if test -e $OPS_TMP/kubeconfig |
| then echo $OPS_TMP/kubeconfig |
| else echo ~/.kube/config |
| fi |
| |
| tasks: |
| prereq: |
| silent: true |
| desc: prerequisites |
| cmds: |
| - oc version --client=true || die "I need the oc command available in the PATH" |
| |
| copy: |
| silent: true |
| desc: import an openshift configuration |
| cmds: |
| - | |
| if test -e "$CONFIG" |
| then cp "$CONFIG" "$OPS_TMP/kubeconfig" |
| cp "$CONFIG" "$OPS_TMP/openshift.kubeconfig" |
| echo "$CONFIG" imported as "openshift.kubeconfig" |
| oc --kubeconfig "$OPS_TMP/kubeconfig" cluster-info |
| else echo "$CONFIG not found" ; false |
| fi |
| env: |
| CONFIG: |
| sh: realpath {{._kubeconfig_}} |
| |
| apihost: |
| silent: true |
| desc: prepare |
| cmds: |
| - config OPERATOR_CONFIG_KUBE=openshift |
| - "$OPS config apihost '{{.APIHOST}}'" |
| vars: |
| APIHOST: |
| sh: > |
| kubectl --kubeconfig $OPS_TMP/kubeconfig config view -o jsonpath='{.clusters[0].cluster.server}' |
| | awk -F: '{gsub("//api.", "api.apps.", $2); print $2}' |
| |
| import: |
| silent: true |
| desc: import an openshift configuration |
| cmds: |
| - task: prereq |
| - task: copy |
| - task: apihost |
| |
| setup: |
| desc: setup openshift cluster with acme-openshift |
| cmds: |
| - kubectl apply -f acme-openshift |