Skip to content

Commit

Permalink
remove v1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jessie-JNing committed Jan 9, 2019
1 parent d75743c commit 7317002
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 35 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This repo also includes related tools for [running tasks](#kubernetes-run) and [
## Prerequisites

* Ruby 2.3+
* Your cluster must be running Kubernetes v1.9.0 or higher<sup>1</sup>
* Your cluster must be running Kubernetes v1.10.0 or higher<sup>1</sup>
* Each app must have a deploy directory containing its Kubernetes templates (see [Templates](#using-templates-and-variables))
* You must remove the` kubectl.kubernetes.io/last-applied-configuration` annotation from any resources in the namespace that are not included in your deploy directory. This annotation is added automatically when you create resources with `kubectl apply`. `kubernetes-deploy` will prune any resources that have this annotation and are not in the deploy directory.<sup>2</sup>
* Each app managed by `kubernetes-deploy` must have its own exclusive Kubernetes namespace.
Expand All @@ -92,7 +92,7 @@ offical compatibility chart below.

## Installation

1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl) (requires v1.9.0 or higher) and make sure it is available in your $PATH
1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl) (requires v1.10.0 or higher) and make sure it is available in your $PATH
2. Set up your [kubeconfig file](https://kubernetes.io/docs/tasks/access-application-cluster/authenticate-across-clusters-kubeconfig/) for access to your cluster(s).
3. `gem install kubernetes-deploy`

Expand Down Expand Up @@ -354,7 +354,7 @@ With this done, you can use the following command to restart all of them:

## Prerequisites

* You've already deployed a [`PodTemplate`](https://kubernetes.io/docs/api-reference/v1.9/#podtemplate-v1-core) object with field `template` containing a `Pod` specification that does not include the `apiVersion` or `kind` parameters. An example is provided in this repo in `test/fixtures/hello-cloud/template-runner.yml`.
* You've already deployed a [`PodTemplate`](https://v1-10.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#podtemplate-v1-core) object with field `template` containing a `Pod` specification that does not include the `apiVersion` or `kind` parameters. An example is provided in this repo in `test/fixtures/hello-cloud/template-runner.yml`.
* The `Pod` specification in that template has a container named `task-runner`.

Based on this specification `kubernetes-run` will create a new pod with the entrypoint of the `task-runner ` container overridden with the supplied arguments.
Expand Down Expand Up @@ -411,7 +411,7 @@ kubernetes-render --template-dir=./path/to/template/dir this-template.yaml.erb t

If you work for Shopify, just run `dev up`, but otherwise:

1. [Install kubectl version 1.9.0 or higher](https://kubernetes.io/docs/user-guide/prereqs/) and make sure it is in your path
1. [Install kubectl version 1.10.0 or higher](https://kubernetes.io/docs/user-guide/prereqs/) and make sure it is in your path
2. [Install minikube](https://kubernetes.io/docs/getting-started-guides/minikube/#installation) (required to run the test suite)
3. Check out the repo
4. Run `bin/setup` to install dependencies
Expand Down
4 changes: 2 additions & 2 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if [ ! -x "$(which minikube)" ]; then
fi

if [ ! -x "$(which kubectl)" ]; then
echo -e "\n\033[0;33mPlease install kubectl version 1.9.0 or higher:\nhttps://kubernetes.io/docs/user-guide/prereqs/\033[0m"
echo -e "\n\033[0;33mPlease install kubectl version 1.10.0 or higher:\nhttps://kubernetes.io/docs/user-guide/prereqs/\033[0m"
else
KUBECTL_VERSION=$(kubectl version --short --client | grep -oe "v[[:digit:]\.]\+")
echo -e "\n\033[0;32mKubectl version $KUBECTL_VERSION is already installed. This gem requires version v1.9.0 or greater.\033[0m"
echo -e "\n\033[0;32mKubectl version $KUBECTL_VERSION is already installed. This gem requires version v1.10.0 or greater.\033[0m"
fi
2 changes: 1 addition & 1 deletion lib/kubernetes-deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
require 'kubernetes-deploy/resource_cache'

module KubernetesDeploy
MIN_KUBE_VERSION = '1.9.0'
MIN_KUBE_VERSION = '1.10.0'
StatsD.build
end
36 changes: 8 additions & 28 deletions test/integration/kubernetes_deploy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,7 @@ def test_pruning_of_existing_managed_secrets_when_ejson_file_has_been_deleted
def test_deploy_result_logging_for_mixed_result_deploy
subset = ["bad_probe.yml", "init_crash.yml", "missing_volumes.yml", "config_map.yml"]
result = deploy_fixtures("invalid", subset: subset) do |f|
if kube_server_version >= Gem::Version.new("1.10.0") # https://github.com/kubernetes/kubernetes/issues/66135
f["bad_probe.yml"]["Deployment"].first["spec"]["progressDeadlineSeconds"] = 20
end
f["bad_probe.yml"]["Deployment"].first["spec"]["progressDeadlineSeconds"] = 20
end

assert_deploy_failure(result)
Expand All @@ -567,19 +565,11 @@ def test_deploy_result_logging_for_mixed_result_deploy
%r{ConfigMap/test\s+Available},
], in_order: true)

if kube_server_version < Gem::Version.new("1.10.0")
start_bad_probe_logs = [
%r{Deployment/bad-probe: TIMED OUT \(timeout: \d+s\)},
"Timeout reason: hard deadline for Deployment",
]
end_bad_probe_logs = [/Unhealthy: Readiness probe failed:.*\(\d+ events\)/] # event
else
start_bad_probe_logs = [
%r{Deployment/bad-probe: TIMED OUT \(progress deadline: \d+s\)},
"Timeout reason: ProgressDeadlineExceeded",
]
end_bad_probe_logs = ["Scaled up replica set bad-probe-"] # event
end
start_bad_probe_logs = [
%r{Deployment/bad-probe: TIMED OUT \(progress deadline: \d+s\)},
"Timeout reason: ProgressDeadlineExceeded",
]
end_bad_probe_logs = ["Scaled up replica set bad-probe-"] # event

# Debug info for bad probe timeout
assert_logs_match_all(start_bad_probe_logs + [
Expand Down Expand Up @@ -974,21 +964,13 @@ def test_resource_watcher_reports_failed_after_timeout
max_watch_seconds: 20
) do |f|
bad_probe = f["bad_probe.yml"]["Deployment"].first
if kube_server_version < Gem::Version.new("1.10.0") # https://github.com/kubernetes/kubernetes/issues/66135
bad_probe["metadata"]["annotations"]["kubernetes-deploy.shopify.io/timeout-override"] = '5s'
else
bad_probe["spec"]["progressDeadlineSeconds"] = 5
end
bad_probe["spec"]["progressDeadlineSeconds"] = 5
f["missing_volumes.yml"]["Deployment"].first["spec"]["progressDeadlineSeconds"] = 25
f["cannot_run.yml"]["Deployment"].first["spec"]["replicas"] = 1
end
assert_deploy_failure(result)

bad_probe_timeout = if kube_server_version < Gem::Version.new("1.10.0")
"Deployment/bad-probe: TIMED OUT (timeout: 5s)"
else
"Deployment/bad-probe: TIMED OUT (progress deadline: 5s)"
end
bad_probe_timeout ="Deployment/bad-probe: TIMED OUT (progress deadline: 5s)"

assert_logs_match_all([
"Successfully deployed 1 resource, timed out waiting for 2 resources to deploy, and failed to deploy 1 resource",
Expand Down Expand Up @@ -1047,7 +1029,6 @@ def test_raise_on_yaml_missing_kind
end

def test_hpa_can_be_successful
skip if kube_server_version < Gem::Version.new('1.9.0')
assert_deploy_success(deploy_fixtures("hpa"))
assert_logs_match_all([
"Deploying resources:",
Expand All @@ -1057,7 +1038,6 @@ def test_hpa_can_be_successful
end

def test_hpa_can_be_pruned
skip if kube_server_version < Gem::Version.new('1.9.0')
assert_deploy_success(deploy_fixtures("hpa"))
assert_deploy_success(deploy_fixtures("hpa", subset: ["deployment.yml"]))
assert_logs_match_all([
Expand Down

0 comments on commit 7317002

Please sign in to comment.