github.com/deemoprobe/k8s-first-commit@v0.0.0-20230430165612-a541f1982be3/src/scripts/kube-push.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2014 Google Inc. All rights reserved.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  # Push a new release to the cluster.
    18  #
    19  # This will find the release tar, cause it to be downloaded, unpacked, installed
    20  # and enacted.
    21  
    22  # exit on any error
    23  set -e
    24  
    25  source $(dirname $0)/util.sh
    26  
    27  # Make sure that prerequisites are installed.
    28  for x in gcloud gsutil; do
    29    if [ "$(which $x)" == "" ]; then
    30      echo "Can't find $x in PATH, please fix and retry."
    31      exit 1
    32    fi
    33  done
    34  
    35  # Find the release to use.  Generally it will be passed when doing a 'prod'
    36  # install and will default to the release/config.sh version when doing a
    37  # developer up.
    38  find-release $1
    39  
    40  # Detect the project into $PROJECT
    41  detect-master
    42  
    43  (
    44    echo MASTER_RELEASE_TAR=$RELEASE_NORMALIZED/master-release.tgz
    45    cat $(dirname $0)/../templates/download-release.sh
    46    echo "echo Executing configuration"
    47    echo "sudo salt '*' mine.update"
    48    echo "sudo salt --force-color '*' state.highstate"
    49  ) | gcloud compute ssh $KUBE_MASTER \
    50    --project ${PROJECT} --zone ${ZONE} --command="bash"
    51  
    52  get-password
    53  
    54  echo "Kubernetes cluster is running.  Access the master at:"
    55  echo
    56  echo "  https://${user}:${passwd}@${KUBE_MASTER_IP}"
    57  echo