Skip to content

Commit

Permalink
Register the API types with the API resolver's runtime scheme
Browse files Browse the repository at this point in the history
- Bump upjet to commit 03a207b6416a
- Bump uptest to version v0.12.0-9.gac371c9

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed May 8, 2024
1 parent c88df8f commit 990d474
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 90 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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-9.gac371c9
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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/upbound/provider-azuread/apis"
"github.com/upbound/provider-azuread/apis/v1alpha1"
"github.com/upbound/provider-azuread/config"
resolverapis "github.com/upbound/provider-azuread/internal/apis"
"github.com/upbound/provider-azuread/internal/clients"
"github.com/upbound/provider-azuread/internal/controller"
"github.com/upbound/provider-azuread/internal/features"
Expand Down Expand Up @@ -145,6 +146,7 @@ func main() {
})
kingpin.FatalIfError(err, "Cannot create controller manager")
kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Azuread APIs to scheme")
kingpin.FatalIfError(resolverapis.BuildScheme(apis.AddToSchemes), "Cannot register the AzureAD APIs with the API resolver's runtime scheme")

metricRecorder := managed.NewMRMetricRecorder()
stateMetrics := statemetrics.NewMRStateMetrics()
Expand Down
14 changes: 7 additions & 7 deletions config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ 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"
// we would like to set the storage version to v1beta1 to facilitate
// 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
}
}
2 changes: 1 addition & 1 deletion examples/conditionalaccess/v1beta2/accesspolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/conditionalaccess/v1beta2/location.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file modified examples/groups/testhooks/delete-member.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified examples/synchronization/testhooks/delete-secret.sh
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
dario.cat/mergo v1.0.0
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240424114634-8641eb2ba384
github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79
github.com/crossplane/upjet v1.3.0
github.com/crossplane/upjet v1.4.0-rc.0.0.20240508134714-03a207b6416a
github.com/hashicorp/terraform-json v0.17.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
github.com/hashicorp/terraform-provider-azuread v1.6.1-0.20230727144955-0adfe586f500
Expand Down Expand Up @@ -151,5 +151,3 @@ require (
replace github.com/hashicorp/terraform-provider-azuread => github.com/upbound/terraform-provider-azuread v0.0.0-20240311141618-ce1f46c21020

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
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
Expand Down Expand Up @@ -694,10 +696,12 @@ github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crossplane/crossplane-runtime v1.15.1 h1:g1h75tNYOQT152IUNxs8ZgSsRFQKrZN9z69KefMujXs=
github.com/crossplane/crossplane-runtime v1.15.1/go.mod h1:kRcJjJQmBFrR2n/KhwL8wYS7xNfq3D8eK4JliEScOHI=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240424114634-8641eb2ba384 h1:EswfDIEITA16CUWt78dVN0plbMBk8TdDfpbVXNeQJ1Y=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240424114634-8641eb2ba384/go.mod h1:Pz2tdGVMF6KDGzHZOkvKro0nKc8EzK0sb/nSA7pH4Dc=
github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y=
github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0=
github.com/crossplane/upjet v1.4.0-rc.0.0.20240508134714-03a207b6416a h1:VSpJnOWhWPz0sc9Qnp1st7jC49h8r4E9VYKi379I0lY=
github.com/crossplane/upjet v1.4.0-rc.0.0.20240508134714-03a207b6416a/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw=
Expand Down Expand Up @@ -1178,8 +1182,6 @@ 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/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=
Expand Down
24 changes: 12 additions & 12 deletions internal/controller/applications/application/zz_controller.go

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

24 changes: 12 additions & 12 deletions internal/controller/conditionalaccess/accesspolicy/zz_controller.go

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

Loading

0 comments on commit 990d474

Please sign in to comment.