This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[meta] add support for k8s 1.16 #635
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1218aa9
[meta] add support for k8s 1.16
jmlrt f4951b7
Merge branch 'master' into k8s-116
jmlrt 9802b12
[elasticsearch] test upgrade from 7.4.0 with k8s >= 1.16
jmlrt 9a1d5e5
Update elasticsearch/examples/upgrade/README.md
jmlrt 9576de5
use grep to avoid adding jq dependency
jmlrt 9c616af
update k8s client version to 1.16
jmlrt 8a44590
move upgrade logic into shell script to improve error handling
jmlrt 848a53d
make script verbose
jmlrt 2125fd8
update script to use jq
jmlrt 21e45f2
add jq to Docker image
jmlrt 6581eb7
improve script
jmlrt 4a7fbe5
fix jq curl command
jmlrt faee46e
fix shellcheck
jmlrt 16e57fd
remove docker-for-mac values used for testing locally
jmlrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
# Upgrade | ||
|
||
This example deploy a 3 nodes Elasticsearch cluster using [7.0.0-alpha1][] chart | ||
version, then upgrade it to 7.7.0 version. | ||
This example will deploy a 3 node Elasticsearch cluster using an old chart version, | ||
then upgrade it to version 7.7.0. | ||
|
||
The following upgrades are tested: | ||
- Upgrade from [7.0.0-alpha1][] version on K8S <1.16 | ||
- Upgrade from [7.4.0][] version on K8S >=1.16 (Elasticsearch chart < 7.4.0 are | ||
not compatible with K8S >= 1.16) | ||
|
||
|
||
## Usage | ||
|
||
Running `make install` command will do both 7.0.0-alpha1 install and 7.7.0 | ||
upgrade | ||
Running `make install` command will do first install and 7.7.0 upgrade. | ||
|
||
Note: [jq][] is a requirement for this make target. | ||
|
||
|
||
## Testing | ||
|
||
You can also run [goss integration tests][] using `make test` | ||
You can also run [goss integration tests][] using `make test`. | ||
|
||
|
||
[7.0.0-alpha1]: https://github.com/elastic/helm-charts/releases/tag/7.0.0-alpha1 | ||
[7.4.0]: https://github.com/elastic/helm-charts/releases/tag/7.4.0 | ||
[goss integration tests]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/examples/upgrade/test/goss.yaml | ||
[jq]: https://stedolan.github.io/jq/ |
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,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
usage() { | ||
cat <<-EOF | ||
USAGE: | ||
$0 [--release <release-name>] [--from <elasticsearch-version>] | ||
$0 --help | ||
|
||
OPTIONS: | ||
--release <release-name> | ||
Name of the Helm release to install | ||
--from <elasticsearch-version> | ||
Elasticsearch version to use for first install | ||
EOF | ||
exit 1 | ||
} | ||
|
||
RELEASE="helm-es-upgrade" | ||
FROM="" | ||
|
||
while [[ $# -gt 0 ]] | ||
do | ||
key="$1" | ||
|
||
case $key in | ||
--help) | ||
usage | ||
;; | ||
--release) | ||
RELEASE="$2" | ||
shift 2 | ||
;; | ||
--from) | ||
FROM="$2" | ||
shift 2 | ||
;; | ||
*) | ||
log "Unrecognized argument: '$key'" | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
if ! command -v jq > /dev/null | ||
then | ||
echo 'jq is required to use this script' | ||
echo 'please check https://stedolan.github.io/jq/download/ to install it' | ||
exit 1 | ||
fi | ||
|
||
# Elasticsearch chart < 7.4.0 are not compatible with K8S >= 1.16) | ||
if [[ -z $FROM ]] | ||
then | ||
KUBE_MINOR_VERSION=$(kubectl version -o json | jq --raw-output --exit-status '.serverVersion.minor' | sed 's/[^0-9]*//g') | ||
|
||
if [ "$KUBE_MINOR_VERSION" -lt 16 ] | ||
then | ||
FROM="7.0.0-alpha1" | ||
else | ||
FROM="7.4.0" | ||
fi | ||
fi | ||
|
||
helm repo add elastic https://helm.elastic.co | ||
|
||
# Initial install | ||
printf "Installing Elasticsearch chart %s\n" "$FROM" | ||
helm upgrade --wait --timeout=600 --install "$RELEASE" elastic/elasticsearch --version "$FROM" --set clusterName=upgrade | ||
kubectl rollout status sts/upgrade-master --timeout=600s | ||
|
||
# Upgrade | ||
printf "Upgrading Elasticsearch chart\n" | ||
helm upgrade --wait --timeout=600 --set terminationGracePeriod=121 --install "$RELEASE" ../../ --set clusterName=upgrade | ||
kubectl rollout status sts/upgrade-master --timeout=600s |
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 |
---|---|---|
|
@@ -40,3 +40,4 @@ APM_SERVER_SUITE: | |
KUBERNETES_VERSION: | ||
- '1.14' | ||
- '1.15' | ||
- '1.16' | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could define the chart versions for upgrade testing here somehow so it is very clear what the test cases are, something like this
But I think we can only fit this logic into the jenkins job inline shell script, or the Makefile inline shell script the way the job axes work, so adding into the Makefile makes sense to me.