K8s: Update from v0.31.3 to v0.32.0 (#98507)

This commit is contained in:
Ryan McKinley
2025-01-06 18:20:35 +03:00
committed by GitHub
parent 085dac8206
commit 6683cdc082
57 changed files with 615 additions and 824 deletions
@@ -5,8 +5,8 @@
package versioned
import (
"fmt"
"net/http"
fmt "fmt"
http "net/http"
servicev0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/service/v0alpha1"
discovery "k8s.io/client-go/discovery"
@@ -5,10 +5,10 @@
package v0alpha1
import (
"context"
context "context"
v0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
servicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1"
servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
applyconfigurationservicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1"
scheme "github.com/grafana/grafana/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
@@ -24,32 +24,33 @@ type ExternalNamesGetter interface {
// ExternalNameInterface has methods to work with ExternalName resources.
type ExternalNameInterface interface {
Create(ctx context.Context, externalName *v0alpha1.ExternalName, opts v1.CreateOptions) (*v0alpha1.ExternalName, error)
Update(ctx context.Context, externalName *v0alpha1.ExternalName, opts v1.UpdateOptions) (*v0alpha1.ExternalName, error)
Create(ctx context.Context, externalName *servicev0alpha1.ExternalName, opts v1.CreateOptions) (*servicev0alpha1.ExternalName, error)
Update(ctx context.Context, externalName *servicev0alpha1.ExternalName, opts v1.UpdateOptions) (*servicev0alpha1.ExternalName, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v0alpha1.ExternalName, error)
List(ctx context.Context, opts v1.ListOptions) (*v0alpha1.ExternalNameList, error)
Get(ctx context.Context, name string, opts v1.GetOptions) (*servicev0alpha1.ExternalName, error)
List(ctx context.Context, opts v1.ListOptions) (*servicev0alpha1.ExternalNameList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v0alpha1.ExternalName, err error)
Apply(ctx context.Context, externalName *servicev0alpha1.ExternalNameApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.ExternalName, err error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *servicev0alpha1.ExternalName, err error)
Apply(ctx context.Context, externalName *applyconfigurationservicev0alpha1.ExternalNameApplyConfiguration, opts v1.ApplyOptions) (result *servicev0alpha1.ExternalName, err error)
ExternalNameExpansion
}
// externalNames implements ExternalNameInterface
type externalNames struct {
*gentype.ClientWithListAndApply[*v0alpha1.ExternalName, *v0alpha1.ExternalNameList, *servicev0alpha1.ExternalNameApplyConfiguration]
*gentype.ClientWithListAndApply[*servicev0alpha1.ExternalName, *servicev0alpha1.ExternalNameList, *applyconfigurationservicev0alpha1.ExternalNameApplyConfiguration]
}
// newExternalNames returns a ExternalNames
func newExternalNames(c *ServiceV0alpha1Client, namespace string) *externalNames {
return &externalNames{
gentype.NewClientWithListAndApply[*v0alpha1.ExternalName, *v0alpha1.ExternalNameList, *servicev0alpha1.ExternalNameApplyConfiguration](
gentype.NewClientWithListAndApply[*servicev0alpha1.ExternalName, *servicev0alpha1.ExternalNameList, *applyconfigurationservicev0alpha1.ExternalNameApplyConfiguration](
"externalnames",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *v0alpha1.ExternalName { return &v0alpha1.ExternalName{} },
func() *v0alpha1.ExternalNameList { return &v0alpha1.ExternalNameList{} }),
func() *servicev0alpha1.ExternalName { return &servicev0alpha1.ExternalName{} },
func() *servicev0alpha1.ExternalNameList { return &servicev0alpha1.ExternalNameList{} },
),
}
}
@@ -5,142 +5,35 @@
package fake
import (
"context"
json "encoding/json"
"fmt"
v0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
servicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
typedservicev0alpha1 "github.com/grafana/grafana/pkg/generated/clientset/versioned/typed/service/v0alpha1"
gentype "k8s.io/client-go/gentype"
)
// FakeExternalNames implements ExternalNameInterface
type FakeExternalNames struct {
// fakeExternalNames implements ExternalNameInterface
type fakeExternalNames struct {
*gentype.FakeClientWithListAndApply[*v0alpha1.ExternalName, *v0alpha1.ExternalNameList, *servicev0alpha1.ExternalNameApplyConfiguration]
Fake *FakeServiceV0alpha1
ns string
}
var externalnamesResource = v0alpha1.SchemeGroupVersion.WithResource("externalnames")
var externalnamesKind = v0alpha1.SchemeGroupVersion.WithKind("ExternalName")
// Get takes name of the externalName, and returns the corresponding externalName object, and an error if there is any.
func (c *FakeExternalNames) Get(ctx context.Context, name string, options v1.GetOptions) (result *v0alpha1.ExternalName, err error) {
emptyResult := &v0alpha1.ExternalName{}
obj, err := c.Fake.
Invokes(testing.NewGetActionWithOptions(externalnamesResource, c.ns, name, options), emptyResult)
if obj == nil {
return emptyResult, err
func newFakeExternalNames(fake *FakeServiceV0alpha1, namespace string) typedservicev0alpha1.ExternalNameInterface {
return &fakeExternalNames{
gentype.NewFakeClientWithListAndApply[*v0alpha1.ExternalName, *v0alpha1.ExternalNameList, *servicev0alpha1.ExternalNameApplyConfiguration](
fake.Fake,
namespace,
v0alpha1.SchemeGroupVersion.WithResource("externalnames"),
v0alpha1.SchemeGroupVersion.WithKind("ExternalName"),
func() *v0alpha1.ExternalName { return &v0alpha1.ExternalName{} },
func() *v0alpha1.ExternalNameList { return &v0alpha1.ExternalNameList{} },
func(dst, src *v0alpha1.ExternalNameList) { dst.ListMeta = src.ListMeta },
func(list *v0alpha1.ExternalNameList) []*v0alpha1.ExternalName {
return gentype.ToPointerSlice(list.Items)
},
func(list *v0alpha1.ExternalNameList, items []*v0alpha1.ExternalName) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
}
return obj.(*v0alpha1.ExternalName), err
}
// List takes label and field selectors, and returns the list of ExternalNames that match those selectors.
func (c *FakeExternalNames) List(ctx context.Context, opts v1.ListOptions) (result *v0alpha1.ExternalNameList, err error) {
emptyResult := &v0alpha1.ExternalNameList{}
obj, err := c.Fake.
Invokes(testing.NewListActionWithOptions(externalnamesResource, externalnamesKind, c.ns, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v0alpha1.ExternalNameList{ListMeta: obj.(*v0alpha1.ExternalNameList).ListMeta}
for _, item := range obj.(*v0alpha1.ExternalNameList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested externalNames.
func (c *FakeExternalNames) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchActionWithOptions(externalnamesResource, c.ns, opts))
}
// Create takes the representation of a externalName and creates it. Returns the server's representation of the externalName, and an error, if there is any.
func (c *FakeExternalNames) Create(ctx context.Context, externalName *v0alpha1.ExternalName, opts v1.CreateOptions) (result *v0alpha1.ExternalName, err error) {
emptyResult := &v0alpha1.ExternalName{}
obj, err := c.Fake.
Invokes(testing.NewCreateActionWithOptions(externalnamesResource, c.ns, externalName, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v0alpha1.ExternalName), err
}
// Update takes the representation of a externalName and updates it. Returns the server's representation of the externalName, and an error, if there is any.
func (c *FakeExternalNames) Update(ctx context.Context, externalName *v0alpha1.ExternalName, opts v1.UpdateOptions) (result *v0alpha1.ExternalName, err error) {
emptyResult := &v0alpha1.ExternalName{}
obj, err := c.Fake.
Invokes(testing.NewUpdateActionWithOptions(externalnamesResource, c.ns, externalName, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v0alpha1.ExternalName), err
}
// Delete takes name of the externalName and deletes it. Returns an error if one occurs.
func (c *FakeExternalNames) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(externalnamesResource, c.ns, name, opts), &v0alpha1.ExternalName{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeExternalNames) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionActionWithOptions(externalnamesResource, c.ns, opts, listOpts)
_, err := c.Fake.Invokes(action, &v0alpha1.ExternalNameList{})
return err
}
// Patch applies the patch and returns the patched externalName.
func (c *FakeExternalNames) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v0alpha1.ExternalName, err error) {
emptyResult := &v0alpha1.ExternalName{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(externalnamesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v0alpha1.ExternalName), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied externalName.
func (c *FakeExternalNames) Apply(ctx context.Context, externalName *servicev0alpha1.ExternalNameApplyConfiguration, opts v1.ApplyOptions) (result *v0alpha1.ExternalName, err error) {
if externalName == nil {
return nil, fmt.Errorf("externalName provided to Apply must not be nil")
}
data, err := json.Marshal(externalName)
if err != nil {
return nil, err
}
name := externalName.Name
if name == nil {
return nil, fmt.Errorf("externalName.Name must be provided to Apply")
}
emptyResult := &v0alpha1.ExternalName{}
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceActionWithOptions(externalnamesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v0alpha1.ExternalName), err
}
@@ -15,7 +15,7 @@ type FakeServiceV0alpha1 struct {
}
func (c *FakeServiceV0alpha1) ExternalNames(namespace string) v0alpha1.ExternalNameInterface {
return &FakeExternalNames{c, namespace}
return newFakeExternalNames(c, namespace)
}
// RESTClient returns a RESTClient that is used to communicate
@@ -5,10 +5,10 @@
package v0alpha1
import (
"net/http"
http "net/http"
v0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
"github.com/grafana/grafana/pkg/generated/clientset/versioned/scheme"
servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
scheme "github.com/grafana/grafana/pkg/generated/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
@@ -71,10 +71,10 @@ func New(c rest.Interface) *ServiceV0alpha1Client {
}
func setConfigDefaults(config *rest.Config) error {
gv := v0alpha1.SchemeGroupVersion
gv := servicev0alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()