-
Notifications
You must be signed in to change notification settings - Fork 116
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
Global deploy 2 #602
Global deploy 2 #602
Conversation
fb31d05
to
e357af0
Compare
e357af0
to
175b1f9
Compare
include Krane::TemplateReporting | ||
|
||
delegate :logger, to: :@task_config | ||
attr_reader :statsd_tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed by KubernetesDeploy::StatsD::MeasureMethods
93b0379
to
25510ba
Compare
25510ba
to
118b289
Compare
@@ -317,7 +317,7 @@ def debug_message(cause = nil, info_hash = {}) | |||
def fetch_events(kubectl) | |||
return {} unless exists? | |||
out, _err, st = kubectl.run("get", "events", "--output=go-template=#{Event.go_template_for(type, name)}", | |||
log_failure: false) | |||
log_failure: false, use_namespace: !global?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kubectl api-resouces
indicates that events are NAMESPACED
. Running kubectl get events
returns events about Nodes
which are also global, so I believe this is the correct behavior.
90bced6
to
ea2a014
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had a look at the tests yet, but I like where this is going 👌
@@ -40,7 +40,7 @@ class KubernetesResource | |||
SERVER_DRY_RUNNABLE = false | |||
|
|||
class << self | |||
def build(namespace:, context:, definition:, logger:, statsd_tags:, crd: nil, global_names: []) | |||
def build(namespace: nil, context:, definition:, logger:, statsd_tags:, crd: nil, global_names: []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we put the ClusterResourceDisovery stuff in the TaskConfig, this could have a much smaller signature, without namespace being oddly optional: build(task_config:, definition:, statsd_tags:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we've got a tracking issue for making build take a task_config.
end | ||
|
||
output_is_sensitive = resources.any?(&:sensitive_template_content?) | ||
global_mode = resources.all?(&:global?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the mixed-mode scenario currently possible under the old deploy task, we pass a namespace arg that is just ignored by kubectl as appropriate? I guess that's what we've always done, and it works. 🤔
1000c75
to
ae09dbc
Compare
60397c5
to
09c68db
Compare
lib/krane/global_deploy_task.rb
Outdated
|
||
def check_initial_status(resources) | ||
cache = Krane::ResourceCache.new(@task_config) | ||
Krane::Concurrency.split_across_threads(resources) { |r| r.sync(cache) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to prewarm here when Ryan's PR merges.
5994edb
to
9467bc6
Compare
Pruning draft PR #612 |
cd36320
to
f57de6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions but looks pretty good.
One more note is to fix the linter error being thrown in CI |
62c4cdc
to
3cc40d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
def global_kinds | ||
@global_kinds ||= begin | ||
cluster_resource_discoverer = ClusterResourceDiscovery.new(task_config: self) | ||
cluster_resource_discoverer.global_resource_kinds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you missed the question in my last pass: this seems to be the only place this method is called. Why not move the method body here and not expose it on two different classses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes a in the pruning PR. I'd like to defer this question till that PR.
d00a570
to
4717631
Compare
Use resource_deployer for normal deploys Add a common module Add tests
4717631
to
7b616f1
Compare
7b616f1
to
fa17169
Compare
template_paths = filenames.map { |path| File.expand_path(path) } | ||
|
||
@task_config = TaskConfig.new(context, nil) | ||
@task_config = TaskConfig.new(context, nil, logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's default this like the old task does, so they don't have to pass one in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this one last thing, then 🚢
%r{Deploying StorageClass\/testing-storage-class[\w-]+ \(timeout: 300s\)}, | ||
"Don't know how to monitor resources of type StorageClass.", | ||
%r{Assuming StorageClass\/testing-storage-class[\w-]+ deployed successfully.}, | ||
%r{Successfully deployed in 0.[\d]+s: StorageClass\/testing-storage-class}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this needs to be relaxed:
Successfully deployed in 0.[\d]+s: StorageClass/testing-storage-class)' not found in the following logs:
Because it took more than a second for whatever reason
%r{Deploying StorageClass\/testing-storage-class[\w-]+ \(timeout: 300s\)}, | ||
"Don't know how to monitor resources of type StorageClass.", | ||
%r{Assuming StorageClass\/testing-storage-class[\w-]+ deployed successfully.}, | ||
%r{Successfully deployed in 0.[\d]+s: StorageClass\/testing-storage-class}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here I imagine
What are you trying to accomplish with this PR?
Second attempt to build a global deploy task.
How is this accomplished?
Three major differences from #574.
The global_deploy_task.rb doesn't inherit from deploy_task.rb.
I created a concern(module) for the code that should be shared. There is still duplicate code, but what's duplicated is either commonly duplicated in the codebase (kubectl) or small snippets that might look different in the future without causing harm to the other task.
New class introduced: ResourceDeployer.
ToDo
What could go wrong?
This doesn't support pruning, that will come in a follow-up PR.
Something subtle and untested breaks (or changes) behavior in deploy_test.rb due to it being in the new concern or class.