Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Bump controller-runtime 0.13.1=>0.14.1 #7906

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ issues:
- staticcheck
text: "SA1019: in.(.+) is deprecated"
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- staticcheck
text: "SA1019: sets.String is deprecated"
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
path: .*(cmd|controllers|controlplane|internal)\/.*\.go$
- linters:
- revive
# Checking if an error is nil to just after return the error or nil is redundant
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha3/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (m *MachineSet) Validate() field.ErrorList {

// validate spec.selector and spec.template.labels
fldPath := field.NewPath("spec")
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, fldPath.Child("selector"))...)
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, metav1validation.LabelSelectorValidationOptions{}, fldPath.Child("selector"))...)
if len(m.Spec.Selector.MatchLabels)+len(m.Spec.Selector.MatchExpressions) == 0 {
errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "empty selector is not valid for MachineSet."))
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha4/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (m *MachineSet) Validate() field.ErrorList {

// validate spec.selector and spec.template.labels
fldPath := field.NewPath("spec")
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, fldPath.Child("selector"))...)
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, metav1validation.LabelSelectorValidationOptions{}, fldPath.Child("selector"))...)
if len(m.Spec.Selector.MatchLabels)+len(m.Spec.Selector.MatchExpressions) == 0 {
errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "empty selector is not valid for MachineSet."))
}
Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/index/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ const (
func ByClusterClassName(ctx context.Context, mgr ctrl.Manager) error {
if err := mgr.GetCache().IndexField(ctx, &clusterv1.Cluster{},
ClusterClassNameField,
clusterByClassName,
ClusterByClusterClassClassName,
); err != nil {
return errors.Wrap(err, "error setting index field")
}
return nil
}

func clusterByClassName(o client.Object) []string {
// ClusterByClusterClassClassName contains the logic to index Clusters by ClusterClass name.
func ClusterByClusterClassClassName(o client.Object) []string {
cluster, ok := o.(*clusterv1.Cluster)
if !ok {
panic(fmt.Sprintf("Expected Cluster but got a %T", o))
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/index/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestClusterByClassName(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
g := NewWithT(t)
got := clusterByClassName(test.object)
got := ClusterByClusterClassClassName(test.object)
g.Expect(got).To(Equal(test.expected))
})
}
Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/index/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ const (
func ByMachineNode(ctx context.Context, mgr ctrl.Manager) error {
if err := mgr.GetCache().IndexField(ctx, &clusterv1.Machine{},
MachineNodeNameField,
machineByNodeName,
MachineByNodeName,
); err != nil {
return errors.Wrap(err, "error setting index field")
}

return nil
}

func machineByNodeName(o client.Object) []string {
// MachineByNodeName contains the logic to index Machines by Node name.
func MachineByNodeName(o client.Object) []string {
machine, ok := o.(*clusterv1.Machine)
if !ok {
panic(fmt.Sprintf("Expected a Machine but got a %T", o))
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/index/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestIndexMachineByNodeName(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
g := NewWithT(t)
got := machineByNodeName(tc.object)
got := MachineByNodeName(tc.object)
g.Expect(got).To(ConsistOf(tc.expected))
})
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (m *MachineSet) Validate() field.ErrorList {

// validate spec.selector and spec.template.labels
fldPath := field.NewPath("spec")
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, fldPath.Child("selector"))...)
errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, metav1validation.LabelSelectorValidationOptions{}, fldPath.Child("selector"))...)
if len(m.Spec.Selector.MatchLabels)+len(m.Spec.Selector.MatchExpressions) == 0 {
errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "empty selector is not valid for MachineSet."))
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/clusterctl/client/cluster/internal/dryrun/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ func (c *Client) RESTMapper() meta.RESTMapper {
return c.fakeClient.RESTMapper()
}

// SubResource returns the sub resource this client is using.
func (c *Client) SubResource(subResource string) client.SubResourceClient {
return c.fakeClient.SubResource(subResource)
}

// Changes generates a summary of all the changes observed from the creation of the dry run client
// to when this function is called.
func (c *Client) Changes(ctx context.Context) (*ChangeSummary, error) {
Expand Down
1 change: 1 addition & 0 deletions docs/book/src/developer/providers/v1.3-to-v1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ maintainers of providers and consumers of our Go API.

**Note**: Only the most relevant dependencies are listed, `k8s.io/` and `ginkgo`/`gomega` dependencies in Cluster API are kept in sync with the versions used by `sigs.k8s.io/controller-runtime`.

- sigs.k8s.io/controller-runtime: v0.13.x => v0.14.x
- sigs.k8s.io/controller-tools: v0.10.x => v0.11.x

## Changes by Kind
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ A provider must supply a `tilt-provider.yaml` file describing how to build it. H
```yaml
name: aws
config:
image: "gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller",
image: "gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller"
live_reload_deps: ["main.go", "go.mod", "go.sum", "api", "cmd", "controllers", "pkg"]
label: CAPA
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import (
"github.com/spf13/pflag"
cliflag "k8s.io/component-base/cli/flag"
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
"k8s.io/component-base/logs"
logsv1 "k8s.io/component-base/logs/api/v1"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"
ctrl "sigs.k8s.io/controller-runtime"

runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"
Expand Down Expand Up @@ -75,7 +75,7 @@ func init() {
func InitFlags(fs *pflag.FlagSet) {
// Initialize logs flags using Kubernetes component-base machinery.
logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags())
logOptions.AddFlags(fs)
logsv1.AddFlags(logOptions, fs)

// Add test-extension specific flags
fs.StringVar(&profilerAddress, "profiler-address", "",
Expand All @@ -99,7 +99,7 @@ func main() {
pflag.Parse()

// Validates logs flags using Kubernetes component-base machinery and applies them
if err := logOptions.ValidateAndApply(nil); err != nil {
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
setupLog.Error(err, "unable to start extension")
os.Exit(1)
}
Expand Down Expand Up @@ -128,17 +128,17 @@ func main() {

// Register extension handlers.
if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{
Hook: runtimehooksv1.BeforeClusterCreate,
Name: "before-cluster-create",
HandlerFunc: DoBeforeClusterCreate,
Hook: runtimehooksv1.BeforeClusterCreate,
Name: "before-cluster-create",
HandlerFunc: DoBeforeClusterCreate,
}); err != nil {
setupLog.Error(err, "error adding handler")
os.Exit(1)
}
if err := webhookServer.AddExtensionHandler(server.ExtensionHandler{
Hook: runtimehooksv1.BeforeClusterUpgrade,
Name: "before-cluster-upgrade",
HandlerFunc: DoBeforeClusterUpgrade,
Hook: runtimehooksv1.BeforeClusterUpgrade,
Name: "before-cluster-upgrade",
HandlerFunc: DoBeforeClusterUpgrade,
}); err != nil {
setupLog.Error(err, "error adding handler")
os.Exit(1)
Expand Down
39 changes: 15 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,27 @@ require (
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783
google.golang.org/grpc v1.50.1
k8s.io/api v0.25.0
k8s.io/apiextensions-apiserver v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/apiserver v0.25.0
k8s.io/client-go v0.25.0
k8s.io/api v0.26.0
k8s.io/apiextensions-apiserver v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/apiserver v0.26.0
k8s.io/client-go v0.26.0
k8s.io/cluster-bootstrap v0.25.0
k8s.io/component-base v0.25.0
k8s.io/component-base v0.26.0
k8s.io/klog/v2 v2.80.1
k8s.io/kubectl v0.25.0
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73
sigs.k8s.io/controller-runtime v0.13.1
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
sigs.k8s.io/controller-runtime v0.14.1
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559 // indirect
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -79,7 +73,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.12.4 // indirect
github.com/google/cel-go v0.12.5 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
Expand All @@ -95,13 +89,13 @@ 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.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
Expand All @@ -127,13 +121,13 @@ require (
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.6.0
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
Expand All @@ -143,19 +137,16 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/cli-runtime v0.25.0 // indirect
k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

require (
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
Expand Down
Loading