mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2024-12-22 11:06:04 +00:00
Update to Kubernetes v1.31.3
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
This commit is contained in:
parent
9ff49a9b5f
commit
ffe65bf915
92
go.mod
92
go.mod
@ -6,8 +6,8 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/config v1.28.0
|
||||
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2
|
||||
github.com/influxdata/influxdb-client-go v1.4.0
|
||||
github.com/prometheus/client_golang v1.19.0
|
||||
github.com/prometheus/common v0.52.3
|
||||
github.com/prometheus/client_golang v1.19.1
|
||||
github.com/prometheus/common v0.55.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spyzhov/ajson v0.9.5
|
||||
@ -17,17 +17,17 @@ require (
|
||||
golang.org/x/net v0.30.0
|
||||
golang.org/x/oauth2 v0.23.0
|
||||
golang.org/x/sync v0.8.0
|
||||
k8s.io/api v0.30.6
|
||||
k8s.io/apimachinery v0.30.6
|
||||
k8s.io/apiserver v0.30.6
|
||||
k8s.io/client-go v0.30.6
|
||||
k8s.io/code-generator v0.30.6
|
||||
k8s.io/component-base v0.30.6
|
||||
k8s.io/api v0.31.3
|
||||
k8s.io/apimachinery v0.31.3
|
||||
k8s.io/apiserver v0.31.3
|
||||
k8s.io/client-go v0.31.3
|
||||
k8s.io/code-generator v0.31.3
|
||||
k8s.io/component-base v0.31.3
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b
|
||||
k8s.io/metrics v0.30.6
|
||||
k8s.io/metrics v0.31.3
|
||||
sigs.k8s.io/controller-tools v0.15.0
|
||||
sigs.k8s.io/custom-metrics-apiserver v1.30.0
|
||||
sigs.k8s.io/custom-metrics-apiserver v1.30.1-0.20241105195130-84dc8cfe2555
|
||||
)
|
||||
|
||||
require (
|
||||
@ -38,7 +38,7 @@ require (
|
||||
github.com/NYTimes/gziphandler v1.1.1 // indirect
|
||||
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect
|
||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
|
||||
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect
|
||||
@ -57,7 +57,7 @@ require (
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
github.com/bytedance/sonic v1.11.9 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
@ -66,12 +66,12 @@ require (
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deepmap/oapi-codegen v1.16.3 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
|
||||
github.com/fatih/color v1.16.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/flosch/pongo2/v4 v4.0.2 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/gin-gonic/gin v1.10.0 // indirect
|
||||
@ -91,14 +91,14 @@ require (
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2 // indirect
|
||||
github.com/google/cel-go v0.17.8 // indirect
|
||||
github.com/google/cel-go v0.20.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/css v1.0.1 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
|
||||
@ -120,7 +120,6 @@ require (
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
@ -129,7 +128,7 @@ require (
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/procfs v0.13.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
@ -142,20 +141,20 @@ require (
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/yosssi/ace v0.0.5 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
|
||||
go.etcd.io/etcd/client/v2 v2.305.12 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
|
||||
go.opentelemetry.io/otel v1.25.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.25.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.25.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.14 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.14 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
@ -168,10 +167,11 @@ require (
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.22.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
|
||||
google.golang.org/grpc v1.62.1 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
|
||||
google.golang.org/grpc v1.65.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
@ -180,30 +180,12 @@ require (
|
||||
k8s.io/apiextensions-apiserver v0.30.0 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kms v0.30.6 // indirect
|
||||
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect
|
||||
k8s.io/kms v0.31.3 // indirect
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace (
|
||||
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.16.0
|
||||
github.com/prometheus/common => github.com/prometheus/common v0.44.0
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful => go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful v0.42.0
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0
|
||||
go.opentelemetry.io/otel => go.opentelemetry.io/otel v1.19.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace => go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
|
||||
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v1.19.0
|
||||
|
||||
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v1.19.0
|
||||
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.19.0
|
||||
|
||||
)
|
||||
|
||||
go 1.22.1
|
||||
|
||||
toolchain go1.22.4
|
||||
go 1.23
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,8 +31,12 @@ import (
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
//
|
||||
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
|
||||
// via --with-applyconfig).
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
|
@ -20,14 +20,13 @@ package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// ClusterScalingSchedulesGetter has a method to return a ClusterScalingScheduleInterface.
|
||||
@ -40,6 +39,7 @@ type ClusterScalingSchedulesGetter interface {
|
||||
type ClusterScalingScheduleInterface interface {
|
||||
Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
@ -52,133 +52,18 @@ type ClusterScalingScheduleInterface interface {
|
||||
|
||||
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type clusterScalingSchedules struct {
|
||||
client rest.Interface
|
||||
*gentype.ClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList]
|
||||
}
|
||||
|
||||
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
||||
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
||||
return &clusterScalingSchedules{
|
||||
client: c.RESTClient(),
|
||||
gentype.NewClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList](
|
||||
"clusterscalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *v1.ClusterScalingSchedule { return &v1.ClusterScalingSchedule{} },
|
||||
func() *v1.ClusterScalingScheduleList { return &v1.ClusterScalingScheduleList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterScalingSchedule, and returns the corresponding clusterScalingSchedule object, and an error if there is any.
|
||||
func (c *clusterScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Get().
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterScalingSchedules that match those selectors.
|
||||
func (c *clusterScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterScalingScheduleList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ClusterScalingScheduleList{}
|
||||
err = c.client.Get().
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterScalingSchedules.
|
||||
func (c *clusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterScalingSchedule and creates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *clusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Post().
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterScalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterScalingSchedule and updates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *clusterScalingSchedules) Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Put().
|
||||
Resource("clusterscalingschedules").
|
||||
Name(clusterScalingSchedule.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterScalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *clusterScalingSchedules) UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Put().
|
||||
Resource("clusterscalingschedules").
|
||||
Name(clusterScalingSchedule.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterScalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterScalingSchedule and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterScalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterScalingSchedule.
|
||||
func (c *clusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
@ -40,20 +40,22 @@ var clusterscalingschedulesKind = v1.SchemeGroupVersion.WithKind("ClusterScaling
|
||||
|
||||
// Get takes name of the clusterScalingSchedule, and returns the corresponding clusterScalingSchedule object, and an error if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clusterscalingschedulesResource, name), &v1.ClusterScalingSchedule{})
|
||||
Invokes(testing.NewRootGetActionWithOptions(clusterscalingschedulesResource, name, options), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterScalingSchedules that match those selectors.
|
||||
func (c *FakeClusterScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterScalingScheduleList, err error) {
|
||||
emptyResult := &v1.ClusterScalingScheduleList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clusterscalingschedulesResource, clusterscalingschedulesKind, opts), &v1.ClusterScalingScheduleList{})
|
||||
Invokes(testing.NewRootListActionWithOptions(clusterscalingschedulesResource, clusterscalingschedulesKind, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -72,36 +74,39 @@ func (c *FakeClusterScalingSchedules) List(ctx context.Context, opts metav1.List
|
||||
// Watch returns a watch.Interface that watches the requested clusterScalingSchedules.
|
||||
func (c *FakeClusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clusterscalingschedulesResource, opts))
|
||||
InvokesWatch(testing.NewRootWatchActionWithOptions(clusterscalingschedulesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterScalingSchedule and creates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clusterscalingschedulesResource, clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
||||
Invokes(testing.NewRootCreateActionWithOptions(clusterscalingschedulesResource, clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterScalingSchedule and updates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clusterscalingschedulesResource, clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
||||
Invokes(testing.NewRootUpdateActionWithOptions(clusterscalingschedulesResource, clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeClusterScalingSchedules) UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error) {
|
||||
func (c *FakeClusterScalingSchedules) UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(clusterscalingschedulesResource, "status", clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
||||
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clusterscalingschedulesResource, "status", clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
@ -115,7 +120,7 @@ func (c *FakeClusterScalingSchedules) Delete(ctx context.Context, name string, o
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clusterscalingschedulesResource, listOpts)
|
||||
action := testing.NewRootDeleteCollectionActionWithOptions(clusterscalingschedulesResource, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.ClusterScalingScheduleList{})
|
||||
return err
|
||||
@ -123,10 +128,11 @@ func (c *FakeClusterScalingSchedules) DeleteCollection(ctx context.Context, opts
|
||||
|
||||
// Patch applies the patch and returns the patched clusterScalingSchedule.
|
||||
func (c *FakeClusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clusterscalingschedulesResource, name, pt, data, subresources...), &v1.ClusterScalingSchedule{})
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterscalingschedulesResource, name, pt, data, opts, subresources...), emptyResult)
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
@ -41,22 +41,24 @@ var scalingschedulesKind = v1.SchemeGroupVersion.WithKind("ScalingSchedule")
|
||||
|
||||
// Get takes name of the scalingSchedule, and returns the corresponding scalingSchedule object, and an error if there is any.
|
||||
func (c *FakeScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(scalingschedulesResource, c.ns, name), &v1.ScalingSchedule{})
|
||||
Invokes(testing.NewGetActionWithOptions(scalingschedulesResource, c.ns, name, options), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ScalingSchedules that match those selectors.
|
||||
func (c *FakeScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ScalingScheduleList, err error) {
|
||||
emptyResult := &v1.ScalingScheduleList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(scalingschedulesResource, scalingschedulesKind, c.ns, opts), &v1.ScalingScheduleList{})
|
||||
Invokes(testing.NewListActionWithOptions(scalingschedulesResource, scalingschedulesKind, c.ns, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
@ -75,40 +77,43 @@ func (c *FakeScalingSchedules) List(ctx context.Context, opts metav1.ListOptions
|
||||
// Watch returns a watch.Interface that watches the requested scalingSchedules.
|
||||
func (c *FakeScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(scalingschedulesResource, c.ns, opts))
|
||||
InvokesWatch(testing.NewWatchActionWithOptions(scalingschedulesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a scalingSchedule and creates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *FakeScalingSchedules) Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(scalingschedulesResource, c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
||||
Invokes(testing.NewCreateActionWithOptions(scalingschedulesResource, c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a scalingSchedule and updates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *FakeScalingSchedules) Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(scalingschedulesResource, c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
||||
Invokes(testing.NewUpdateActionWithOptions(scalingschedulesResource, c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeScalingSchedules) UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error) {
|
||||
func (c *FakeScalingSchedules) UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(scalingschedulesResource, "status", c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(scalingschedulesResource, "status", c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
@ -123,7 +128,7 @@ func (c *FakeScalingSchedules) Delete(ctx context.Context, name string, opts met
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(scalingschedulesResource, c.ns, listOpts)
|
||||
action := testing.NewDeleteCollectionActionWithOptions(scalingschedulesResource, c.ns, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.ScalingScheduleList{})
|
||||
return err
|
||||
@ -131,11 +136,12 @@ func (c *FakeScalingSchedules) DeleteCollection(ctx context.Context, opts metav1
|
||||
|
||||
// Patch applies the patch and returns the patched scalingSchedule.
|
||||
func (c *FakeScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(scalingschedulesResource, c.ns, name, pt, data, subresources...), &v1.ScalingSchedule{})
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(scalingschedulesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
@ -20,14 +20,13 @@ package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// ScalingSchedulesGetter has a method to return a ScalingScheduleInterface.
|
||||
@ -40,6 +39,7 @@ type ScalingSchedulesGetter interface {
|
||||
type ScalingScheduleInterface interface {
|
||||
Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (*v1.ScalingSchedule, error)
|
||||
Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
@ -52,144 +52,18 @@ type ScalingScheduleInterface interface {
|
||||
|
||||
// scalingSchedules implements ScalingScheduleInterface
|
||||
type scalingSchedules struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
*gentype.ClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList]
|
||||
}
|
||||
|
||||
// newScalingSchedules returns a ScalingSchedules
|
||||
func newScalingSchedules(c *ZalandoV1Client, namespace string) *scalingSchedules {
|
||||
return &scalingSchedules{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
gentype.NewClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList](
|
||||
"scalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1.ScalingSchedule { return &v1.ScalingSchedule{} },
|
||||
func() *v1.ScalingScheduleList { return &v1.ScalingScheduleList{} }),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the scalingSchedule, and returns the corresponding scalingSchedule object, and an error if there is any.
|
||||
func (c *scalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ScalingSchedule, err error) {
|
||||
result = &v1.ScalingSchedule{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ScalingSchedules that match those selectors.
|
||||
func (c *scalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ScalingScheduleList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ScalingScheduleList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested scalingSchedules.
|
||||
func (c *scalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a scalingSchedule and creates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *scalingSchedules) Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
result = &v1.ScalingSchedule{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(scalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a scalingSchedule and updates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *scalingSchedules) Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
result = &v1.ScalingSchedule{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
Name(scalingSchedule.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(scalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *scalingSchedules) UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
result = &v1.ScalingSchedule{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
Name(scalingSchedule.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(scalingSchedule).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the scalingSchedule and deletes it. Returns an error if one occurs.
|
||||
func (c *scalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *scalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched scalingSchedule.
|
||||
func (c *scalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ScalingSchedule, err error) {
|
||||
result = &v1.ScalingSchedule{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("scalingschedules").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ type SharedInformerFactory interface {
|
||||
|
||||
// Start initializes all requested informers. They are handled in goroutines
|
||||
// which run until the stop channel gets closed.
|
||||
// Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
|
||||
Start(stopCh <-chan struct{})
|
||||
|
||||
// Shutdown marks a factory as shutting down. At that point no new
|
||||
|
@ -20,8 +20,8 @@ package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
@ -39,30 +39,10 @@ type ClusterScalingScheduleLister interface {
|
||||
|
||||
// clusterScalingScheduleLister implements the ClusterScalingScheduleLister interface.
|
||||
type clusterScalingScheduleLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v1.ClusterScalingSchedule]
|
||||
}
|
||||
|
||||
// NewClusterScalingScheduleLister returns a new ClusterScalingScheduleLister.
|
||||
func NewClusterScalingScheduleLister(indexer cache.Indexer) ClusterScalingScheduleLister {
|
||||
return &clusterScalingScheduleLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ClusterScalingSchedules in the indexer.
|
||||
func (s *clusterScalingScheduleLister) List(selector labels.Selector) (ret []*v1.ClusterScalingSchedule, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ClusterScalingSchedule))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ClusterScalingSchedule from the index for a given name.
|
||||
func (s *clusterScalingScheduleLister) Get(name string) (*v1.ClusterScalingSchedule, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("clusterscalingschedule"), name)
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), nil
|
||||
return &clusterScalingScheduleLister{listers.New[*v1.ClusterScalingSchedule](indexer, v1.Resource("clusterscalingschedule"))}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
@ -38,25 +38,17 @@ type ScalingScheduleLister interface {
|
||||
|
||||
// scalingScheduleLister implements the ScalingScheduleLister interface.
|
||||
type scalingScheduleLister struct {
|
||||
indexer cache.Indexer
|
||||
listers.ResourceIndexer[*v1.ScalingSchedule]
|
||||
}
|
||||
|
||||
// NewScalingScheduleLister returns a new ScalingScheduleLister.
|
||||
func NewScalingScheduleLister(indexer cache.Indexer) ScalingScheduleLister {
|
||||
return &scalingScheduleLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ScalingSchedules in the indexer.
|
||||
func (s *scalingScheduleLister) List(selector labels.Selector) (ret []*v1.ScalingSchedule, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ScalingSchedule))
|
||||
})
|
||||
return ret, err
|
||||
return &scalingScheduleLister{listers.New[*v1.ScalingSchedule](indexer, v1.Resource("scalingschedule"))}
|
||||
}
|
||||
|
||||
// ScalingSchedules returns an object that can list and get ScalingSchedules.
|
||||
func (s *scalingScheduleLister) ScalingSchedules(namespace string) ScalingScheduleNamespaceLister {
|
||||
return scalingScheduleNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
return scalingScheduleNamespaceLister{listers.NewNamespaced[*v1.ScalingSchedule](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// ScalingScheduleNamespaceLister helps list and get ScalingSchedules.
|
||||
@ -74,26 +66,5 @@ type ScalingScheduleNamespaceLister interface {
|
||||
// scalingScheduleNamespaceLister implements the ScalingScheduleNamespaceLister
|
||||
// interface.
|
||||
type scalingScheduleNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all ScalingSchedules in the indexer for a given namespace.
|
||||
func (s scalingScheduleNamespaceLister) List(selector labels.Selector) (ret []*v1.ScalingSchedule, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ScalingSchedule))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ScalingSchedule from the indexer for a given namespace and name.
|
||||
func (s scalingScheduleNamespaceLister) Get(name string) (*v1.ScalingSchedule, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("scalingschedule"), name)
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), nil
|
||||
listers.ResourceIndexer[*v1.ScalingSchedule]
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ func (o AdapterServerOptions) RunCustomMetricsAdapterServer(stopCh <-chan struct
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return server.GenericAPIServer.PrepareRun().Run(ctx.Done())
|
||||
return server.GenericAPIServer.PrepareRun().RunWithContext(ctx)
|
||||
}
|
||||
|
||||
// newInstrumentedOauth2HTTPClient creates an HTTP client with automatic oauth2
|
||||
|
Loading…
x
Reference in New Issue
Block a user