#!/bin/bash # Copyright 2017 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 global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/../.." # For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $HOST_CLUSTER_CONTEXT, source "$(KUBE_ROOT)/federation/cluster/common.sh" global KUBE_VERSION := $(1) global host_kubectl := ""$(KUBE_ROOT)/cluster/kubectl.sh --context=$(HOST_CLUSTER_CONTEXT) --namespace=$(FEDERATION_NAMESPACE)"" proc upgrade { var -r project = $(KUBE_PROJECT:-${PROJECT:-}) var -r kube_registry = $(KUBE_REGISTRY:-gcr.io/${project}) var -r image_version = ""$(kube_registry)/hyperkube-amd64:$(KUBE_VERSION)"" kube::log::status "Upgrading federation control plane $(FEDERATION_NAME) with image $(image_version)" # Upgrade apiserver image $(host_kubectl) set image deployment/federation-apiserver apiserver=$(image_version) # Upgrade controller-manager image $(host_kubectl) set image deployment/federation-controller-manager controller-manager=$(image_version) } upgrade (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: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [64 72] ) (/../..) } spids: [63] ) ] spids: [63] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/federation/cluster/common.sh))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_VERSION) op: Equal rhs: {(DQ (${ VSub_Number 1))} spids: [88] ) ] spids: [88] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:host_kubectl) op: Equal rhs: { (DQ (${ VSub_Name KUBE_ROOT) ("/cluster/kubectl.sh --context=") (${ VSub_Name HOST_CLUSTER_CONTEXT) (" --namespace=") (${ VSub_Name FEDERATION_NAMESPACE) ) } spids: [96] ) ] spids: [96] ) (FuncDef name: upgrade body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:project) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [130 133] ) } ) spids: [127 134] ) ) } spids: [125] ) ] spids: [121] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:kube_registry) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(gcr.io) (Lit_Slash /) (${ VSub_Name project)} ) spids: [144 152] ) ) } spids: [142] ) ] spids: [138] ) (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:image_version) op: Equal rhs: { (DQ (${ VSub_Name kube_registry) ("/hyperkube-amd64:") (${ VSub_Name KUBE_VERSION) ) } spids: [160] ) ] spids: [156] ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} { (DQ ("Upgrading federation control plane ") (${ VSub_Name FEDERATION_NAME) (" with image ") (${ VSub_Name image_version) ) } ) (C {(${ VSub_Name host_kubectl)} {(set)} {(image)} {(deployment/federation-apiserver)} {(Lit_VarLike "apiserver=") (${ VSub_Name image_version)} ) (C {(${ VSub_Name host_kubectl)} {(set)} {(image)} {(deployment/federation-controller-manager)} {(controller-manager) (Lit_Other "=") (${ VSub_Name image_version)} ) ] spids: [118] ) spids: [112 117] ) (C {(upgrade)}) ] )