diff --git a/Makefile b/Makefile index 7728b0b..22a5c5f 100644 --- a/Makefile +++ b/Makefile @@ -57,12 +57,24 @@ KIND_VERSION = v0.21.0 UP_VERSION = v0.28.0 UP_CHANNEL = stable UPTEST_VERSION = v0.11.1 +UPTEST_LOCAL_VERSION = v0.12.0-2.g635fa3e +UPTEST_LOCAL_CHANNEL = main KUSTOMIZE_VERSION = v5.3.0 YQ_VERSION = v4.40.5 UXP_VERSION = 1.14.6-up.1 -include build/makelib/k8s_tools.mk +# uptest download and install +UPTEST_LOCAL := $(TOOLS_HOST_DIR)/uptest-$(UPTEST_LOCAL_VERSION) + +$(UPTEST_LOCAL): + @$(INFO) installing uptest $(UPTEST_LOCAL) + @mkdir -p $(TOOLS_HOST_DIR) + @curl -fsSLo $(UPTEST_LOCAL) https://s3.us-west-2.amazonaws.com/crossplane.uptest.releases/$(UPTEST_LOCAL_CHANNEL)/$(UPTEST_LOCAL_VERSION)/bin/$(SAFEHOST_PLATFORM)/uptest || $(FAIL) + @chmod +x $(UPTEST_LOCAL) + @$(OK) installing uptest $(UPTEST_LOCAL) + # ==================================================================================== # Setup Images @@ -183,9 +195,9 @@ CROSSPLANE_NAMESPACE = upbound-system # - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test # - UPTEST_CLOUD_CREDENTIALS (optional), cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) # - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource -uptest: $(UPTEST) $(KUBECTL) $(KUTTL) +uptest: $(UPTEST_LOCAL) $(KUBECTL) $(KUTTL) @$(INFO) running automated tests - @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --setup-script=cluster/test/setup.sh || $(FAIL) + @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST_LOCAL) e2e "${UPTEST_EXAMPLE_LIST}" --setup-script=cluster/test/setup.sh || $(FAIL) @$(OK) running automated tests local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) diff --git a/config/provider.go b/config/provider.go index 0b345ae..0273333 100644 --- a/config/provider.go +++ b/config/provider.go @@ -128,11 +128,11 @@ func resourceList(t map[string]ujconfig.ExternalName) []string { } func bumpVersionsWithEmbeddedLists(pc *ujconfig.Provider) { - for _, r := range pc.Resources { + for name, r := range pc.Resources { + r := r // nothing to do if no singleton list has been converted to // an embedded object - crdPaths := r.CRDListConversionPaths() - if len(crdPaths) == 0 { + if len(r.CRDListConversionPaths()) == 0 { continue } r.Version = "v1beta2" @@ -140,9 +140,9 @@ func bumpVersionsWithEmbeddedLists(pc *ujconfig.Provider) { // downgrades. r.SetCRDStorageVersion("v1beta1") r.Conversions = []conversion.Conversion{ - conversion.NewIdentityConversionExpandPaths("v1beta1", "v1beta2", []string{"spec.forProvider", "spec.initProvider", "status.atProvider"}, crdPaths...), - conversion.NewIdentityConversionExpandPaths("v1beta2", "v1beta1", []string{"spec.forProvider", "spec.initProvider", "status.atProvider"}, crdPaths...), - conversion.NewSingletonListConversion("v1beta1", "v1beta2", crdPaths, conversion.ToEmbeddedObject), - conversion.NewSingletonListConversion("v1beta2", "v1beta1", crdPaths, conversion.ToSingletonList)} + conversion.NewIdentityConversionExpandPaths(conversion.AllVersions, conversion.AllVersions, []string{"spec.forProvider", "spec.initProvider", "status.atProvider"}, r.CRDListConversionPaths()...), + conversion.NewSingletonListConversion("v1beta1", "v1beta2", r.CRDListConversionPaths(), conversion.ToEmbeddedObject), + conversion.NewSingletonListConversion("v1beta2", "v1beta1", r.CRDListConversionPaths(), conversion.ToSingletonList)} + pc.Resources[name] = r } } diff --git a/examples/conditionalaccess/v1beta2/accesspolicy.yaml b/examples/conditionalaccess/v1beta2/accesspolicy.yaml index 4cea3a9..29fa272 100644 --- a/examples/conditionalaccess/v1beta2/accesspolicy.yaml +++ b/examples/conditionalaccess/v1beta2/accesspolicy.yaml @@ -6,7 +6,7 @@ apiVersion: conditionalaccess.azuread.upbound.io/v1beta2 kind: AccessPolicy metadata: annotations: - meta.upbound.io/example-id: conditionalaccess/v1beta1/accesspolicy + meta.upbound.io/example-id: conditionalaccess/v1beta2/accesspolicy labels: testing.upbound.io/example-name: example name: example diff --git a/examples/conditionalaccess/v1beta2/location.yaml b/examples/conditionalaccess/v1beta2/location.yaml index 61dcd12..0e9bfc7 100644 --- a/examples/conditionalaccess/v1beta2/location.yaml +++ b/examples/conditionalaccess/v1beta2/location.yaml @@ -6,7 +6,7 @@ apiVersion: conditionalaccess.azuread.upbound.io/v1beta2 kind: Location metadata: annotations: - meta.upbound.io/example-id: conditionalaccess/v1beta1/location + meta.upbound.io/example-id: conditionalaccess/v1beta2/location labels: testing.upbound.io/example-name: example-ip name: example-ip diff --git a/go.mod b/go.mod index b71c2c2..91ada4b 100644 --- a/go.mod +++ b/go.mod @@ -152,4 +152,4 @@ replace github.com/hashicorp/terraform-provider-azuread => github.com/upbound/te replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 -replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240419053705-66007071bfaa +replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240422072143-9a463d567f9c diff --git a/go.sum b/go.sum index 3ecb30d..5b98035 100644 --- a/go.sum +++ b/go.sum @@ -1178,8 +1178,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= -github.com/ulucinar/upbound-upjet v0.0.0-20240419053705-66007071bfaa h1:igwpWGAwx/39QS/ALZDa7/8rHn1YaWYmpT5rNZoarJA= -github.com/ulucinar/upbound-upjet v0.0.0-20240419053705-66007071bfaa/go.mod h1:0bHLtnejZ9bDeyXuBb9MSOQLvKo3+aoTeUBO8N0dGSA= +github.com/ulucinar/upbound-upjet v0.0.0-20240422072143-9a463d567f9c h1:H+IioE227HCCHC9Fz/HRGMv/nSL1pDkOIu9krrTrsng= +github.com/ulucinar/upbound-upjet v0.0.0-20240422072143-9a463d567f9c/go.mod h1:0bHLtnejZ9bDeyXuBb9MSOQLvKo3+aoTeUBO8N0dGSA= github.com/upbound/terraform-provider-azuread v0.0.0-20240311141618-ce1f46c21020 h1:BP26QEhnXcWxbJpbOT+e4bP+c9FTvqhGbtnkwXerOhA= github.com/upbound/terraform-provider-azuread v0.0.0-20240311141618-ce1f46c21020/go.mod h1:iVryf2s08Hi6HLHh4W40fudtInXuK5Y1cWVOM/3szT8= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=