krane 2.4.6 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3efffadcb3741041089702a861ec5895261b3a47a4b3bee3ab2290f2d47b237e
4
- data.tar.gz: fd9d8eda29c43146a4754e55321e0546244ef79ce67d534895b5c159b55399e2
3
+ metadata.gz: ba72a52b848777243b9335d8df21f98080fcf49142706c2443bf40475d071b5f
4
+ data.tar.gz: 4f1a17c291e5ef38847f7a083cc1d6dcc00262c0dd447a39b7c39ab044268142
5
5
  SHA512:
6
- metadata.gz: e5f7a84718bf3be365a9947cbb7124f2ca6df5967dd39694ce0882bbfd620e488e91610ccc284d33a04d0af2471b3fc11f42b79853db0c20e87b6babc69adeb2
7
- data.tar.gz: 57ed1f07880d46fd2bf5388bb7ae9bb3bb5f50aa4ec001e7d095d9cadf66e01952f0082bc3bd3f0115dcab3afa531f07d709404c6cfcafc93941a48a55941fbb
6
+ metadata.gz: fdae1d679008ec4de4ee83c2f1925f7b168456189f824face6b3d3f7079bdda89c25bea6da676ab95508cc5ce125587863e8af307a6f6d3814dc75b029280d56
7
+ data.tar.gz: 603e6f890a482b0e549ed9b1c0deca4ae3e4bb73144c7174f2a430c964127ee4cd75d516eb4e7561258afac29c711f5b595c3cc35316cf4c9e05a6a1aeab9bf0
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @Shopify/app-lifecycle
1
+ * @Shopify/infrastructure-tooling
@@ -0,0 +1,22 @@
1
+ version: 2
2
+ registries:
3
+ ruby-shopify:
4
+ type: rubygems-server
5
+ url: https://pkgs.shopify.io/basic/gems/ruby
6
+ username: ${{secrets.RUBYGEMS_SERVER_PKGS_SHOPIFY_IO_USERNAME}}
7
+ password: ${{secrets.RUBYGEMS_SERVER_PKGS_SHOPIFY_IO_PASSWORD}}
8
+ github-com:
9
+ type: git
10
+ url: https://github.com
11
+ username: ${{secrets.DEPENDENCIES_GITHUB_USER}}
12
+ password: ${{secrets.DEPENDENCIES_GITHUB_TOKEN}}
13
+ updates:
14
+ - package-ecosystem: bundler
15
+ directory: "/"
16
+ schedule:
17
+ interval: "weekly"
18
+ time: "10:00"
19
+ timezone: "America/Toronto"
20
+ open-pull-requests-limit: 100
21
+ insecure-external-code-execution: allow
22
+ registries: "*"
@@ -0,0 +1,18 @@
1
+ name: Project automations
2
+ on:
3
+ issues:
4
+ types:
5
+ - opened
6
+ - reopened
7
+ env:
8
+ PROJECT_URL: https://github.com/orgs/Shopify/projects/2279
9
+
10
+ jobs:
11
+ add-to-project:
12
+ name: Issue or PR opened
13
+ runs-on: shopify-ubuntu-latest
14
+ steps:
15
+ - uses: actions/add-to-project@v0.4.0 # https://github.com/actions/add-to-project/tree/v0.4.0
16
+ with:
17
+ project-url: ${{ env.PROJECT_URL }}
18
+ github-token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
@@ -5,62 +5,61 @@ on: [push]
5
5
  jobs:
6
6
  ruby-tests:
7
7
  runs-on: ubuntu-latest
8
+ env:
9
+ CI: true
8
10
 
9
- name: "Tests - Ruby ${{ matrix.ruby }} with k8s ${{ matrix.kubernetes_version }}"
11
+ name: "Tests (${{matrix.test_suite}}) - Ruby ${{ matrix.ruby }} with Kubernetes ${{ matrix.kubernetes_version }}"
10
12
  strategy:
11
13
  fail-fast: false
12
14
  matrix:
13
15
  ruby:
14
- # Use unique Ruby versions, or GitHub gets confused when building the rest of the matrix
15
- - '3.0.3' # With k8s 1.23
16
- - '3.0.2' # With k8s 1.22
17
- - '3.0.1' # With k8s 1.21
18
- - '3.0' # With k8s 1.20
19
- - '2.7' # With k8s 1.19
16
+ - "3.2.2"
17
+ - "3.1.2"
18
+ - "3.0.4"
19
+ - "2.7.6"
20
+ kubernetes_version:
21
+ - "1.30.0"
22
+ - "1.29.4"
23
+ - "1.28.0"
24
+ - "1.27.3"
25
+ - "1.26.4"
26
+ test_suite:
27
+ - "unit_test"
28
+ - "cli_test"
29
+ - "serial_integration_test"
30
+ - "integration_test"
20
31
  include:
21
- # Match kind images with chosen version https://github.com/kubernetes-sigs/kind/releases
22
- - ruby: '3.0.3'
23
- kind_version: 'v0.11.1'
24
- kubernetes_version: '1.23.0'
25
- kind_image: 'kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac'
26
- - ruby: '3.0.2'
27
- kind_version: 'v0.11.1'
28
- kubernetes_version: '1.22.0'
29
- kind_image: 'kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047'
30
- - ruby: '3.0.1'
31
- kind_version: 'v0.11.1'
32
- kubernetes_version: '1.21.1'
33
- kind_image: 'kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6'
34
- - ruby: '3.0'
35
- kind_version: 'v0.11.1'
36
- kubernetes_version: '1.20.7'
37
- kind_image: 'kindest/node:v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9'
38
- - ruby: '2.7'
39
- kind_version: 'v0.11.1'
40
- kubernetes_version: '1.19.11'
41
- kind_image: 'kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729'
32
+ - kubernetes_version: "1.30.0"
33
+ kind_image: "kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e"
34
+ - kubernetes_version: "1.29.4"
35
+ kind_image: "kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8"
36
+ - kubernetes_version: "1.28.0"
37
+ kind_image: "kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213"
38
+ - kubernetes_version: "1.27.3"
39
+ kind_image: "kindest/node:v1.27.3@sha256:9dd3392d79af1b084671b05bcf65b21de476256ad1dcc853d9f3b10b4ac52dde"
40
+ - kubernetes_version: "1.26.4"
41
+ kind_image: "kindest/node:v1.26.4@sha256:a539833d26264444ab3b8f5e56e23fa3361436445fa23c864e6dec622458858f"
42
42
 
43
43
  steps:
44
- - uses: actions/checkout@v2
44
+ - uses: actions/checkout@v3
45
45
 
46
- - name: Set up Ruby ${{ matrix.ruby }}
46
+ - name: Setup Ruby ${{ matrix.ruby }}
47
47
  uses: ruby/setup-ruby@v1
48
48
  with:
49
49
  ruby-version: ${{ matrix.ruby }}
50
50
  bundler-cache: true
51
51
 
52
- - name: Setup kubectl
52
+ - name: Setup kubectl ${{ matrix.kubernetes_version }}
53
53
  run: |
54
54
  mkdir -p "${GITHUB_WORKSPACE}/bin"
55
55
  curl -o "${GITHUB_WORKSPACE}/bin/kubectl" -LO "https://dl.k8s.io/release/v${{ matrix.kubernetes_version }}/bin/linux/amd64/kubectl"
56
56
  chmod +x "${GITHUB_WORKSPACE}/bin/kubectl"
57
57
  echo "PATH=$GITHUB_WORKSPACE/bin:${PATH}" >> $GITHUB_ENV
58
58
 
59
- - uses: engineerd/setup-kind@v0.5.0
60
- with:
61
- version: "${{ matrix.kind_version }}"
62
- image: "${{ matrix.kind_image }}"
59
+ - name: Create kind cluster for ${{ matrix.kubernetes_version }}
60
+ run: |
61
+ kind create cluster --image=${{ matrix.kind_image }}
63
62
 
64
63
  - name: Run tests
65
64
  run: |
66
- bin/test
65
+ bin/test ${{matrix.test_suite}}
@@ -0,0 +1,22 @@
1
+ name: Contributor License Agreement (CLA)
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize]
6
+ issue_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ cla:
11
+ runs-on: ubuntu-latest
12
+ if: |
13
+ (github.event.issue.pull_request
14
+ && !github.event.issue.pull_request.merged_at
15
+ && contains(github.event.comment.body, 'signed')
16
+ )
17
+ || (github.event.pull_request && !github.event.pull_request.merged)
18
+ steps:
19
+ - uses: Shopify/shopify-cla-action@v1
20
+ with:
21
+ github-token: ${{ secrets.GITHUB_TOKEN }}
22
+ cla-token: ${{ secrets.CLA_TOKEN }}
data/.gitignore CHANGED
@@ -9,7 +9,6 @@
9
9
  /tmp/
10
10
 
11
11
  .byebug_history
12
- .ruby-version
13
12
  coverage/*
14
13
  dev/flamegraph.svg
15
14
  dev/profile
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/1.0-Upgrade.md CHANGED
@@ -7,7 +7,7 @@
7
7
  * There are breaking changes in the public API (such as the renaming of the `KubernetesDeploy` namespace to `Krane`, and the change in default values for different arguments of the public interface).
8
8
  * StatsD metrics will now be generated with the `krane` prefix.
9
9
  * `krane deploy` now considers all namespaced resources eligible for pruning, including
10
- custom resources. See [blacklist](https://github.com/Shopify/krane/blob/master/lib/krane/cluster_resource_discovery.rb#L20) for exceptions.
10
+ custom resources. See [blacklist](https://github.com/Shopify/krane/blob/main/lib/krane/cluster_resource_discovery.rb#L20) for exceptions.
11
11
  * `kubernetes-deploy` (now `krane deploy`) / `DeployTask` can no longer deploy global (non-namespaced) resources. A new command called `krane global-deploy` and a related class called `GlobalDeployTask` were added to replace that feature.
12
12
  * `krane deploy` will not render erb templates. Use `krane render | krane deploy --stdin` to reproduce this functionality.
13
13
  * If you attempt to install two gems that have conflicting executables, `gem install` will warn you but the most recently installed one will win.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,102 @@
1
1
  ## next
2
2
 
3
+ ## 3.6.2
4
+
5
+ - Pinning `stats-instrument` to < 3.9 to avoid breaking changes.
6
+
7
+ ## 3.6.1
8
+
9
+ *Features*
10
+
11
+ - Enable the option to bypass endpoint validation for a service by using the annotation `krane.shopify.io/skip-endpoint-validation: true`.
12
+
13
+ ## 3.6.0
14
+
15
+ - Test against k8s 1.29, 1.30
16
+ - Drop support for k8s 1.24
17
+
18
+ ## 3.5.3
19
+
20
+ - Fix a minor bug in the RestartAPIError class (https://github.com/Shopify/krane/pull/953)
21
+
22
+ ## 3.5.2
23
+
24
+ - Fixed an issue where deploying StatefulSets monitored the health of the previous revision's pods instead of the updated one.
25
+
26
+ ## 3.5.1
27
+
28
+ - Fixed successful deployment check for StatefulSets introduced in v3.3.0.
29
+
30
+ ## 3.5.0
31
+
32
+ - Test against k8s 1.28
33
+ - Drop support for k8s 1.23
34
+
35
+ ## 3.4.2
36
+
37
+ - Remove flag `--skip-dry-run` (see [#946](https://github.com/Shopify/krane/pull/946))
38
+ - Remove support for batched server-side dry-run ([#946](https://github.com/Shopify/krane/pull/946))
39
+
40
+ ## 3.4.1
41
+
42
+ - Added flag `--skip-dry-run` to completely opt out of dry run validation.
43
+
44
+ ## 3.4.0
45
+
46
+ - Use `prune-allowlist` instead of `prune-whitelist` for 1.26+ clusters. Clusters running 1.25 or less will continue to use `--prune-whitelist`. [#940](https://github.com/Shopify/krane/pull/940)
47
+
48
+ ## 3.3.0
49
+
50
+ *Enhancements*
51
+
52
+ - Enable detection of successful StatefulSet deploys when the `updateStrategy` is `onDelete`, behind an annotation. [#926](https://github.com/Shopify/krane/pull/926)
53
+
54
+ ## 3.2.0
55
+
56
+ *Enhancements*
57
+
58
+ - Test against k8s 1.26
59
+
60
+ ## 3.1.0
61
+
62
+ *Enhancements*
63
+
64
+ - Modify HorizontalPodAutoscaler resource class used. [#920](https://github.com/Shopify/krane/pull/920).
65
+
66
+ ## 3.0.1
67
+
68
+ - Add `Event` to the list of resources not to be pruned on a deployment. Kubernetes should clean these up automatically. This can cause unnessessary deployment timeouts and increased deployment time. [#909](https://github.com/Shopify/krane/pull/909)
69
+
70
+ ## 3.0.0
71
+
72
+ *Enhancements*
73
+
74
+ - CI test matrix now test all Krane supported Ruby and Kubernetes versions.
75
+ Ruby: 3.1.2 , 3.0.4 , 2.7.6, Kubernetes: - 1.24.6, 1.23.12, 1.22.15.
76
+
77
+ *Breaking Changes*
78
+ - Remove unsupported Kubernetes and Ruby versions from Krane and CI [#905](https://github.com/Shopify/krane/pull/905).
79
+ See supported Kubernetes and Ruby versions in [Compatibility](./CONTRIBUTING.md#compatibility).
80
+ If you are using Kubernetes <v1.22 keep using Krane v2.4.9.
81
+
82
+ ## 2.4.9
83
+
84
+ - Fixed a Ruby 3.1 regression that caused an exception when using a `--bindings=@<file>` argument to `krane render` [#900](https://github.com/Shopify/krane/pull/900)
85
+
86
+ ## 2.4.8
87
+
88
+ - update googleauth gem version to 1.2
89
+ - add the `ruby-lsp` gem to development group in the Gemfile
90
+ ## 2.4.7
91
+
92
+ *Bug fixes*
93
+
94
+ - Fix `replace-force` deployment method override.
95
+ ```
96
+ /usr/local/bundle/gems/krane-2.4.6/lib/krane/resource_deployer.rb:119:in `block in deploy_resources': Unexpected deploy method! (:"replace-force") (ArgumentError)
97
+ ```
98
+ Dash (-) must be replaced with underscore (_) before applying it as method on kubernetes resource.
99
+
3
100
  ## 2.4.6
4
101
 
5
102
  *Bug fixes*
@@ -236,7 +333,7 @@ It seems an issue when too many pods are referencing the same secret/configmap h
236
333
  # 1.0.0
237
334
 
238
335
  We've renamed the gem and cli to Krane.
239
- See our [migration guide](https://github.com/Shopify/krane/blob/master/1.0-Upgrade.md) to help navigate the breaking changes.
336
+ See our [migration guide](https://github.com/Shopify/krane/blob/main/1.0-Upgrade.md) to help navigate the breaking changes.
240
337
 
241
338
  ## 1.0.0.pre.2
242
339
 
data/CONTRIBUTING.md CHANGED
@@ -22,16 +22,14 @@ The following is a set of guidelines for contributing to krane. Please take a mo
22
22
  * [CI (External contributors)](#ci-external-contributors)
23
23
  ## Code of Conduct
24
24
 
25
- This project and everyone participating in it are governed by the [Code of Conduct](https://github.com/Shopify/krane/blob/master/CODE_OF_CONDUCT.md).
25
+ This project and everyone participating in it are governed by the [Code of Conduct](https://github.com/Shopify/krane/blob/main/CODE_OF_CONDUCT.md).
26
26
  By participating, you are expected to uphold this code. Please report unacceptable
27
27
  behavior to [krane@shopify.com](mailto:krane@shopify.com).
28
28
 
29
29
  ## Maintainers
30
30
 
31
31
  This project is currently under the stewardship of the Production Platform group at Shopify.
32
- The two primary maintainers are @knverey and @dturn. Approval from at least one primary maintainer is
33
- required for all significant feature proposals and code architecture changes. In general,
34
- two people must approve all non-trivial PRs.
32
+ In general, two people must approve all non-trivial PRs.
35
33
 
36
34
  ## What should I know before I get started?
37
35
 
@@ -97,9 +95,9 @@ This gem uses subclasses of `KubernetesResource` to implement custom success/fai
97
95
  * `deploy_failed?`
98
96
  3. Adjust the `TIMEOUT` constant to an appropriate value for this type.
99
97
  4. Add the new class to list of resources in
100
- [`deploy_task.rb`](https://github.com/Shopify/krane/blob/master/lib/krane/deploy_task.rb#L8)
101
- 5. Add the new resource to the [prune whitelist](https://github.com/Shopify/krane/blob/master/lib/krane/deploy_task.rb#L81)
102
- 6. Add a basic example of the type to the hello-cloud [fixture set](https://github.com/Shopify/krane/tree/master/test/fixtures/hello-cloud) and appropriate assertions to `#assert_all_up` in [`hello_cloud.rb`](https://github.com/Shopify/krane/blob/master/test/helpers/fixture_sets/hello_cloud.rb). This will get you coverage in several existing tests, such as `test_full_hello_cloud_set_deploy_succeeds`.
98
+ [`deploy_task.rb`](https://github.com/Shopify/krane/blob/main/lib/krane/deploy_task.rb#L8)
99
+ 5. Add the new resource to the [prune whitelist](https://github.com/Shopify/krane/blob/main/lib/krane/deploy_task.rb#L81)
100
+ 6. Add a basic example of the type to the hello-cloud [fixture set](https://github.com/Shopify/krane/tree/main/test/fixtures/hello-cloud) and appropriate assertions to `#assert_all_up` in [`hello_cloud.rb`](https://github.com/Shopify/krane/blob/main/test/helpers/fixture_sets/hello_cloud.rb). This will get you coverage in several existing tests, such as `test_full_hello_cloud_set_deploy_succeeds`.
103
101
  7. Add tests for any edge cases you foresee.
104
102
 
105
103
  ### Contributor License Agreement
@@ -113,7 +111,7 @@ This gem uses subclasses of `KubernetesResource` to implement custom success/fai
113
111
 
114
112
  If you work for Shopify, just run `dev up`, but otherwise:
115
113
 
116
- 1. [Install kubectl version 1.10.0 or higher](https://kubernetes.io/docs/user-guide/prereqs/) and make sure it is in your path
114
+ 1. [Install kubectl version 1.28.0 or higher](https://kubernetes.io/docs/user-guide/prereqs/) and make sure it is in your path
117
115
  2. [Install minikube](https://kubernetes.io/docs/getting-started-guides/minikube/#installation) (required to run the test suite)
118
116
  3. [Install any required minikube drivers](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md) (on OS X, you may need the [hyperkit driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperkit-driver)
119
117
  4. Check out the repo
data/Gemfile CHANGED
@@ -3,3 +3,5 @@ source 'https://rubygems.org'
3
3
 
4
4
  # Specify your gem's dependencies in krane.gemspec
5
5
  gemspec
6
+
7
+ gem "ruby-lsp", "~> 0.2.0", group: :development
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # krane [![Build status](https://badge.buildkite.com/35c56e797c3bbd6ba50053aefdded0715898cd8e8c86f7e462.svg?branch=master)](https://buildkite.com/shopify/krane)
1
+ # krane [![Build status](https://badge.buildkite.com/35c56e797c3bbd6ba50053aefdded0715898cd8e8c86f7e462.svg?branch=main)](https://buildkite.com/shopify/krane)
2
2
 
3
- > This project used to be called `kubernetes-deploy`. Check out our [migration guide](https://github.com/Shopify/krane/blob/master/1.0-Upgrade.md) for more information including details about breaking changes.
3
+ > This project used to be called `kubernetes-deploy`. Check out our [migration guide](https://github.com/Shopify/krane/blob/main/1.0-Upgrade.md) for more information including details about breaking changes.
4
4
 
5
5
 
6
6
  `krane` is a command line tool that helps you ship changes to a Kubernetes namespace and understand the result. At Shopify, we use it within our much-beloved, open-source [Shipit](https://github.com/Shopify/shipit-engine#kubernetes) deployment app.
@@ -74,23 +74,33 @@ If you need the ability to render dynamic values in templates before deploying,
74
74
  ## Prerequisites
75
75
 
76
76
  * Ruby 2.7+
77
- * Your cluster must be running Kubernetes v1.19.0 or higher<sup>1</sup>
77
+ * Your cluster must be running Kubernetes v1.24.0 or higher<sup>1</sup>
78
78
 
79
- <sup>1</sup> We run integration tests against these Kubernetes versions. You can find our
80
- official compatibility chart below.
79
+ ## Compatibility
80
+
81
+ <sup>1</sup> We run integration tests against these Kubernetes versions. You can find our official compatibility chart below.
82
+
83
+ Krane provides support for official upstream supported versions [Kubernetes](https://endoflife.date/kubernetes), [Ruby](https://endoflife.date/ruby) that are part of the compatibility matrix; Nevertheless, older releases are still likely to work.
81
84
 
82
85
  | Kubernetes version | Currently Tested? | Last officially supported in gem version |
83
86
  |:------------------:|-------------------|:----------------------------------------:|
84
87
  | 1.18 | No | 2.3.7 |
85
- | 1.19 | Yes | -- |
86
- | 1.20 | Yes | -- |
87
- | 1.21 | Yes | -- |
88
- | 1.22 | Yes | -- |
89
- | 1.23 | Yes | -- |
88
+ | 1.19 | No | 2.4.9 |
89
+ | 1.20 | No | 2.4.9 |
90
+ | 1.21 | No | 2.4.9 |
91
+ | 1.22 | No | 3.0.1 |
92
+ | 1.23 | No | 3.4.2 |
93
+ | 1.24 | No | 3.5.3 |
94
+ | 1.25 | No | -- |
95
+ | 1.26 | Yes | -- |
96
+ | 1.27 | Yes | -- |
97
+ | 1.28 | Yes | -- |
98
+ | 1.29 | Yes | -- |
99
+ | 1.30 | Yes | -- |
90
100
 
91
101
  ## Installation
92
102
 
93
- 1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl) (requires v1.19.0 or higher) and make sure it is available in your $PATH
103
+ 1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl) (requires v1.28.0 or higher) and make sure it is available in your $PATH
94
104
  2. Set up your [kubeconfig file](https://kubernetes.io/docs/tasks/access-application-cluster/authenticate-across-clusters-kubeconfig/) for access to your cluster(s).
95
105
  3. `gem install krane`
96
106
 
@@ -149,14 +159,13 @@ If you want dynamic templates, you may render ERB with `krane render` and then p
149
159
  - `krane.shopify.io/required-rollout`: Modifies how much of the rollout needs to finish
150
160
  before the deployment is considered successful.
151
161
  - _Compatibility_: Deployment
152
- - `full`: The deployment is successful when all pods in the new `replicaSet` are ready.
153
- - `none`: The deployment is successful as soon as the new `replicaSet` is created for the deployment.
154
- - `maxUnavailable`: The deploy is successful when minimum availability is reached in the new `replicaSet`.
155
- In other words, the number of new pods that must be ready is equal to `spec.replicas` - `strategy.RollingUpdate.maxUnavailable`
156
- (converted from percentages by rounding up, if applicable). This option is only valid for deployments
157
- that use the `RollingUpdate` strategy.
158
- - Percent (e.g. 90%): The deploy is successful when the number of new pods that are ready is equal to
159
- `spec.replicas` * Percent.
162
+ - `full`: The deployment is successful when all pods in the new `replicaSet` are ready.
163
+ - `none`: The deployment is successful as soon as the new `replicaSet` is created for the deployment.
164
+ - `maxUnavailable`: The deploy is successful when minimum availability is reached in the new `replicaSet`.
165
+ In other words, the number of new pods that must be ready is equal to `spec.replicas` - `strategy.RollingUpdate.maxUnavailable` (converted from percentages by rounding up, if applicable). This option is only valid for deployments that use the `RollingUpdate` strategy.
166
+ - Percent (e.g. 90%): The deploy is successful when the number of new pods that are ready is equal to `spec.replicas` * Percent.
167
+ - _Compatibility_: StatefulSet
168
+ - `full`: The deployment is successful when all pods are ready.
160
169
  - `krane.shopify.io/predeployed`: Causes a Custom Resource to be deployed in the pre-deploy phase.
161
170
  - _Compatibility_: Custom Resource Definition
162
171
  - _Default_: `true`
@@ -167,6 +176,10 @@ before the deployment is considered successful.
167
176
  - _Accepted values_: `create`, `replace`, and `replace-force`
168
177
  - _Warning_: Resources whose deploy method is overridden are no longer subject to pruning on deploy.
169
178
  - This feature is _experimental_ and may be removed at any time.
179
+ - `krane.shopify.io/skip-endpoint-validation`: Skip endpoint validation for the service.
180
+ - _Compatibility_: Service
181
+ - _Default_: `false`
182
+ - `true`: Endpoint validation is not performed during the deployment of the service.
170
183
 
171
184
 
172
185
  ### Running tasks at the beginning of a deploy
@@ -298,7 +311,7 @@ As an example, the following is the default configuration that will be used if y
298
311
  }'
299
312
  ```
300
313
 
301
- The paths defined here are based on the [typical status properties](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#typical-status-properties) as defined by the Kubernetes community. It expects the `status` subresource to contain a `conditions` array whose entries minimally specify `type`, `status`, and `message` fields.
314
+ The paths defined here are based on the [typical status properties](https://github.com/kubernetes/community/blob/0e9fa4a1c45203527a7ce35eaff09204d6b7b331/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties) as defined by the Kubernetes community. It expects the `status` subresource to contain a `conditions` array whose entries minimally specify `type`, `status`, and `message` fields.
302
315
 
303
316
  You can see how these conditions relate to the following resource:
304
317
 
@@ -331,7 +344,7 @@ status:
331
344
 
332
345
  ### Deploy walkthrough
333
346
 
334
- Let's walk through what happens when you run the `deploy` task with [this directory of templates](https://github.com/Shopify/krane/tree/master/test/fixtures/hello-cloud). This particular example uses ERB templates as well, so we'll use the [krane render](#krane-render) task to achieve that.
347
+ Let's walk through what happens when you run the `deploy` task with [this directory of templates](https://github.com/Shopify/krane/tree/main/test/fixtures/hello-cloud). This particular example uses ERB templates as well, so we'll use the [krane render](#krane-render) task to achieve that.
335
348
 
336
349
  You can test this out for yourself by running the following command:
337
350
 
@@ -398,7 +411,7 @@ In this phase, we:
398
411
 
399
412
  Just like in the previous phase, we essentially run `kubectl apply` on those templates and periodically check the cluster for the current status of each resource so we can display error or success information.
400
413
 
401
- If pruning is enabled (which, again, is the default), any [kind not listed in the blacklist](https://github.com/Shopify/krane/blob/master/lib/krane/cluster_resource_discovery.rb#L20) that we can find in the namespace but not in the templates will be removed. A particular message about pruning will be printed in the next phase if any resource matches this criteria.
414
+ If pruning is enabled (which, again, is the default), any [kind not listed in the blacklist](https://github.com/Shopify/krane/blob/main/lib/krane/cluster_resource_discovery.rb#L20) that we can find in the namespace but not in the templates will be removed. A particular message about pruning will be printed in the next phase if any resource matches this criteria.
402
415
 
403
416
  #### Result
404
417
 
@@ -497,7 +510,7 @@ resource to restart.
497
510
 
498
511
  ## Prerequisites
499
512
 
500
- * You've already deployed a [`PodTemplate`](https://v1-15.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#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`.
513
+ * You've already deployed a [`PodTemplate`](https://v1-22.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#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`.
501
514
  * The `Pod` specification in that template has a container named `task-runner`.
502
515
 
503
516
  Based on this specification `krane run` will create a new pod with the entrypoint of the `task-runner ` container overridden with the supplied arguments.
@@ -587,7 +600,7 @@ Inside a partial, parameters can be accessed as normal variables, or via a hash
587
600
 
588
601
  ```yaml
589
602
  ---
590
- apiVersion: batch/v1beta1
603
+ apiVersion: batch/v1
591
604
  kind: CronJob
592
605
  metadata:
593
606
  name: cron-<%= name %>
@@ -648,13 +661,13 @@ This is a limitation of the current implementation.
648
661
  # Contributing
649
662
 
650
663
  We :heart: contributors! To make it easier for you and us we've written a
651
- [Contributing Guide](https://github.com/Shopify/krane/blob/master/CONTRIBUTING.md)
664
+ [Contributing Guide](https://github.com/Shopify/krane/blob/main/CONTRIBUTING.md)
652
665
 
653
666
 
654
667
  You can also reach out to us on our slack channel, #krane, at https://kubernetes.slack.com. All are welcome!
655
668
 
656
669
  ## Code of Conduct
657
- Everyone is expected to follow our [Code of Conduct](https://github.com/Shopify/krane/blob/master/CODE_OF_CONDUCT.md).
670
+ Everyone is expected to follow our [Code of Conduct](https://github.com/Shopify/krane/blob/main/CODE_OF_CONDUCT.md).
658
671
 
659
672
 
660
673
  # License
data/bin/ci CHANGED
@@ -16,5 +16,5 @@ docker run --rm \
16
16
  -e VERBOSE=1 \
17
17
  -e PARALLELISM=$PARALLELISM \
18
18
  -w /usr/src/app \
19
- ruby:"${RUBY_VERSION:-2.6.6}" \
19
+ ruby:"${RUBY_VERSION:-2.7.6}" \
20
20
  bin/test
data/bin/setup CHANGED
@@ -9,8 +9,8 @@ if [ ! -x "$(which minikube)" ]; then
9
9
  fi
10
10
 
11
11
  if [ ! -x "$(which kubectl)" ]; then
12
- echo -e "\n\033[0;33mPlease install kubectl version 1.15.0 or higher:\nhttps://kubernetes.io/docs/user-guide/prereqs/\033[0m"
12
+ echo -e "\n\033[0;33mPlease install kubectl version 1.22.0 or higher:\nhttps://kubernetes.io/docs/user-guide/prereqs/\033[0m"
13
13
  else
14
14
  KUBECTL_VERSION=$(kubectl version --short --client | grep -oe "v[[:digit:]\.]\+")
15
- echo -e "\n\033[0;32mKubectl version $KUBECTL_VERSION is already installed. This gem requires version v1.15.0 or greater.\033[0m"
15
+ echo -e "\n\033[0;32mKubectl version $KUBECTL_VERSION is already installed. This gem requires version v1.22.0 or greater.\033[0m"
16
16
  fi
data/bin/test CHANGED
@@ -23,7 +23,7 @@ if [[ ${PARALLELISM:=0} -lt 1 ]]; then
23
23
  if [[ $num_cpus -le 2 ]]; then
24
24
  PARALLELISM=1
25
25
  else
26
- (( PARALLELISM=num_cpus/2 ))
26
+ (( PARALLELISM=num_cpus ))
27
27
  fi
28
28
  fi
29
29
 
@@ -33,16 +33,23 @@ if [[ "${CI:-0}" != "0" ]]; then
33
33
  PARALLELISM=2
34
34
  fi
35
35
 
36
- print_header "Run CLI Tests"
37
- bundle exec rake cli_test
36
+ test_type=$1
38
37
 
39
- print_header "Run Unit Tests"
40
- bundle exec rake unit_test
41
38
 
42
- print_header "Run Non-Parallel Integration Tests"
43
- bundle exec rake serial_integration_test
39
+ case $test_type in
40
+ cli_test | unit_test | serial_integration_test)
41
+ print_header $test_type
42
+ bundle exec rake $test_type
43
+ ;;
44
44
 
45
- print_header "Run Parallel Integration Tests (MT_CPU=$PARALLELISM)"
46
- PARALLELIZE_ME=1 MT_CPU=$PARALLELISM bundle exec rake integration_test
45
+ integration_test)
46
+ print_header "Run Parallel Integration Tests (MT_CPU=$PARALLELISM)"
47
+ PARALLELIZE_ME=1 MT_CPU=$PARALLELISM bundle exec rake integration_test
48
+ ;;
49
+
50
+ *)
51
+ echo "Argument must be one of: unit_test, cli_test, serial_integration_test, integration_test"
52
+ ;;
53
+ esac
47
54
 
48
55
  test $err -eq 0
data/dev.yml CHANGED
@@ -1,24 +1,23 @@
1
1
  ---
2
2
  name: krane
3
3
  up:
4
- - ruby: '3.0.3' # Matches gemspec
4
+ - ruby
5
5
  - bundler
6
- - custom:
7
- name: Install Kubernetes in Docker (KinD)
8
- met?: bin/kind version 2>&1 | grep -q v0.11.1
9
- meet: |
10
- mkdir -p bin
11
- curl -sLo bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-darwin-amd64"
12
- chmod +x bin/kind
13
- - custom:
14
- name: Create KinD Cluster
15
- met?: bin/kind get clusters | grep -q krane
16
- meet: bin/kind create cluster --name krane --image "kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047"
17
- down: |
18
- ((bin/kind get clusters | grep -q krane) && bin/kind delete cluster --name krane) || true
6
+ - podman
7
+ - kind:
8
+ name: krane
9
+ image: kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213
19
10
  commands:
20
11
  test:
21
- run: bin/test
12
+ run: bin/test unit_test && bin/test cli_test && bin/test serial_integration_test && bin/test integration_test
13
+ test-unit:
14
+ run: bin/test unit_test
15
+ test-cli:
16
+ run: bin/test cli_test
17
+ test-serial_integration:
18
+ run: bin/test serial_integration_test,
19
+ test-integration:
20
+ run: bin/test integration_test
22
21
  tophat:
23
22
  run: PRINT_LOGS=1 bundle exec ruby -I test test/integration/krane_deploy_test.rb -n/${1}/
24
23
  desc: Tophat a change by running a test scenario with logging output enabled.