#!/bin/bash # Copyright 2016 The Kubernetes Authors. # # 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. set -o errexit set -o nounset set -o pipefail # "-=-=-=-=-=-=-=-=-=-=" # This script is only for CI testing purposes. Don't use it in production. # "-=-=-=-=-=-=-=-=-=-=" global KUBE_ROOT := $(KUBE_ROOT:-$(dirname "${BASH_SOURCE}")/../..) source "$(KUBE_ROOT)/cluster/clientbin.sh" # If KUBEFED_PATH isn't set, gather up the list of likely places and use ls # to find the latest one. if [[ -z "${KUBEFED_PATH:-}" ]] { global kubefed := $[ get_bin "kubefed" "federation/cmd/kubefed] if [[ ! -x "$kubefed" ]] { print_error "kubefed" exit 1 } } elif [[ ! -x "${KUBEFED_PATH}" ]] { do { echo "KUBEFED_PATH environment variable set to '$(KUBEFED_PATH)', but " echo "this doesn't seem to be a valid executable." } >&2 exit 1 } global kubefed := $(KUBEFED_PATH:-${kubefed}) # Use the arguments to the script if it is set, a null string # otherwise. $(kubefed) $(@+$@) (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [77 85] ) (Lit_Slash /) (..) (Lit_Slash /) (..) } ) spids: [74 90] ) } spids: [73] ) ] spids: [73] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/clientbin.sh))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [115 118] ) ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubefed) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_bin)} {(DQ (kubefed))} {(DQ (federation/cmd/kubefed))})] ) left_token: spids: [128 140] ) } spids: [127] ) ] spids: [127] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id:BoolUnary_x child:{(DQ ($ VSub_Name "$kubefed"))}) ) ) terminator: ) ] action: [(C {(print_error)} {(DQ (kubefed))}) (C {(exit)} {(1)})] spids: [-1 159] ) ] spids: [-1 174] ) ] spids: [-1 124] ) (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id:BoolUnary_x child:{(DQ (${ VSub_Name KUBEFED_PATH))}) ) ) terminator: ) ] action: [ (BraceGroup children: [ (C {(echo)} { (DQ ("KUBEFED_PATH environment variable set to '") (${ VSub_Name KUBEFED_PATH) ("', but ") ) } ) (C {(echo)} {(DQ ("this doesn't seem to be a valid executable."))}) ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[219])] spids: [196] ) (C {(exit)} {(1)}) ] spids: [176 193] ) ] spids: [-1 227] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kubefed) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(${ VSub_Name kubefed)}) spids: [231 237] ) ) } spids: [229] ) ] spids: [229] ) (C {(DQ (${ VSub_Name kubefed))} { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{($ VSub_At "$@")}) spids: [254 258] ) ) } ) ] )