1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

used crdKind var in watch/list

This commit is contained in:
Antoine Legrand 2017-11-17 13:16:29 +01:00
parent 571a6cd9b3
commit 690db90fba
3 changed files with 21 additions and 15 deletions

View file

@ -51,13 +51,14 @@ type AlertmanagerInterface interface {
type alertmanagers struct {
restClient rest.Interface
client *dynamic.ResourceClient
crdKind CrdKind
ns string
}
func newAlertmanagers(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *alertmanagers {
return &alertmanagers{
r,
c.Resource(
restClient: r,
client: c.Resource(
&metav1.APIResource{
Kind: crdKind.Kind,
Name: crdKind.Plural,
@ -65,7 +66,8 @@ func newAlertmanagers(r rest.Interface, c *dynamic.Client, crdKind CrdKind, name
},
namespace,
),
namespace,
crdKind: crdKind,
ns: namespace,
}
}
@ -118,7 +120,7 @@ func (a *alertmanagers) Delete(name string, options *metav1.DeleteOptions) error
func (a *alertmanagers) List(opts metav1.ListOptions) (runtime.Object, error) {
req := a.restClient.Get().
Namespace(a.ns).
Resource("alertmanagers").
Resource(a.crdKind.Plural).
// VersionedParams(&options, api.ParameterCodec)
FieldsSelectorParam(nil)
@ -134,7 +136,7 @@ func (a *alertmanagers) Watch(opts metav1.ListOptions) (watch.Interface, error)
r, err := a.restClient.Get().
Prefix("watch").
Namespace(a.ns).
Resource("alertmanagers").
Resource(a.crdKind.Plural).
// VersionedParams(&options, api.ParameterCodec).
FieldsSelectorParam(nil).
Stream()

View file

@ -51,13 +51,14 @@ type PrometheusInterface interface {
type prometheuses struct {
restClient rest.Interface
client *dynamic.ResourceClient
crdKind CrdKind
ns string
}
func newPrometheuses(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *prometheuses {
return &prometheuses{
r,
c.Resource(
restClient: r,
client: c.Resource(
&metav1.APIResource{
Kind: crdKind.Kind,
Name: crdKind.Plural,
@ -65,7 +66,8 @@ func newPrometheuses(r rest.Interface, c *dynamic.Client, crdKind CrdKind, names
},
namespace,
),
namespace,
crdKind: crdKind,
ns: namespace,
}
}
@ -118,7 +120,7 @@ func (p *prometheuses) Delete(name string, options *metav1.DeleteOptions) error
func (p *prometheuses) List(opts metav1.ListOptions) (runtime.Object, error) {
req := p.restClient.Get().
Namespace(p.ns).
Resource("prometheuses").
Resource(p.crdKind.Plural).
// VersionedParams(&options, v1.ParameterCodec)
FieldsSelectorParam(nil)
@ -134,7 +136,7 @@ func (p *prometheuses) Watch(opts metav1.ListOptions) (watch.Interface, error) {
r, err := p.restClient.Get().
Prefix("watch").
Namespace(p.ns).
Resource("prometheuses").
Resource(p.crdKind.Plural).
// VersionedParams(&options, v1.ParameterCodec).
FieldsSelectorParam(nil).
Stream()

View file

@ -51,13 +51,14 @@ type ServiceMonitorInterface interface {
type servicemonitors struct {
restClient rest.Interface
client *dynamic.ResourceClient
crdKind CrdKind
ns string
}
func newServiceMonitors(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *servicemonitors {
return &servicemonitors{
r,
c.Resource(
restClient: r,
client: c.Resource(
&metav1.APIResource{
Kind: crdKind.Kind,
Name: crdKind.Plural,
@ -65,7 +66,8 @@ func newServiceMonitors(r rest.Interface, c *dynamic.Client, crdKind CrdKind, na
},
namespace,
),
namespace,
crdKind: crdKind,
ns: namespace,
}
}
@ -118,7 +120,7 @@ func (s *servicemonitors) Delete(name string, options *metav1.DeleteOptions) err
func (s *servicemonitors) List(opts metav1.ListOptions) (runtime.Object, error) {
req := s.restClient.Get().
Namespace(s.ns).
Resource("servicemonitors").
Resource(s.crdKind.Plural).
// VersionedParams(&options, v1.ParameterCodec)
FieldsSelectorParam(nil)
@ -134,7 +136,7 @@ func (s *servicemonitors) Watch(opts metav1.ListOptions) (watch.Interface, error
r, err := s.restClient.Get().
Prefix("watch").
Namespace(s.ns).
Resource("servicemonitors").
Resource(s.crdKind.Plural).
// VersionedParams(&options, v1.ParameterCodec).
FieldsSelectorParam(nil).
Stream()