-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from banzaicloud/upgrade
PKE upgrade
- Loading branch information
Showing
57 changed files
with
1,158 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/dist/ | ||
/vendor/ | ||
/pke-single-config.yaml | ||
/pke-multi-config.yaml | ||
|
||
**/.vagrant* | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash -e | ||
|
||
# build latest pke tool | ||
GOOS=linux make pke | ||
|
||
KUBERNETES_VERSION="${1:-v1.14.3}" | ||
|
||
# upgrade first master node | ||
echo "" | ||
echo "= node1 ========================================================================" | ||
vagrant ssh node1 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION'" | ||
|
||
# upgrade second master node | ||
echo "" | ||
echo "= node2 ========================================================================" | ||
vagrant ssh node2 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION' --kubernetes-additional-control-plane" | ||
|
||
# upgrade third master node | ||
echo "" | ||
echo "= node3 ========================================================================" | ||
vagrant ssh node3 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION' --kubernetes-additional-control-plane" | ||
|
||
# upgrade worker node | ||
echo "" | ||
echo "= node4 ========================================================================" | ||
vagrant ssh node4 -c "sudo /banzaicloud/pke upgrade worker --kubernetes-version='$KUBERNETES_VERSION'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash -e | ||
|
||
# prerequisitesSkipping phase due to missing Pipeline API endpoint credentials | ||
jq --version || (echo "Please install jq command line tool. https://stedolan.github.io/jq/" && exit 1) | ||
|
||
# build latest pke tool | ||
GOOS=linux make pke | ||
|
||
KUBERNETES_VERSION="${1:-v1.14.3}" | ||
|
||
# install first master node | ||
echo "" | ||
echo "= node1 ========================================================================" | ||
vagrant up node1 | ||
vagrant ssh node1 -c "sudo /scripts/pke-multi-master1.sh '$KUBERNETES_VERSION'" | ||
vagrant ssh node1 -c 'sudo cat /etc/kubernetes/admin.conf' > pke-multi-config.yaml | ||
vagrant ssh node1 -c "sudo /banzaicloud/pke token list -o json" > build/token.json | ||
|
||
TOKEN=`jq -r '.tokens[] | select(.expired == false) | .token' build/token.json` | ||
CERTHASH=`jq -r '.tokens[] | select(.expired == false) | .hash' build/token.json` | ||
|
||
echo "" | ||
echo "Using '$TOKEN' and '$CERTHASH' to join other nodes to the cluster" | ||
|
||
# install second master node | ||
echo "" | ||
echo "= node2 ========================================================================" | ||
vagrant up node2 | ||
vagrant ssh node2 -c "sudo /scripts/pke-multi-mastern.sh '$KUBERNETES_VERSION' '$TOKEN' '$CERTHASH' 192.168.64.12" | ||
|
||
# install third master node | ||
echo "" | ||
echo "= node3 ========================================================================" | ||
vagrant up node3 | ||
vagrant ssh node3 -c "sudo /scripts/pke-multi-mastern.sh '$KUBERNETES_VERSION' '$TOKEN' '$CERTHASH' 192.168.64.13" | ||
|
||
# install worker node | ||
echo "" | ||
echo "= node4 ========================================================================" | ||
vagrant up node4 | ||
vagrant ssh node4 -c "sudo /scripts/pke-multi-worker.sh '$KUBERNETES_VERSION' '$TOKEN' '$CERTHASH'" | ||
|
||
export KUBECONFIG=$PWD/pke-multi-config.yaml | ||
|
||
echo "" | ||
echo "You can access your PKE cluster either:" | ||
echo "- from your host machine accessing the cluster via kubectl. Please run:" | ||
echo "export KUBECONFIG=$PWD/pke-multi-config.yaml" | ||
echo "" | ||
echo "- or starting a shell in the virtual machine. Please run:" | ||
echo "vagrant ssh node1 -c 'sudo -s'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -e | ||
|
||
# build latest pke tool | ||
GOOS=linux make pke | ||
|
||
KUBERNETES_VERSION="${1:-v1.14.3}" | ||
|
||
vagrant ssh node1 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright © 2019 Banzai Cloud | ||
// | ||
// 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. | ||
|
||
package cmd | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/banzaicloud/pke/cmd/pke/app/phases" | ||
"github.com/banzaicloud/pke/cmd/pke/app/phases/kubeadm/upgrade/controlplane" | ||
"github.com/banzaicloud/pke/cmd/pke/app/phases/kubeadm/upgrade/node" | ||
"github.com/banzaicloud/pke/cmd/pke/app/phases/kubeadm/version" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewCmdUpgrade(out io.Writer) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "upgrade", | ||
Short: "Upgrade a single Banzai Cloud Pipeline Kubernetes Engine (PKE) machine", | ||
Args: cobra.NoArgs, | ||
RunE: phases.RunEAllSubcommands, | ||
} | ||
|
||
cmd.AddCommand(upgradeMaster(out)) | ||
cmd.AddCommand(upgradeWorker(out)) | ||
|
||
return cmd | ||
} | ||
|
||
func upgradeMaster(out io.Writer) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "master", | ||
Short: "Upgrade a single Banzai Cloud Pipeline Kubernetes Engine (PKE) master machine", | ||
Args: cobra.NoArgs, | ||
RunE: phases.RunEAllSubcommands, | ||
} | ||
|
||
cmd.AddCommand(version.NewCommand(out)) | ||
cmd.AddCommand(controlplane.NewCommand(out)) | ||
|
||
phases.MakeRunnable(cmd) | ||
|
||
return cmd | ||
} | ||
|
||
func upgradeWorker(out io.Writer) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "worker", | ||
Short: "Upgrade a single Banzai Cloud Pipeline Kubernetes Engine (PKE) worker machine", | ||
Args: cobra.NoArgs, | ||
RunE: phases.RunEAllSubcommands, | ||
} | ||
|
||
cmd.AddCommand(version.NewCommand(out)) | ||
cmd.AddCommand(node.NewCommand(out)) | ||
|
||
phases.MakeRunnable(cmd) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.