Add fixes for label selector and skipping things that don't match

This commit is contained in:
Asim Aslam
2019-11-26 22:28:08 +00:00
parent 3f3fd38601
commit 811275be26
3 changed files with 20 additions and 6 deletions

View File

@@ -119,7 +119,14 @@ func (r *Request) Body(in interface{}) *Request {
// Params isused to set paramters on a request
func (r *Request) Params(p *Params) *Request {
for k, v := range p.LabelSelector {
r.params.Add("labelSelector", k+"="+v)
// create new key=value pair
value := fmt.Sprintf("%s=%s", k, v)
// check if there's an existing value
if label := r.params.Get("labelSelector"); len(label) > 0 {
value = fmt.Sprintf("%s,%s", label, value)
}
// set and overwrite the value
r.params.Set("labelSelector", value)
}
return r