Skip to content

Commit

Permalink
Updates controller-runtime version to v0.8.1
Browse files Browse the repository at this point in the history
This involved bumping the code-gen version to 0.20 because the signature
of the function had been updated. Required regenerating the conversion
code.
Also updated the types containing slice of pointers of custom object
types to slice of custom objects to avoid conversion errors.

Signed-off-by: Sagar Muchhal <[email protected]>
  • Loading branch information
srm09 committed Jan 22, 2021
1 parent c615219 commit 1ab40d2
Show file tree
Hide file tree
Showing 23 changed files with 588 additions and 329 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,13 @@ generate-go-core: $(CONTROLLER_GEN) $(CONVERSION_GEN)
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha3,./$(EXP_DIR)/api/v1alpha3,./$(EXP_DIR)/addons/api/v1alpha3"
$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha3 \
--build-tag=ignore_autogenerated_core_v1alpha3 \
--output-file-base=zz_generated.conversion \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
$(CONVERSION_GEN) \
--input-dirs=./$(EXP_DIR)/api/v1alpha3 \
--input-dirs=./$(EXP_DIR)/addons/api/v1alpha3 \
--build-tag=ignore_autogenerated_core_v1alpha3 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \
--output-file-base=zz_generated.conversion \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ func fakeProvider(name string, providerType clusterctlv1.ProviderType, version,
Kind: "Provider",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: targetNamespace,
Name: clusterctlv1.ManifestLabel(name, providerType),
ResourceVersion: "1",
Namespace: targetNamespace,
Name: clusterctlv1.ManifestLabel(name, providerType),
Labels: map[string]string{
clusterctlv1.ClusterctlLabelName: "",
clusterv1.ProviderLabelName: clusterctlv1.ManifestLabel(name, providerType),
Expand Down
4 changes: 3 additions & 1 deletion cmd/clusterctl/client/cluster/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Test_inventoryClient_EnsureCustomResourceDefinitions(t *testing.T) {
}
}

var fooProvider = clusterctlv1.Provider{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "ns1"}}
var fooProvider = clusterctlv1.Provider{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "ns1", ResourceVersion: "1"}}

func Test_inventoryClient_List(t *testing.T) {
type fields struct {
Expand Down Expand Up @@ -127,6 +127,8 @@ func Test_inventoryClient_Create(t *testing.T) {
m clusterctlv1.Provider
}
providerV2 := fakeProvider("infra", clusterctlv1.InfrastructureProviderType, "v0.2.0", "", "")
// since this test object is used in a Create request, wherein setting ResourceVersion should no be set
providerV2.ResourceVersion = ""
providerV3 := fakeProvider("infra", clusterctlv1.InfrastructureProviderType, "v0.3.0", "", "")

tests := []struct {
Expand Down
5 changes: 3 additions & 2 deletions cmd/clusterctl/internal/test/fake_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ func (f *FakeProxy) WithProviderInventory(name string, providerType clusterctlv1
Kind: "Provider",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: targetNamespace,
Name: clusterctlv1.ManifestLabel(name, providerType),
ResourceVersion: "1",
Namespace: targetNamespace,
Name: clusterctlv1.ManifestLabel(name, providerType),
Labels: map[string]string{
clusterctlv1.ClusterctlLabelName: "",
clusterv1.ProviderLabelName: clusterctlv1.ManifestLabel(name, providerType),
Expand Down
2 changes: 2 additions & 0 deletions controllers/external/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ func TestGetResourceFound(t *testing.T) {
testResourceName := "greenTemplate"
testResourceKind := "GreenTemplate"
testResourceAPIVersion := "green.io/v1"
testResourceVersion := "1"

testResource := &unstructured.Unstructured{}
testResource.SetKind(testResourceKind)
testResource.SetAPIVersion(testResourceAPIVersion)
testResource.SetName(testResourceName)
testResource.SetNamespace(namespace)
testResource.SetResourceVersion(testResourceVersion)

testResourceReference := &corev1.ObjectReference{
Kind: testResourceKind,
Expand Down
50 changes: 45 additions & 5 deletions exp/addons/api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exp/addons/api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions exp/api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exp/api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,32 @@ require (
github.com/fatih/color v1.7.0
github.com/go-logr/logr v0.3.0
github.com/gobuffalo/flect v0.2.2
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/google/go-cmp v0.5.2
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.1.2 // indirect
github.com/gosuri/uitable v0.0.4
github.com/imdario/mergo v0.3.11 // indirect
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.0
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5
github.com/spf13/viper v1.7.0
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
google.golang.org/grpc v1.27.0
k8s.io/api v0.19.2
k8s.io/apiextensions-apiserver v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/apiserver v0.19.2
k8s.io/client-go v0.19.2
k8s.io/cluster-bootstrap v0.19.2
k8s.io/component-base v0.19.2
google.golang.org/grpc v1.27.1
k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/apiserver v0.20.2
k8s.io/client-go v0.20.2
k8s.io/cluster-bootstrap v0.20.2
k8s.io/component-base v0.20.2
k8s.io/klog v1.0.0
k8s.io/kubectl v0.19.2
k8s.io/utils v0.0.0-20200912215256-4140de9c8800
sigs.k8s.io/controller-runtime v0.7.1-0.20201215171748-096b2e07c091
k8s.io/kubectl v0.20.2
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
sigs.k8s.io/controller-runtime v0.8.1
sigs.k8s.io/kind v0.9.0
sigs.k8s.io/yaml v1.2.0
)
Loading

0 comments on commit 1ab40d2

Please sign in to comment.