-
Notifications
You must be signed in to change notification settings - Fork 108
Conversation
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.
Out of curiosity what query params do you need?
client.go
Outdated
} | ||
|
||
// CustomOption lets you define any filter for watch operations. | ||
func CustomOption(name, value string) Option { |
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 just QueryParam
?
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.
Works for me, let me update it
I'm using it with |
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.
Ah, so you're using this to define a FieldSelector. You may want to look at #37. FieldSelectors aren't really supported by upstream, and doesn't work for a bunch of resources, and so I've been hesitant to add them to this client.
client.go
Outdated
return o.paramName, o.paramValue | ||
} | ||
|
||
// QueryParam lets you define any filter for watch operations. |
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.
Technically this could be used to set any URL query parameter.
// QueryParam can be used to manually set a URL query parameter by name.
@ericchiang, field selectors have first class support upstream. https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/types.go#L283 |
@vjsamuel the client supports adding it to the query but the API server doesn't have full support on every resource object: kubernetes/kubernetes#1362 It generally breaks for different resources so isn't something that people should be encouraged to use. You should prefer label selectors, so that why I haven't added field selector support. |
@ericchiang, the fieldSelector params working or not working depends on if the resource being queried defines valid selectable fields in its strategy.go https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/core/pod/strategy.go#L163 FieldSelectors typically work for all such use-cases. It would be great if k8s-client could support the same. :) |
Sure, we can add them. I just want to make sure that there's adequate warning that they don't work with a bunch of resources. It'll probably look like a bug in the client otherwise. |
Agreed that it looks like a bug. But its only lack of documentation IMHO. |
@ericchiang what's the status of this? do you want me to add a warning comment? |
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.
Sorry, lgtm
This should allow anyone to add custom query params to API calls