Use dynamic client for labels#782
Merged
r2d4 merged 6 commits intoGoogleContainerTools:masterfrom Jul 9, 2018
Merged
Conversation
jonjohnsonjr
reviewed
Jul 1, 2018
pkg/skaffold/deploy/labels.go
Outdated
| return errors.Wrapf(err, "patching resource %s/%s", namespace, name) | ||
| } | ||
|
|
||
| return err |
dgageot
reviewed
Jul 1, 2018
pkg/skaffold/deploy/labels.go
Outdated
| if m.Labels == nil { | ||
| m.Labels = map[string]string{} | ||
| func addLabels(labels map[string]string, accessor metav1.Object) { | ||
| for k, v := range constants.Labels.DefaultLabels { |
Contributor
There was a problem hiding this comment.
Shouldn't we apply DefaultLabels to objLabels first and then apply labels?
Closed
Contributor
Author
|
@nkubala PTAL |
nkubala
reviewed
Jul 9, 2018
pkg/skaffold/deploy/labels.go
Outdated
| client, err := kubernetes.Client() | ||
| dynClient, err := kubernetes.DynamicClient() | ||
| if err != nil { | ||
| logrus.Warnf("error retrieving kubernetes client: %s", err.Error()) |
| break // we should only ever apply one patch, so stop here | ||
|
|
||
| for _, r := range resources.APIResources { | ||
| if r.Kind == gvk.Kind { |
Contributor
There was a problem hiding this comment.
when I hacked on this I had trouble converting the kind string into something that could be treated as a resource, mostly with capitalization (i.e. pod needs to be converted to Pod, etc.). not sure if this is something you ran into here, but might be worth addressing
Contributor
Author
There was a problem hiding this comment.
Hm, I didn't have trouble with that. The only thing that seemed a little odd was that the dynamic client needed a non-empty namespace and parsing the kubeconfig uses "" instead of "default"
nkubala
approved these changes
Jul 9, 2018
Contributor
nkubala
left a comment
There was a problem hiding this comment.
LGTM assuming tests pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #708