rebase: Bump sigs.k8s.io/controller-runtime

Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.15.1-0.20230524200249-30eae58f1b98 to 0.15.1.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/commits/v0.15.1)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2023-08-14 20:06:34 +00:00 committed by mergify[bot]
parent 874d0bcf4b
commit 6ca8550ba1
8 changed files with 47 additions and 12 deletions

2
go.mod
View File

@ -44,7 +44,7 @@ require (
k8s.io/mount-utils v0.27.4 k8s.io/mount-utils v0.27.4
k8s.io/pod-security-admission v0.0.0 k8s.io/pod-security-admission v0.0.0
k8s.io/utils v0.0.0-20230209194617-a36077c30491 k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/controller-runtime v0.15.1-0.20230524200249-30eae58f1b98 sigs.k8s.io/controller-runtime v0.15.1
) )
require ( require (

4
go.sum
View File

@ -1926,8 +1926,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 h1:trsWhjU5jZrx6UvFu4WzQDrN7Pga4a7Qg+zcfcj64PA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 h1:trsWhjU5jZrx6UvFu4WzQDrN7Pga4a7Qg+zcfcj64PA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2/go.mod h1:+qG7ISXqCDVVcyO8hLn12AKVYYUjM7ftlqsqmrhMZE0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2/go.mod h1:+qG7ISXqCDVVcyO8hLn12AKVYYUjM7ftlqsqmrhMZE0=
sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I= sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I=
sigs.k8s.io/controller-runtime v0.15.1-0.20230524200249-30eae58f1b98 h1:g/rUFhTxYK9gaf9sIzuZhp8Hc0dc1mTIOAEtrAlBYgc= sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c=
sigs.k8s.io/controller-runtime v0.15.1-0.20230524200249-30eae58f1b98/go.mod h1:fnVc7My+0bTh/Y9bft09N4Fqom6WiMQMdCaayy4l/oM= sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=

2
vendor/modules.txt vendored
View File

@ -1590,7 +1590,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
# sigs.k8s.io/controller-runtime v0.15.1-0.20230524200249-30eae58f1b98 # sigs.k8s.io/controller-runtime v0.15.1
## explicit; go 1.20 ## explicit; go 1.20
sigs.k8s.io/controller-runtime/pkg/cache sigs.k8s.io/controller-runtime/pkg/cache
sigs.k8s.io/controller-runtime/pkg/cache/internal sigs.k8s.io/controller-runtime/pkg/cache/internal

View File

@ -236,6 +236,11 @@ func New(config *rest.Config, opts Options) (Cache, error) {
} }
func defaultOpts(config *rest.Config, opts Options) (Options, error) { func defaultOpts(config *rest.Config, opts Options) (Options, error) {
config = rest.CopyConfig(config)
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
logger := log.WithName("setup") logger := log.WithName("setup")
// Use the rest HTTP client for the provided config if unset // Use the rest HTTP client for the provided config if unset

View File

@ -110,6 +110,11 @@ func newClient(config *rest.Config, options Options) (*client, error) {
return nil, fmt.Errorf("must provide non-nil rest.Config to client.New") return nil, fmt.Errorf("must provide non-nil rest.Config to client.New")
} }
config = rest.CopyConfig(config)
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
if !options.WarningHandler.SuppressWarnings { if !options.WarningHandler.SuppressWarnings {
// surface warnings // surface warnings
logger := log.Log.WithName("KubeAPIWarningLogger") logger := log.Log.WithName("KubeAPIWarningLogger")
@ -117,7 +122,6 @@ func newClient(config *rest.Config, options Options) (*client, error) {
// is log.KubeAPIWarningLogger with deduplication enabled. // is log.KubeAPIWarningLogger with deduplication enabled.
// See log.KubeAPIWarningLoggerOptions for considerations // See log.KubeAPIWarningLoggerOptions for considerations
// regarding deduplication. // regarding deduplication.
config = rest.CopyConfig(config)
config.WarningHandler = log.NewKubeAPIWarningLogger( config.WarningHandler = log.NewKubeAPIWarningLogger(
logger, logger,
log.KubeAPIWarningLoggerOptions{ log.KubeAPIWarningLoggerOptions{
@ -160,7 +164,7 @@ func newClient(config *rest.Config, options Options) (*client, error) {
unstructuredResourceByType: make(map[schema.GroupVersionKind]*resourceMeta), unstructuredResourceByType: make(map[schema.GroupVersionKind]*resourceMeta),
} }
rawMetaClient, err := metadata.NewForConfigAndClient(config, options.HTTPClient) rawMetaClient, err := metadata.NewForConfigAndClient(metadata.ConfigFor(config), options.HTTPClient)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to construct metadata-only client for use as part of client: %w", err) return nil, fmt.Errorf("unable to construct metadata-only client for use as part of client: %w", err)
} }

View File

@ -513,8 +513,15 @@ type MatchingLabels map[string]string
// ApplyToList applies this configuration to the given list options. // ApplyToList applies this configuration to the given list options.
func (m MatchingLabels) ApplyToList(opts *ListOptions) { func (m MatchingLabels) ApplyToList(opts *ListOptions) {
// TODO(directxman12): can we avoid reserializing this over and over? // TODO(directxman12): can we avoid reserializing this over and over?
sel := labels.SelectorFromValidatedSet(map[string]string(m)) if opts.LabelSelector == nil {
opts.LabelSelector = sel opts.LabelSelector = labels.NewSelector()
}
// If there's already a selector, we need to AND the two together.
noValidSel := labels.SelectorFromValidatedSet(map[string]string(m))
reqs, _ := noValidSel.Requirements()
for _, req := range reqs {
opts.LabelSelector = opts.LabelSelector.Add(req)
}
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options. // ApplyToDeleteAllOf applies this configuration to the given an List options.
@ -528,14 +535,17 @@ type HasLabels []string
// ApplyToList applies this configuration to the given list options. // ApplyToList applies this configuration to the given list options.
func (m HasLabels) ApplyToList(opts *ListOptions) { func (m HasLabels) ApplyToList(opts *ListOptions) {
sel := labels.NewSelector() if opts.LabelSelector == nil {
opts.LabelSelector = labels.NewSelector()
}
// TODO: ignore invalid labels will result in an empty selector.
// This is inconsistent to the that of MatchingLabels.
for _, label := range m { for _, label := range m {
r, err := labels.NewRequirement(label, selection.Exists, nil) r, err := labels.NewRequirement(label, selection.Exists, nil)
if err == nil { if err == nil {
sel = sel.Add(*r) opts.LabelSelector = opts.LabelSelector.Add(*r)
} }
} }
opts.LabelSelector = sel
} }
// ApplyToDeleteAllOf applies this configuration to the given an List options. // ApplyToDeleteAllOf applies this configuration to the given an List options.

View File

@ -179,6 +179,13 @@ func New(config *rest.Config, opts ...Option) (Cluster, error) {
return nil, errors.New("must specify Config") return nil, errors.New("must specify Config")
} }
originalConfig := config
config = rest.CopyConfig(config)
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
options := Options{} options := Options{}
for _, opt := range opts { for _, opt := range opts {
opt(&options) opt(&options)
@ -275,7 +282,7 @@ func New(config *rest.Config, opts ...Option) (Cluster, error) {
} }
return &cluster{ return &cluster{
config: config, config: originalConfig,
httpClient: options.HTTPClient, httpClient: options.HTTPClient,
scheme: options.Scheme, scheme: options.Scheme,
cache: cache, cache: cache,

View File

@ -19,6 +19,7 @@ package manager
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"errors"
"fmt" "fmt"
"net" "net"
"net/http" "net/http"
@ -391,6 +392,9 @@ type LeaderElectionRunnable interface {
// New returns a new Manager for creating Controllers. // New returns a new Manager for creating Controllers.
func New(config *rest.Config, options Options) (Manager, error) { func New(config *rest.Config, options Options) (Manager, error) {
if config == nil {
return nil, errors.New("must specify Config")
}
// Set default values for options fields // Set default values for options fields
options = setOptionsDefaults(options) options = setOptionsDefaults(options)
@ -412,6 +416,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
return nil, err return nil, err
} }
config = rest.CopyConfig(config)
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
// Create the recorder provider to inject event recorders for the components. // Create the recorder provider to inject event recorders for the components.
// TODO(directxman12): the log for the event provider should have a context (name, tags, etc) specific // TODO(directxman12): the log for the event provider should have a context (name, tags, etc) specific
// to the particular controller that it's being injected into, rather than a generic one like is here. // to the particular controller that it's being injected into, rather than a generic one like is here.