rebase: update Kubernetes packages to v0.31.3

Some packages were updated to more recent versions, others were not. Now
everything is at the latest v0.31.3.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2024-11-27 10:48:30 +01:00
committed by mergify[bot]
parent beaafdebb6
commit 7731a913e9
7 changed files with 132 additions and 113 deletions

View File

@ -1170,7 +1170,7 @@ func AuthorizeClientBearerToken(loopback *restclient.Config, authn *Authenticati
tokens[privilegedLoopbackToken] = &user.DefaultInfo{
Name: user.APIServerUser,
UID: uid,
Groups: []string{user.SystemPrivilegedGroup},
Groups: []string{user.AllAuthenticated, user.SystemPrivilegedGroup},
}
tokenAuthenticator := authenticatorfactory.NewFromTokens(tokens, authn.APIAudiences)

View File

@ -23,7 +23,9 @@ import (
"net"
"github.com/spf13/pflag"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/metric/noop"
"go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/semconv/v1.12.0"
"google.golang.org/grpc"
@ -48,6 +50,12 @@ var (
codecs = serializer.NewCodecFactory(cfgScheme)
)
func init() {
// Prevent memory leak from OTel metrics, which we don't use:
// https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5190
otel.SetMeterProvider(noop.NewMeterProvider())
}
func init() {
install.Install(cfgScheme)
}

View File

@ -130,13 +130,24 @@ func emulatedStorageVersion(binaryVersionOfResource schema.GroupVersion, example
gvks, _, err := scheme.ObjectKinds(example)
if err != nil {
return schema.GroupVersion{}, err
} else if len(gvks) == 0 {
// Probably shouldn't happen if err is non-nil
}
var gvk schema.GroupVersionKind
for _, item := range gvks {
if item.Group != binaryVersionOfResource.Group {
continue
}
gvk = item
break
}
if len(gvk.Kind) == 0 {
return schema.GroupVersion{}, fmt.Errorf("object %T has no GVKs registered in scheme", example)
}
// VersionsForGroupKind returns versions in priority order
versions := scheme.VersionsForGroupKind(schema.GroupKind{Group: gvks[0].Group, Kind: gvks[0].Kind})
versions := scheme.VersionsForGroupKind(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind})
compatibilityVersion := effectiveVersion.MinCompatibilityVersion()
@ -148,7 +159,7 @@ func emulatedStorageVersion(binaryVersionOfResource schema.GroupVersion, example
gvk := schema.GroupVersionKind{
Group: gv.Group,
Version: gv.Version,
Kind: gvks[0].Kind,
Kind: gvk.Kind,
}
exampleOfGVK, err := scheme.New(gvk)

View File

@ -245,7 +245,7 @@ func (s *DefaultStorageFactory) NewConfig(groupResource schema.GroupResource, ex
var err error
if backwardCompatibleInterface, ok := s.ResourceEncodingConfig.(CompatibilityResourceEncodingConfig); ok {
codecConfig.StorageVersion, err = backwardCompatibleInterface.BackwardCompatibileStorageEncodingFor(groupResource, example)
codecConfig.StorageVersion, err = backwardCompatibleInterface.BackwardCompatibileStorageEncodingFor(chosenStorageResource, example)
if err != nil {
return nil, err
}