-
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
Use dynamic client for labels #782
Conversation
pkg/skaffold/deploy/labels.go
Outdated
} | ||
|
||
return err |
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.
return nil?
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.
👍
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 { |
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.
Shouldn't we apply DefaultLabels
to objLabels first and then apply 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.
fixed
@nkubala PTAL |
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()) |
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.
nit: s/kubernetes/dynamic
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.
done
break // we should only ever apply one patch, so stop here | ||
|
||
for _, r := range resources.APIResources { | ||
if r.Kind == gvk.Kind { |
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.
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
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.
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"
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.
LGTM assuming tests pass
Fixes #708