diff --git a/go.mod b/go.mod index 39e9d73f..95223512 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/coreos/prometheus-operator v0.33.0 github.com/knative/pkg v0.0.0-20190817231834-12ee58e32cc8 github.com/pkg/errors v0.8.1 - github.com/rancher/norman v0.0.0-20191003174345-0ac7dd6ccb36 + github.com/rancher/norman v0.0.0-20191111202053-1fcac7eb4fea github.com/sirupsen/logrus v1.4.2 golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c // indirect k8s.io/api v0.0.0 diff --git a/go.sum b/go.sum index 0245c853..7f3f979b 100644 --- a/go.sum +++ b/go.sum @@ -476,8 +476,8 @@ github.com/prometheus/tsdb v0.8.0/go.mod h1:fSI0j+IUQrDd7+ZtR9WKIGtoYAYAJUKcKhYL github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009 h1:Xsxh7fX3+2wAUJtPy8g2lZh0cYuyifqhBL0vxCIYojs= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009/go.mod h1:wpITyDPTi/Na5h73XkbuEf2AP9fbgrIGqqxVzFhYD6U= -github.com/rancher/norman v0.0.0-20191003174345-0ac7dd6ccb36 h1:N0ZUBJRq/ydy2ULiuqKhmiKShmEtpDOWXxKzVZxTzHk= -github.com/rancher/norman v0.0.0-20191003174345-0ac7dd6ccb36/go.mod h1:kVWc1OyHK9decIY90IYExSHedI5a5qze7IfLiEOTmXQ= +github.com/rancher/norman v0.0.0-20191111202053-1fcac7eb4fea h1:XMBnoi65IA7PO17j6JBnPAbJIDLf8wXho9WgDb/TXVo= +github.com/rancher/norman v0.0.0-20191111202053-1fcac7eb4fea/go.mod h1:kVWc1OyHK9decIY90IYExSHedI5a5qze7IfLiEOTmXQ= github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e h1:j6+HqCET/NLPBtew2m5apL7jWw/PStQ7iGwXjgAqdvo= github.com/rancher/pkg v0.0.0-20190514055449-b30ab9de040e/go.mod h1:XbYHTPaXuw8ZY9bylhYKQh/nJxDaTKk3YhAxPl4Qy/k= github.com/rancher/wrangler v0.1.5 h1:HiXOeP6Kci2DK+e04D1g6INT77xAYpAr54zmTTe0Spk= diff --git a/vendor/github.com/rancher/norman/generator/controller_template.go b/vendor/github.com/rancher/norman/generator/controller_template.go index 7e0fda9c..5fc32748 100644 --- a/vendor/github.com/rancher/norman/generator/controller_template.go +++ b/vendor/github.com/rancher/norman/generator/controller_template.go @@ -91,6 +91,7 @@ type {{.schema.CodeName}}Interface interface { Delete(name string, options *metav1.DeleteOptions) error DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error List(opts metav1.ListOptions) (*{{.schema.CodeName}}List, error) + ListNamespaced(namespace string, opts metav1.ListOptions) (*{{.schema.CodeName}}List, error) Watch(opts metav1.ListOptions) (watch.Interface, error) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error Controller() {{.schema.CodeName}}Controller @@ -279,6 +280,11 @@ func (s *{{.schema.ID}}Client) List(opts metav1.ListOptions) (*{{.schema.CodeNam return obj.(*{{.schema.CodeName}}List), err } +func (s *{{.schema.ID}}Client) ListNamespaced(namespace string, opts metav1.ListOptions) (*{{.schema.CodeName}}List, error) { + obj, err := s.objectClient.ListNamespaced(namespace, opts) + return obj.(*{{.schema.CodeName}}List), err +} + func (s *{{.schema.ID}}Client) Watch(opts metav1.ListOptions) (watch.Interface, error) { return s.objectClient.Watch(opts) } diff --git a/vendor/github.com/rancher/norman/objectclient/object_client.go b/vendor/github.com/rancher/norman/objectclient/object_client.go index d3c21489..2798befc 100644 --- a/vendor/github.com/rancher/norman/objectclient/object_client.go +++ b/vendor/github.com/rancher/norman/objectclient/object_client.go @@ -48,6 +48,7 @@ type GenericClient interface { DeleteNamespaced(namespace, name string, opts *metav1.DeleteOptions) error Delete(name string, opts *metav1.DeleteOptions) error List(opts metav1.ListOptions) (runtime.Object, error) + ListNamespaced(namespace string, opts metav1.ListOptions) (runtime.Object, error) Watch(opts metav1.ListOptions) (watch.Interface, error) DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error Patch(name string, o runtime.Object, patchType types.PatchType, data []byte, subresources ...string) (runtime.Object, error) @@ -228,6 +229,18 @@ func (p *ObjectClient) List(opts metav1.ListOptions) (runtime.Object, error) { Into(result) } +func (p *ObjectClient) ListNamespaced(namespace string, opts metav1.ListOptions) (runtime.Object, error) { + result := p.Factory.List() + logrus.Debugf("REST LIST %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name) + return result, p.restClient.Get(). + Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version). + NamespaceIfScoped(namespace, p.resource.Namespaced). + Resource(p.resource.Name). + VersionedParams(&opts, metav1.ParameterCodec). + Do(). + Into(result) +} + func (p *ObjectClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { restClient := p.restClient if watchClient, ok := restClient.(restwatch.WatchClient); ok { diff --git a/vendor/modules.txt b/vendor/modules.txt index 80143cac..fe7080de 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -84,7 +84,7 @@ github.com/prometheus/procfs github.com/prometheus/procfs/nfs github.com/prometheus/procfs/xfs github.com/prometheus/procfs/internal/util -# github.com/rancher/norman v0.0.0-20191003174345-0ac7dd6ccb36 +# github.com/rancher/norman v0.0.0-20191111202053-1fcac7eb4fea github.com/rancher/norman/controller github.com/rancher/norman/lifecycle github.com/rancher/norman/objectclient