Skip to content

Commit

Permalink
Remove kubernetes-deploy* (#622)
Browse files Browse the repository at this point in the history
* Remove kubernetes-deploy*
* Rename class
* Remove template_dir and only_filenames from RenderTask
* Remove template_dir from DeployTask
* Remove allow_globals from DeployTask
* Move unsafe parallel tests to the serial suite
* Remove duplicated resources from pruning whitelis
  • Loading branch information
dirceu authored and dturn committed Nov 18, 2019
1 parent c354f11 commit d1bcacb
Show file tree
Hide file tree
Showing 36 changed files with 614 additions and 1,160 deletions.
9 changes: 8 additions & 1 deletion 1.0-Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ custom resources. See [blacklist](https://github.com/Shopify/kubernetes-deploy/b

## Public API changes

The only breaking change in the public API (so far) is the renaming of the `KubernetesDeploy` namespace to `Krane`. Otherwise, the APIs of the major public classes (`DeployTask`, `RenderTask`, `RunnerTask`, and `RestartTask`) have not changed between 0.31.1 and 1.0.0. If you're curious about this API, check the comment-based docs on these classes or the [rendered documentation at RubyGems.org](https://www.rubydoc.info/gems/kubernetes-deploy/1.0.0/KubernetesDeploy/DeployTask).
Important changes:
- Removed `KubernetesDeploy#*`: use the appropriate `Krane::*` class instead.
- Removed `template_dir` from `DeployTask#initialize`: use `template_paths` instead.
- Removed `allow_protected_ns` from `DeployTask#run`: use `protected_namespaces` instead.
- Removed `template_dir` from `RenderTask#initialize` and `only_filenames` from `RenderTask#run`: use `template_paths` instead.
- Removed `allow_globals` from `DeployTask`: use `GlobalDeployTask` instead.

If you want to see the current state of this API, check the comment-based docs on these classes or the [rendered documentation at RubyGems.org](https://www.rubydoc.info/gems/kubernetes-deploy/1.0.0/KubernetesDeploy/DeployTask).

## Command-line interface changes

Expand Down
99 changes: 0 additions & 99 deletions exe/kubernetes-deploy

This file was deleted.

43 changes: 0 additions & 43 deletions exe/kubernetes-render

This file was deleted.

33 changes: 0 additions & 33 deletions exe/kubernetes-restart

This file was deleted.

42 changes: 0 additions & 42 deletions exe/kubernetes-run

This file was deleted.

4 changes: 1 addition & 3 deletions lib/krane/cli/deploy_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def self.from_options(namespace, context, options)
raise Thor::RequiredArgumentMissingError, 'At least one of --filenames or --stdin must be set'
end

::Krane::OptionsHelper.with_processed_template_paths(filenames,
require_explicit_path: true) do |paths|
::Krane::OptionsHelper.with_processed_template_paths(filenames) do |paths|
deploy = ::Krane::DeployTask.new(
namespace: namespace,
context: context,
Expand All @@ -79,7 +78,6 @@ def self.from_options(namespace, context, options)

deploy.run!(
verify_result: options["verify-result"],
allow_protected_ns: !protected_namespaces.empty?,
prune: options[:prune]
)
end
Expand Down
3 changes: 1 addition & 2 deletions lib/krane/cli/global_deploy_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def self.from_options(context, options)
raise Thor::RequiredArgumentMissingError, 'At least one of --filenames or --stdin must be set'
end

::Krane::OptionsHelper.with_processed_template_paths(filenames,
require_explicit_path: true) do |paths|
::Krane::OptionsHelper.with_processed_template_paths(filenames) do |paths|
deploy = ::Krane::GlobalDeployTask.new(
context: context,
filenames: paths,
Expand Down
2 changes: 1 addition & 1 deletion lib/krane/cluster_resource_discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def prunable_resources(namespaced:)
black_list = %w(Namespace Node ControllerRevision)
api_versions = fetch_api_versions

fetch_resources(namespaced: namespaced).map do |resource|
fetch_resources(namespaced: namespaced).uniq { |r| r['kind'] }.map do |resource|
next unless resource['verbs'].one? { |v| v == "delete" }
next if black_list.include?(resource['kind'])
group_versions = api_versions[resource['apigroup'].to_s]
Expand Down
Loading

0 comments on commit d1bcacb

Please sign in to comment.