diff --git a/apis/applications/v1beta1/zz_application_types.go b/apis/applications/v1beta1/zz_application_types.go index 3abb990f..fac941f6 100755 --- a/apis/applications/v1beta1/zz_application_types.go +++ b/apis/applications/v1beta1/zz_application_types.go @@ -127,7 +127,7 @@ type AccessTokenParameters struct { // The name of the optional claim. // The name of the optional claim // +kubebuilder:validation:Optional - Name *string `json:"name,omitempty" tf:"name,omitempty"` + Name *string `json:"name" tf:"name,omitempty"` // The source of the claim. If source is absent, the claim is a predefined optional claim. If source is user, the value of name is the extension property from the user object. // The source of the claim. If `source` is absent, the claim is a predefined optional claim. If `source` is `user`, the value of `name` is the extension property from the user object @@ -194,17 +194,17 @@ type AppRoleParameters struct { // Specifies whether this app role definition can be assigned to users and groups by setting to User, or to other applications (that are accessing this application in a standalone scenario) by setting to Application, or to both. // Specifies whether this app role definition can be assigned to users and groups by setting to `User`, or to other applications (that are accessing this application in a standalone scenario) by setting to `Application`, or to both // +kubebuilder:validation:Optional - AllowedMemberTypes []*string `json:"allowedMemberTypes,omitempty" tf:"allowed_member_types,omitempty"` + AllowedMemberTypes []*string `json:"allowedMemberTypes" tf:"allowed_member_types,omitempty"` // Description of the app role that appears when the role is being assigned and, if the role functions as an application permissions, during the consent experiences. // Description of the app role that appears when the role is being assigned and, if the role functions as an application permissions, during the consent experiences // +kubebuilder:validation:Optional - Description *string `json:"description,omitempty" tf:"description,omitempty"` + Description *string `json:"description" tf:"description,omitempty"` // Display name for the app role that appears during app role assignment and in consent experiences. // Display name for the app role that appears during app role assignment and in consent experiences // +kubebuilder:validation:Optional - DisplayName *string `json:"displayName,omitempty" tf:"display_name,omitempty"` + DisplayName *string `json:"displayName" tf:"display_name,omitempty"` // Determines if the app role is enabled. Defaults to true. // Determines if the app role is enabled @@ -214,7 +214,7 @@ type AppRoleParameters struct { // The unique identifier of the app role. Must be a valid UUID. // The unique identifier of the app role // +kubebuilder:validation:Optional - ID *string `json:"id,omitempty" tf:"id,omitempty"` + ID *string `json:"id" tf:"id,omitempty"` // The value that is used for the roles claim in ID tokens and OAuth 2.0 access tokens that are authenticating an assigned service or user principal. // The value that is used for the `roles` claim in ID tokens and OAuth 2.0 access tokens that are authenticating an assigned service or user principal @@ -706,7 +706,7 @@ type IDTokenParameters struct { // The name of the optional claim. // The name of the optional claim // +kubebuilder:validation:Optional - Name *string `json:"name,omitempty" tf:"name,omitempty"` + Name *string `json:"name" tf:"name,omitempty"` // The source of the claim. If source is absent, the claim is a predefined optional claim. If source is user, the value of name is the extension property from the user object. // The source of the claim. If `source` is absent, the claim is a predefined optional claim. If `source` is `user`, the value of `name` is the extension property from the user object @@ -839,7 +839,7 @@ type Oauth2PermissionScopeParameters struct { // The unique identifier of the delegated permission. Must be a valid UUID. // The unique identifier of the delegated permission // +kubebuilder:validation:Optional - ID *string `json:"id,omitempty" tf:"id,omitempty"` + ID *string `json:"id" tf:"id,omitempty"` // Whether this delegated permission should be considered safe for non-admin users to consent to on behalf of themselves, or whether an administrator should be required for consent to the permissions. Defaults to User. Possible values are User or Admin. // Whether this delegated permission should be considered safe for non-admin users to consent to on behalf of themselves, or whether an administrator should be required for consent to the permissions @@ -945,11 +945,11 @@ type RequiredResourceAccessParameters struct { // A collection of resource_access blocks as documented below, describing OAuth2.0 permission scopes and app roles that the application requires from the specified resource. // +kubebuilder:validation:Optional - ResourceAccess []ResourceAccessParameters `json:"resourceAccess,omitempty" tf:"resource_access,omitempty"` + ResourceAccess []ResourceAccessParameters `json:"resourceAccess" tf:"resource_access,omitempty"` // The unique identifier for the resource that the application requires access to. This should be the Application ID of the target application. // +kubebuilder:validation:Optional - ResourceAppID *string `json:"resourceAppId,omitempty" tf:"resource_app_id,omitempty"` + ResourceAppID *string `json:"resourceAppId" tf:"resource_app_id,omitempty"` } type ResourceAccessInitParameters struct { @@ -974,11 +974,11 @@ type ResourceAccessParameters struct { // The unique identifier for an app role or OAuth2 permission scope published by the resource application. // +kubebuilder:validation:Optional - ID *string `json:"id,omitempty" tf:"id,omitempty"` + ID *string `json:"id" tf:"id,omitempty"` // Specifies whether the id property references an app role or an OAuth2 permission scope. Possible values are Role or Scope. // +kubebuilder:validation:Optional - Type *string `json:"type,omitempty" tf:"type,omitempty"` + Type *string `json:"type" tf:"type,omitempty"` } type Saml2TokenInitParameters struct { @@ -1034,7 +1034,7 @@ type Saml2TokenParameters struct { // The name of the optional claim. // The name of the optional claim // +kubebuilder:validation:Optional - Name *string `json:"name,omitempty" tf:"name,omitempty"` + Name *string `json:"name" tf:"name,omitempty"` // The source of the claim. If source is absent, the claim is a predefined optional claim. If source is user, the value of name is the extension property from the user object. // The source of the claim. If `source` is absent, the claim is a predefined optional claim. If `source` is `user`, the value of `name` is the extension property from the user object diff --git a/apis/conditionalaccess/v1beta1/zz_accesspolicy_types.go b/apis/conditionalaccess/v1beta1/zz_accesspolicy_types.go index 1fab3033..5c4259c0 100755 --- a/apis/conditionalaccess/v1beta1/zz_accesspolicy_types.go +++ b/apis/conditionalaccess/v1beta1/zz_accesspolicy_types.go @@ -213,11 +213,11 @@ type ConditionsParameters struct { // An applications block as documented below, which specifies applications and user actions included in and excluded from the policy. // +kubebuilder:validation:Optional - Applications []ApplicationsParameters `json:"applications,omitempty" tf:"applications,omitempty"` + Applications []ApplicationsParameters `json:"applications" tf:"applications,omitempty"` // A list of client application types included in the policy. Possible values are: all, browser, mobileAppsAndDesktopClients, exchangeActiveSync, easSupported and other. // +kubebuilder:validation:Optional - ClientAppTypes []*string `json:"clientAppTypes,omitempty" tf:"client_app_types,omitempty"` + ClientAppTypes []*string `json:"clientAppTypes" tf:"client_app_types,omitempty"` // An client_applications block as documented below, which specifies service principals included in and excluded from the policy. // +kubebuilder:validation:Optional @@ -249,7 +249,7 @@ type ConditionsParameters struct { // A users block as documented below, which specifies users, groups, and roles included in and excluded from the policy. // +kubebuilder:validation:Optional - Users []UsersParameters `json:"users,omitempty" tf:"users,omitempty"` + Users []UsersParameters `json:"users" tf:"users,omitempty"` } type DevicesInitParameters struct { @@ -293,11 +293,11 @@ type FilterParameters struct { // Whether to include in, or exclude from, matching devices from the policy. Supported values are include or exclude. // +kubebuilder:validation:Optional - Mode *string `json:"mode,omitempty" tf:"mode,omitempty"` + Mode *string `json:"mode" tf:"mode,omitempty"` // Condition filter to match devices. For more information, see official documentation. // +kubebuilder:validation:Optional - Rule *string `json:"rule,omitempty" tf:"rule,omitempty"` + Rule *string `json:"rule" tf:"rule,omitempty"` } type GrantControlsInitParameters struct { @@ -334,7 +334,7 @@ type GrantControlsParameters struct { // List of built-in controls required by the policy. Possible values are: block, mfa, approvedApplication, compliantApplication, compliantDevice, domainJoinedDevice, passwordChange or unknownFutureValue. // +kubebuilder:validation:Optional - BuiltInControls []*string `json:"builtInControls,omitempty" tf:"built_in_controls,omitempty"` + BuiltInControls []*string `json:"builtInControls" tf:"built_in_controls,omitempty"` // List of custom controls IDs required by the policy. // +kubebuilder:validation:Optional @@ -342,7 +342,7 @@ type GrantControlsParameters struct { // Defines the relationship of the grant controls. Possible values are: AND, OR. // +kubebuilder:validation:Optional - Operator *string `json:"operator,omitempty" tf:"operator,omitempty"` + Operator *string `json:"operator" tf:"operator,omitempty"` // List of terms of use IDs required by the policy. // +kubebuilder:validation:Optional @@ -375,7 +375,7 @@ type LocationsParameters struct { // A list of location IDs in scope of policy unless explicitly excluded. Can also be set to All, or AllTrusted. // +kubebuilder:validation:Optional - IncludedLocations []*string `json:"includedLocations,omitempty" tf:"included_locations,omitempty"` + IncludedLocations []*string `json:"includedLocations" tf:"included_locations,omitempty"` } type PlatformsInitParameters struct { @@ -404,7 +404,7 @@ type PlatformsParameters struct { // A list of platforms the policy applies to, unless explicitly excluded. Possible values are: all, android, iOS, linux, macOS, windows, windowsPhone or unknownFutureValue. // +kubebuilder:validation:Optional - IncludedPlatforms []*string `json:"includedPlatforms,omitempty" tf:"included_platforms,omitempty"` + IncludedPlatforms []*string `json:"includedPlatforms" tf:"included_platforms,omitempty"` } type SessionControlsInitParameters struct { diff --git a/apis/conditionalaccess/v1beta1/zz_location_types.go b/apis/conditionalaccess/v1beta1/zz_location_types.go index 29a3ce84..7213d84c 100755 --- a/apis/conditionalaccess/v1beta1/zz_location_types.go +++ b/apis/conditionalaccess/v1beta1/zz_location_types.go @@ -35,7 +35,7 @@ type CountryParameters struct { // List of countries and/or regions in two-letter format specified by ISO 3166-2. // +kubebuilder:validation:Optional - CountriesAndRegions []*string `json:"countriesAndRegions,omitempty" tf:"countries_and_regions,omitempty"` + CountriesAndRegions []*string `json:"countriesAndRegions" tf:"countries_and_regions,omitempty"` // Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false. // +kubebuilder:validation:Optional @@ -64,7 +64,7 @@ type IPParameters struct { // List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. // +kubebuilder:validation:Optional - IPRanges []*string `json:"ipRanges,omitempty" tf:"ip_ranges,omitempty"` + IPRanges []*string `json:"ipRanges" tf:"ip_ranges,omitempty"` // Whether the named location is trusted. Defaults to false. // +kubebuilder:validation:Optional diff --git a/apis/directoryroles/v1beta1/zz_customdirectoryrole_types.go b/apis/directoryroles/v1beta1/zz_customdirectoryrole_types.go index 4f1372fa..b168a4f2 100755 --- a/apis/directoryroles/v1beta1/zz_customdirectoryrole_types.go +++ b/apis/directoryroles/v1beta1/zz_customdirectoryrole_types.go @@ -125,7 +125,7 @@ type PermissionsParameters struct { // A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation. // Set of tasks that can be performed on a resource // +kubebuilder:validation:Optional - AllowedResourceActions []*string `json:"allowedResourceActions,omitempty" tf:"allowed_resource_actions,omitempty"` + AllowedResourceActions []*string `json:"allowedResourceActions" tf:"allowed_resource_actions,omitempty"` } // CustomDirectoryRoleSpec defines the desired state of CustomDirectoryRole diff --git a/apis/groups/v1beta1/zz_group_types.go b/apis/groups/v1beta1/zz_group_types.go index 4f902f22..0862feb2 100755 --- a/apis/groups/v1beta1/zz_group_types.go +++ b/apis/groups/v1beta1/zz_group_types.go @@ -37,12 +37,12 @@ type DynamicMembershipParameters struct { // Whether rule processing is "On" (true) or "Paused" (false). // +kubebuilder:validation:Optional - Enabled *bool `json:"enabled,omitempty" tf:"enabled,omitempty"` + Enabled *bool `json:"enabled" tf:"enabled,omitempty"` // The rule that determines membership of this group. For more information, see official documentation on membership rules syntax. // Rule to determine members for a dynamic group. Required when `group_types` contains 'DynamicMembership' // +kubebuilder:validation:Optional - Rule *string `json:"rule,omitempty" tf:"rule,omitempty"` + Rule *string `json:"rule" tf:"rule,omitempty"` } type GroupInitParameters struct { diff --git a/apis/synchronization/v1beta1/zz_secret_types.go b/apis/synchronization/v1beta1/zz_secret_types.go index a455131d..04ca9a4b 100755 --- a/apis/synchronization/v1beta1/zz_secret_types.go +++ b/apis/synchronization/v1beta1/zz_secret_types.go @@ -32,7 +32,7 @@ type CredentialParameters struct { // The key of the secret. // Name for this key-value pair. // +kubebuilder:validation:Optional - Key *string `json:"key,omitempty" tf:"key,omitempty"` + Key *string `json:"key" tf:"key,omitempty"` // The value of the secret. // Value for this key-value pair. diff --git a/cluster/images/provider-azuread/Dockerfile b/cluster/images/provider-azuread/Dockerfile index 841e2203..e08e62d5 100644 --- a/cluster/images/provider-azuread/Dockerfile +++ b/cluster/images/provider-azuread/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.18.2 +FROM alpine:3.18.3 RUN apk --no-cache add ca-certificates bash ARG TARGETOS diff --git a/cmd/provider/main.go b/cmd/provider/main.go index 8131cdbc..08f934f3 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -20,8 +20,6 @@ import ( "path/filepath" "time" - "github.com/upbound/upjet/pkg/controller/handler" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" "github.com/crossplane/crossplane-runtime/pkg/certificates" xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" @@ -94,7 +92,6 @@ func main() { kingpin.FatalIfError(err, "Cannot create controller manager") kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Azuread APIs to scheme") - eventHandler := handler.NewEventHandler() // if the native Terraform provider plugin's path is not configured via // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or // the `--terraform-native-provider-path` command-line option, @@ -118,8 +115,7 @@ func main() { Provider: config.GetProvider(), // use the following WorkspaceStoreOption to enable the shared gRPC mode // terraform.WithProviderRunner(terraform.NewSharedProvider(log, os.Getenv("TERRAFORM_NATIVE_PROVIDER_PATH"), terraform.WithNativeProviderArgs("-debuggable"))) - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - EventHandler: eventHandler, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), } if *enableManagementPolicies { diff --git a/go.mod b/go.mod index c064db88..c454c74b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/crossplane/crossplane-runtime v0.20.0 github.com/crossplane/crossplane-tools v0.0.0-20230714144037-2684f4bc7638 github.com/pkg/errors v0.9.1 - github.com/upbound/upjet v0.9.0-rc.0.0.20230801142301-06bdecc2fcb9 + github.com/upbound/upjet v0.10.0-rc.0.0.20230818115249-bd528e443b6f gopkg.in/alecthomas/kingpin.v2 v2.2.6 k8s.io/apimachinery v0.27.3 k8s.io/client-go v0.27.3 diff --git a/go.sum b/go.sum index c0f252b1..f21eaca4 100644 --- a/go.sum +++ b/go.sum @@ -391,8 +391,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= -github.com/upbound/upjet v0.9.0-rc.0.0.20230801142301-06bdecc2fcb9 h1:ECC8AW0w2NcubOhWmu5SD5C3Vc/etRM6rhPo4LYB2No= -github.com/upbound/upjet v0.9.0-rc.0.0.20230801142301-06bdecc2fcb9/go.mod h1:2RXHgpIugCL/S/Use1QJAeVaev901RBeUByQh5gUtGk= +github.com/upbound/upjet v0.10.0-rc.0.0.20230818115249-bd528e443b6f h1:wwQAUKozMG7QzXvtXQjHSEi3MvcKb9fC0/erj7Vi56s= +github.com/upbound/upjet v0.10.0-rc.0.0.20230818115249-bd528e443b6f/go.mod h1:2RXHgpIugCL/S/Use1QJAeVaev901RBeUByQh5gUtGk= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/internal/controller/administrativeunits/member/zz_controller.go b/internal/controller/administrativeunits/member/zz_controller.go index 2a62d3e1..e4141f9b 100755 --- a/internal/controller/administrativeunits/member/zz_controller.go +++ b/internal/controller/administrativeunits/member/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Member_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_administrative_unit_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_administrative_unit_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Member{}, o.EventHandler). + Watches(&v1beta1.Member{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/administrativeunits/unit/zz_controller.go b/internal/controller/administrativeunits/unit/zz_controller.go index a6318c14..bda78976 100755 --- a/internal/controller/administrativeunits/unit/zz_controller.go +++ b/internal/controller/administrativeunits/unit/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Unit_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Unit_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Unit_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_administrative_unit"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_administrative_unit"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Unit{}, o.EventHandler). + Watches(&v1beta1.Unit{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/app/roleassignment/zz_controller.go b/internal/controller/app/roleassignment/zz_controller.go index 18d95a04..00d2a800 100755 --- a/internal/controller/app/roleassignment/zz_controller.go +++ b/internal/controller/app/roleassignment/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.RoleAssignment_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_app_role_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_app_role_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.RoleAssignment{}, o.EventHandler). + Watches(&v1beta1.RoleAssignment{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/applications/application/zz_controller.go b/internal/controller/applications/application/zz_controller.go index c75c5567..04e7070b 100755 --- a/internal/controller/applications/application/zz_controller.go +++ b/internal/controller/applications/application/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Application_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Application{}, o.EventHandler). + Watches(&v1beta1.Application{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/applications/certificate/zz_controller.go b/internal/controller/applications/certificate/zz_controller.go index d1abd007..d8fb0c8c 100755 --- a/internal/controller/applications/certificate/zz_controller.go +++ b/internal/controller/applications/certificate/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Certificate_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Certificate{}, o.EventHandler). + Watches(&v1beta1.Certificate{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/applications/federatedidentitycredential/zz_controller.go b/internal/controller/applications/federatedidentitycredential/zz_controller.go index 450e9a69..00dd536b 100755 --- a/internal/controller/applications/federatedidentitycredential/zz_controller.go +++ b/internal/controller/applications/federatedidentitycredential/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FederatedIdentityCredential_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.FederatedIdentityCredential_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FederatedIdentityCredential_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_federated_identity_credential"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_federated_identity_credential"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.FederatedIdentityCredential{}, o.EventHandler). + Watches(&v1beta1.FederatedIdentityCredential{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/applications/password/zz_controller.go b/internal/controller/applications/password/zz_controller.go index a3a6aad0..838f6dc4 100755 --- a/internal/controller/applications/password/zz_controller.go +++ b/internal/controller/applications/password/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Password_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Password_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Password_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_password"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_password"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Password{}, o.EventHandler). + Watches(&v1beta1.Password{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/applications/preauthorized/zz_controller.go b/internal/controller/applications/preauthorized/zz_controller.go index 22f4f3f4..bd324e81 100755 --- a/internal/controller/applications/preauthorized/zz_controller.go +++ b/internal/controller/applications/preauthorized/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PreAuthorized_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.PreAuthorized_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PreAuthorized_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_pre_authorized"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_application_pre_authorized"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.PreAuthorized{}, o.EventHandler). + Watches(&v1beta1.PreAuthorized{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/conditionalaccess/accesspolicy/zz_controller.go b/internal/controller/conditionalaccess/accesspolicy/zz_controller.go index dd2e3997..8c4979f8 100755 --- a/internal/controller/conditionalaccess/accesspolicy/zz_controller.go +++ b/internal/controller/conditionalaccess/accesspolicy/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.AccessPolicy_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_conditional_access_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_conditional_access_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.AccessPolicy{}, o.EventHandler). + Watches(&v1beta1.AccessPolicy{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/conditionalaccess/location/zz_controller.go b/internal/controller/conditionalaccess/location/zz_controller.go index b256abfa..62a73069 100755 --- a/internal/controller/conditionalaccess/location/zz_controller.go +++ b/internal/controller/conditionalaccess/location/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Location_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Location_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Location_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_named_location"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_named_location"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Location{}, o.EventHandler). + Watches(&v1beta1.Location{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/directoryroles/customdirectoryrole/zz_controller.go b/internal/controller/directoryroles/customdirectoryrole/zz_controller.go index f110bc2a..41b46184 100755 --- a/internal/controller/directoryroles/customdirectoryrole/zz_controller.go +++ b/internal/controller/directoryroles/customdirectoryrole/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomDirectoryRole_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.CustomDirectoryRole_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomDirectoryRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_custom_directory_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_custom_directory_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.CustomDirectoryRole{}, o.EventHandler). + Watches(&v1beta1.CustomDirectoryRole{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/directoryroles/role/zz_controller.go b/internal/controller/directoryroles/role/zz_controller.go index bab34fc4..68456437 100755 --- a/internal/controller/directoryroles/role/zz_controller.go +++ b/internal/controller/directoryroles/role/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Role_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Role_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Role_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_directory_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_directory_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Role{}, o.EventHandler). + Watches(&v1beta1.Role{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/directoryroles/roleassignment/zz_controller.go b/internal/controller/directoryroles/roleassignment/zz_controller.go index 98cabb85..bbebaa71 100755 --- a/internal/controller/directoryroles/roleassignment/zz_controller.go +++ b/internal/controller/directoryroles/roleassignment/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.RoleAssignment_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_directory_role_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_directory_role_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.RoleAssignment{}, o.EventHandler). + Watches(&v1beta1.RoleAssignment{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/groups/group/zz_controller.go b/internal/controller/groups/group/zz_controller.go index baa28da6..292c8130 100755 --- a/internal/controller/groups/group/zz_controller.go +++ b/internal/controller/groups/group/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Group_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Group{}, o.EventHandler). + Watches(&v1beta1.Group{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/groups/member/zz_controller.go b/internal/controller/groups/member/zz_controller.go index da805f03..76786e59 100755 --- a/internal/controller/groups/member/zz_controller.go +++ b/internal/controller/groups/member/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Member_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_group_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_group_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Member{}, o.EventHandler). + Watches(&v1beta1.Member{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/invitations/invitation/zz_controller.go b/internal/controller/invitations/invitation/zz_controller.go index 2b8c9878..dbeba606 100755 --- a/internal/controller/invitations/invitation/zz_controller.go +++ b/internal/controller/invitations/invitation/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Invitation_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Invitation_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Invitation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_invitation"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_invitation"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Invitation{}, o.EventHandler). + Watches(&v1beta1.Invitation{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/policies/claimsmappingpolicy/zz_controller.go b/internal/controller/policies/claimsmappingpolicy/zz_controller.go index 1adcad29..9e7c825b 100755 --- a/internal/controller/policies/claimsmappingpolicy/zz_controller.go +++ b/internal/controller/policies/claimsmappingpolicy/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClaimsMappingPolicy_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.ClaimsMappingPolicy_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClaimsMappingPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_claims_mapping_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_claims_mapping_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.ClaimsMappingPolicy{}, o.EventHandler). + Watches(&v1beta1.ClaimsMappingPolicy{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipaldelegated/permissiongrant/zz_controller.go b/internal/controller/serviceprincipaldelegated/permissiongrant/zz_controller.go index ef9182a6..1de98507 100755 --- a/internal/controller/serviceprincipaldelegated/permissiongrant/zz_controller.go +++ b/internal/controller/serviceprincipaldelegated/permissiongrant/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PermissionGrant_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.PermissionGrant_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PermissionGrant_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_delegated_permission_grant"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_delegated_permission_grant"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.PermissionGrant{}, o.EventHandler). + Watches(&v1beta1.PermissionGrant{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipals/certificate/zz_controller.go b/internal/controller/serviceprincipals/certificate/zz_controller.go index a62c8b6d..ac17a7b9 100755 --- a/internal/controller/serviceprincipals/certificate/zz_controller.go +++ b/internal/controller/serviceprincipals/certificate/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Certificate_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Certificate{}, o.EventHandler). + Watches(&v1beta1.Certificate{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipals/claimsmappingpolicyassignment/zz_controller.go b/internal/controller/serviceprincipals/claimsmappingpolicyassignment/zz_controller.go index baf96c6e..52b6f7c9 100755 --- a/internal/controller/serviceprincipals/claimsmappingpolicyassignment/zz_controller.go +++ b/internal/controller/serviceprincipals/claimsmappingpolicyassignment/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClaimsMappingPolicyAssignment_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.ClaimsMappingPolicyAssignment_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClaimsMappingPolicyAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_claims_mapping_policy_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_claims_mapping_policy_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.ClaimsMappingPolicyAssignment{}, o.EventHandler). + Watches(&v1beta1.ClaimsMappingPolicyAssignment{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipals/password/zz_controller.go b/internal/controller/serviceprincipals/password/zz_controller.go index 6414dd39..18ad6d78 100755 --- a/internal/controller/serviceprincipals/password/zz_controller.go +++ b/internal/controller/serviceprincipals/password/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Password_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Password_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Password_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_password"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_password"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Password{}, o.EventHandler). + Watches(&v1beta1.Password{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipals/principal/zz_controller.go b/internal/controller/serviceprincipals/principal/zz_controller.go index dc0a8298..c8b9e24a 100755 --- a/internal/controller/serviceprincipals/principal/zz_controller.go +++ b/internal/controller/serviceprincipals/principal/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Principal_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Principal_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Principal_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Principal{}, o.EventHandler). + Watches(&v1beta1.Principal{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/serviceprincipals/tokensigningcertificate/zz_controller.go b/internal/controller/serviceprincipals/tokensigningcertificate/zz_controller.go index ff5ab5f1..a1d3c101 100755 --- a/internal/controller/serviceprincipals/tokensigningcertificate/zz_controller.go +++ b/internal/controller/serviceprincipals/tokensigningcertificate/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TokenSigningCertificate_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.TokenSigningCertificate_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TokenSigningCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_token_signing_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_service_principal_token_signing_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.TokenSigningCertificate{}, o.EventHandler). + Watches(&v1beta1.TokenSigningCertificate{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/synchronization/job/zz_controller.go b/internal/controller/synchronization/job/zz_controller.go index 4fbd1847..3df097a6 100755 --- a/internal/controller/synchronization/job/zz_controller.go +++ b/internal/controller/synchronization/job/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Job_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_synchronization_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_synchronization_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Job{}, o.EventHandler). + Watches(&v1beta1.Job{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/synchronization/secret/zz_controller.go b/internal/controller/synchronization/secret/zz_controller.go index 40b8d18d..317887fb 100755 --- a/internal/controller/synchronization/secret/zz_controller.go +++ b/internal/controller/synchronization/secret/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Secret_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_synchronization_secret"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_synchronization_secret"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.Secret{}, o.EventHandler). + Watches(&v1beta1.Secret{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/users/user/zz_controller.go b/internal/controller/users/user/zz_controller.go index abfa8b69..95fba2fa 100755 --- a/internal/controller/users/user/zz_controller.go +++ b/internal/controller/users/user/zz_controller.go @@ -15,6 +15,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/controller/handler" "github.com/upbound/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" @@ -30,9 +31,10 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.User_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_user"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["azuread_user"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), tjcontroller.WithCallbackProvider(ac), )), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -52,6 +54,6 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1beta1.User{}, o.EventHandler). + Watches(&v1beta1.User{}, eventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) }