-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Remove duplication in code handling labels #723
Conversation
pkg/skaffold/runner/label/label.go
Outdated
} | ||
|
||
// WithLabels creates a deployer that sets labels on deployed resources. | ||
func WithLabels(d deploy.Deployer, labels map[string]string) deploy.Deployer { |
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.
Seems a little strange to me that this lives in the label
package, could we have deploy.WithLabels(...)
instead?
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 used to have with*
in deploy and build and @r2d4 made me move them to runner. lol.
Either way make me happy.
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.
lol. I put the labels
package under runner
because it's what was kicking off the actual labeling before, but if we're going to have the labeller embedded in the deployer itself I think we should move it out. @r2d4 WDYT
pkg/skaffold/runner/runner.go
Outdated
@@ -92,23 +72,18 @@ func NewForConfig(opts *config.SkaffoldOptions, cfg *config.SkaffoldConfig) (*Sk | |||
return nil, errors.Wrap(err, "parsing skaffold deploy config") | |||
} | |||
|
|||
deployer = label.WithLabels(deployer, labels.Merge(opts, builder, deployer, tagger)) |
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 will greedily evaluate the labels for each component, which means any labels added during the run won't get added (e.g. profiles when we add labels for those). Can we call labels.Merge()
right before we actually apply the labels?
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.
Makes sense. Let me fix that
@nkubala I've fixed the greedy evaluation. |
39c2d88
to
1e5bd33
Compare
cc @nkubala to take a look |
Signed-off-by: David Gageot <[email protected]>
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.
thanks!
No description provided.