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

Remove duplication in code handling labels #723

Merged
merged 3 commits into from Jun 23, 2018

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Jun 21, 2018

No description provided.

}

// WithLabels creates a deployer that sets labels on deployed resources.
func WithLabels(d deploy.Deployer, labels map[string]string) deploy.Deployer {
Copy link
Contributor

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?

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 used to have with* in deploy and build and @r2d4 made me move them to runner. lol.
Either way make me happy.

Copy link
Contributor

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

@@ -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))
Copy link
Contributor

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?

Copy link
Contributor Author

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

@dgageot
Copy link
Contributor Author

dgageot commented Jun 21, 2018

@nkubala I've fixed the greedy evaluation.

@dgageot dgageot force-pushed the labels branch 4 times, most recently from 39c2d88 to 1e5bd33 Compare June 22, 2018 06:06
@dlorenc
Copy link
Contributor

dlorenc commented Jun 22, 2018

cc @nkubala to take a look

Signed-off-by: David Gageot <david@gageot.net>
Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

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

thanks!

@dgageot dgageot merged commit 70df61c into GoogleContainerTools:master Jun 23, 2018
@dgageot dgageot deleted the labels branch December 28, 2018 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants