Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[meta] add support for k8s 1.16 #635

Merged
merged 14 commits into from
May 29, 2020
7 changes: 5 additions & 2 deletions elasticsearch/examples/upgrade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ not compatible with K8S >= 1.16)

## Usage

Running `make install` command will do first 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/
15 changes: 11 additions & 4 deletions elasticsearch/examples/upgrade/scripts/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash

set -exo pipefail
set -euo pipefail

usage() {
cat <<-EOF
USAGE:
$0 [--release <release-name>] [--from <elasticsearch-version>] --to <elasticsearch-version>
$0 [--release <release-name>] [--from <elasticsearch-version>]
$0 --help

OPTIONS:
--release <release-name>
--release <release-name>
Name of the Helm release to install
--from <elasticsearch-version>
Elasticsearch version to use for first install
Expand Down Expand Up @@ -43,10 +43,17 @@ do
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 --client -o yaml | grep minor | sed 's/[^0-9]*//g')
KUBE_MINOR_VERSION=$(kubectl version -o json | jq -c '.serverVersion.minor' | sed 's/[^0-9]*//g')
Conky5 marked this conversation as resolved.
Show resolved Hide resolved

if [ "$KUBE_MINOR_VERSION" -lt 16 ]
then
Expand Down