Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable deploying global resources by default #567

Merged
merged 9 commits into from
Oct 8, 2019
Merged

Conversation

dturn
Copy link
Contributor

@dturn dturn commented Sep 25, 2019

What are you trying to accomplish with this PR?
As part of the 1.0 push we are going to require a new command to deploy global resources #522

This is the first step, preventing krane deploy from deploying global resources. This does maintain backwards compatibility with kubernetes-deploy.

How is this accomplished?
Fetch global resources from the cluster and warn/raise if any are part of the deploy set.

What could go wrong?
We miss global resources or this change upsets people.

@dturn dturn force-pushed the global-deploy branch 2 times, most recently from 372a56b to 3111ee0 Compare September 26, 2019 17:04
@dturn dturn requested a review from a team September 26, 2019 19:25
@dturn dturn changed the title Add a global deploy command Disable deploying global resources by default Sep 26, 2019
@dturn dturn marked this pull request as ready for review September 26, 2019 22:20
@dturn dturn changed the base branch from krane-deploy-cli to master September 27, 2019 15:36
@dturn dturn force-pushed the global-deploy branch 5 times, most recently from ffbc3cd to 27ebe38 Compare September 27, 2019 21:00
lib/kubernetes-deploy/cluster_resource_discovery.rb Outdated Show resolved Hide resolved
lib/krane/deploy_task.rb Show resolved Hide resolved
lib/kubernetes-deploy/deploy_task.rb Outdated Show resolved Hide resolved
lib/kubernetes-deploy/deploy_task.rb Outdated Show resolved Hide resolved
inst.type = definition["kind"]
type = definition["kind"]
inst = if globals.include?(type.downcase)
KubernetesDeploy::GlobalKubernetesResource.new(**opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if instead of having a new class, we make global settable, and handle it like we do type below? I think might be a bit simpler overall.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on this couldn't decide which was better. This felt more future proof, though I can't think of any special behavior we'd want from a GlobalResource., but the approach of not using a new class was definitely simpler. I'll try the other approach and see how it goes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 If we considered server resource lists part of the task's global operating context and put them into our new task config object, then we'd have a third option that might read even more straightforwardly: inside the normal superclass, we could do essentially def global?; @task_config.global_resource_kinds.include?(kind); end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense to do in #572.

test/integration/kubernetes_deploy_test.rb Show resolved Hide resolved
@@ -62,7 +62,7 @@ def deploy_raw_fixtures(set, wait: true, bindings: {}, subset: nil)

def deploy_dirs_without_profiling(dirs, wait: true, allow_protected_ns: false, prune: true, bindings: {},
sha: "k#{SecureRandom.hex(6)}", kubectl_instance: nil, max_watch_seconds: nil, selector: nil,
protected_namespaces: nil, render_erb: true)
protected_namespaces: nil, render_erb: true, allow_globals: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to change the default when we remove KubernetesDeploy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep.

lib/krane/deploy_task.rb Show resolved Hide resolved
lib/kubernetes-deploy/deploy_task.rb Show resolved Hide resolved
@dturn dturn force-pushed the global-deploy branch 3 times, most recently from 1bbc1cb to bd32085 Compare September 30, 2019 22:18
lib/kubernetes-deploy/deploy_task.rb Outdated Show resolved Hide resolved
lib/kubernetes-deploy/kubernetes_resource.rb Outdated Show resolved Hide resolved
lib/kubernetes-deploy/cluster_resource_discovery.rb Outdated Show resolved Hide resolved
lib/kubernetes-deploy/cluster_resource_discovery.rb Outdated Show resolved Hide resolved
test/unit/cluster_resource_discovery_test.rb Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants