#!/bin/bash # Copyright 2014 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. # Push a new release to the cluster. # # This will find the release tar, cause it to be downloaded, unpacked, installed # and enacted. set -o errexit set -o nounset set -o pipefail echo "kube-push.sh is currently broken; see https://github.com/kubernetes/kubernetes/issues/17397" exit 1 global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." if test -f "$(KUBE_ROOT)/cluster/env.sh" { source "$(KUBE_ROOT)/cluster/env.sh" } source "$(KUBE_ROOT)/cluster/kube-util.sh" proc usage { echo "$(0) [-m|-n ] " echo " Updates Kubernetes binaries. Can be done for all components (by default), master(-m) or specified node(-n)." echo " If the version is not specified will try to use local binaries." echo " Warning: upgrading single node is experimental" } global push_to_master := 'false' global push_to_node := 'false' while getopts "mn:h" opt { matchstr $(opt) { m { global push_to_master := 'true'} n { global push_to_node := 'true' global node_id := $OPTARG} h { usage exit 0} \? { echo "Invalid option: -$OPTARG" > !2 usage exit 1} } } shift $(OPTIND-1) if [[ "${push_to_master}" == "true" ]] && [[ "${push_to_node}" == "true" ]] { echo "Only one of options -m -n should be specified" usage exit 1 } verify-prereqs verify-kube-binaries global KUBE_VERSION := $(1-) if [[ "${push_to_master}" == "false" ]] && [[ "${push_to_node}" == "false" ]] { echo "Updating cluster using provider: $KUBERNETES_PROVIDER" kube-push } if [[ "${push_to_master}" == "true" ]] { echo "Updating master to version $(KUBE_VERSION:-"dev")" prepare-push false push-master } if [[ "${push_to_node}" == "true" ]] { echo "Updating node $node_id to version $(KUBE_VERSION:-"dev")" prepare-push true push-node $node_id } echo "Validating cluster post-push..." "$(KUBE_ROOT)/cluster/validate-cluster.sh" echo "Done" (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (C {(echo)} { (DQ ( "kube-push.sh is currently broken; see https://github.com/kubernetes/kubernetes/issues/17397" ) ) } ) (C {(exit)} {(1)}) (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: [88 96] ) (/..) } spids: [87] ) ] spids: [87] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/env.sh))} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/env.sh))})] spids: [-1 116] ) ] spids: [-1 128] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kube-util.sh))}) (FuncDef name: usage body: (BraceGroup children: [ (C {(echo)} {(DQ (${ VSub_Number 0) (" [-m|-n ] "))}) (C {(echo)} { (DQ ( " Updates Kubernetes binaries. Can be done for all components (by default), master(-m) or specified node(-n)." ) ) } ) (C {(echo)} {(DQ (" If the version is not specified will try to use local binaries."))}) (C {(echo)} {(DQ (" Warning: upgrading single node is experimental"))}) ] spids: [147] ) spids: [141 146] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:push_to_master) op:Equal rhs:{(false)} spids:[183])] spids: [183] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:push_to_node) op:Equal rhs:{(false)} spids:[186])] spids: [186] ) (While cond: [(Sentence child:(C {(getopts)} {(DQ ("mn:h"))} {(opt)}) terminator:)] body: (DoGroup children: [ (Case to_match: {(${ VSub_Name opt)} arms: [ (case_arm pat_list: [{(m)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:push_to_master) op: Equal rhs: {(true)} spids: [217] ) ] spids: [217] ) ] spids: [213 214 219 -1] ) (case_arm pat_list: [{(n)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:push_to_node) op: Equal rhs: {(true)} spids: [226] ) ] spids: [226] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:node_id) op: Equal rhs: {(DQ ($ VSub_Name "$OPTARG"))} spids: [230] ) ] spids: [230] ) ] spids: [222 223 234 -1] ) (case_arm pat_list: [{(h)}] action: [(C {(usage)}) (C {(exit)} {(0)})] spids: [237 238 247 -1] ) (case_arm pat_list: [{(EscapedLiteralPart token:)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Invalid option: -") ($ VSub_Name "$OPTARG"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[261])] ) (C {(usage)}) (C {(exit)} {(1)}) ] spids: [250 251 271 -1] ) ] spids: [204 210 274] ) ] spids: [201 276] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithVarRef name:OPTIND) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [280 285] ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_master))} right: {(DQ (true))} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_node))} right: {(DQ (true))} ) ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Only one of options -m -n should be specified"))}) (C {(usage)}) (C {(exit)} {(1)}) ] spids: [-1 325] ) ] spids: [-1 342] ) (C {(verify-prereqs)}) (C {(verify-kube-binaries)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_VERSION) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{}) spids: [350 353] ) } spids: [349] ) ] spids: [349] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_master))} right: {(DQ (false))} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_node))} right: {(DQ (false))} ) ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Updating cluster using provider: ") ($ VSub_Name "$KUBERNETES_PROVIDER"))} ) (C {(kube-push)}) ] spids: [-1 393] ) ] spids: [-1 406] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_master))} right: {(DQ (true))} ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Updating master to version ") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ (dev))}) spids: [435 441] ) ) } ) (C {(prepare-push)} {(false)}) (C {(push-master)}) ] spids: [-1 428] ) ] spids: [-1 452] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ (${ VSub_Name push_to_node))} right: {(DQ (true))} ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Updating node ") ($ VSub_Name "$node_id") (" to version ") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ (dev))}) spids: [483 489] ) ) } ) (C {(prepare-push)} {(true)}) (C {(push-node)} {($ VSub_Name "$node_id")}) ] spids: [-1 474] ) ] spids: [-1 502] ) (C {(echo)} {(DQ ("Validating cluster post-push..."))}) (C {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/validate-cluster.sh))}) (C {(echo)} {(DQ (Done))}) ] )