Skip to content

Commit

Permalink
Update tools
Browse files Browse the repository at this point in the history
This change updates to the following:
* Ubuntu 20.04
* Go 1.16.7
* Minikube 1.22.0 (running Kubernetes 1.15.12)
* Skaffold 1.31.0
* Kubectl 1.15.12

In addition, it adds more documentation to the Kubernetes update script.
  • Loading branch information
nsurfer committed Sep 2, 2021
1 parent 7131867 commit 8107e67
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
dist: xenial
dist: focal

language: go
go:
- "1.13.3"
- "1.16.7"
go_import_path: github.com/nats-io/nats-operator

env:
- KUBERNETES_CONFIG_FILE=$HOME/.kube/config CHANGE_MINIKUBE_NONE_USER=true CLUSTER_SCOPED_E2E_NAMESPACE=nats-io NAMESPACE_SCOPED_E2E_NAMESPACE=nats-operator-e2e

before_install:
- sudo apt-get update -y
- sudo apt-get install -y conntrack

install:
- GO111MODULE=off go get -u github.com/cloudflare/cfssl/cmd/cfssl
- GO111MODULE=off go get -u github.com/cloudflare/cfssl/cmd/cfssljson

before_script:
- go version
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.12.4/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.32.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v0.20.0/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin/
- sudo minikube start --vm-driver=none --kubernetes-version=v1.12.4 --extra-config=apiserver.service-account-signing-key-file=/var/lib/minikube/certs/apiserver.key --extra-config=apiserver.service-account-issuer=api --extra-config=apiserver.service-account-api-audiences=api
- docker version
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.15.12/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.22.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.31.0/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin/
- minikube start --vm-driver=docker --kubernetes-version=v1.15.12 --extra-config=apiserver.service-account-signing-key-file=/var/lib/minikube/certs/apiserver.key --extra-config=apiserver.service-account-issuer=api --extra-config=apiserver.service-account-api-audiences=api
- minikube update-context
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nats-io/nats-operator

go 1.13
go 1.16

require (
cloud.google.com/go v0.47.0 // indirect
Expand Down
26 changes: 26 additions & 0 deletions hack/update-kube-version.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
#!/bin/sh
set -euo pipefail

# Usage
# In order to update k8s.io/kubernetes, we also have to update modules at
# k8s.io/XXX.
#
# To update the Kubernetes dependencies, first look for a tag here:
# https://github.com/kubernetes/kubernetes/releases
#
# Then, run this command:
# ./update-kube-version.sh 1.22.1
#
# This will update the go.mod file with the required sub-dependency versions
# and only then update the kubernetes version.

VERSION=${1#"v"}
if [ -z "$VERSION" ]; then
echo "Must specify version!"
exit 1
fi
echo "Specified version ${VERSION}"

echo "Checking which modules need updating..."
MODS=($(
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
))
echo "Found ${#MODS[@]} modules"

i=0
for MOD in "${MODS[@]}"; do
V=$(
go mod download -json "${MOD}@kubernetes-${VERSION}" |
sed -n 's|.*"Version": "\(.*\)".*|\1|p'
)
go mod edit "-replace=${MOD}=${MOD}@${V}"

i=$[i + 1]
echo "Updated ${MOD} (${i}/${#MODS[@]})"
done

echo "Lastly, updating k8s.io/kubernetes..."
go get "k8s.io/kubernetes@v${VERSION}"
go mod tidy

echo "Done!"

0 comments on commit 8107e67

Please sign in to comment.