From a6d44f7d675789779c21574016304e26c7fe35e9 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Mon, 13 May 2024 17:32:46 +0300 Subject: [PATCH] Bump upjet to commit 94634891cc5a Signed-off-by: Alper Rifat Ulucinar --- config/registry.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- .../monitoractionruleactiongroup/zz_controller.go | 13 +++++++++++++ .../monitoractionrulesuppression/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../monitorsmartdetectoralertrule/zz_controller.go | 13 +++++++++++++ .../analysisservices/server/zz_controller.go | 13 +++++++++++++ .../controller/apimanagement/api/zz_controller.go | 13 +++++++++++++ .../apimanagement/apidiagnostic/zz_controller.go | 13 +++++++++++++ .../apimanagement/apioperation/zz_controller.go | 13 +++++++++++++ .../apioperationpolicy/zz_controller.go | 13 +++++++++++++ .../apimanagement/apioperationtag/zz_controller.go | 13 +++++++++++++ .../apimanagement/apipolicy/zz_controller.go | 13 +++++++++++++ .../apimanagement/apirelease/zz_controller.go | 13 +++++++++++++ .../apimanagement/apischema/zz_controller.go | 13 +++++++++++++ .../apimanagement/apitag/zz_controller.go | 13 +++++++++++++ .../apimanagement/apiversionset/zz_controller.go | 13 +++++++++++++ .../authorizationserver/zz_controller.go | 13 +++++++++++++ .../apimanagement/backend/zz_controller.go | 13 +++++++++++++ .../apimanagement/certificate/zz_controller.go | 13 +++++++++++++ .../apimanagement/customdomain/zz_controller.go | 13 +++++++++++++ .../apimanagement/diagnostic/zz_controller.go | 13 +++++++++++++ .../apimanagement/emailtemplate/zz_controller.go | 13 +++++++++++++ .../apimanagement/gateway/zz_controller.go | 13 +++++++++++++ .../apimanagement/gatewayapi/zz_controller.go | 13 +++++++++++++ .../apimanagement/globalschema/zz_controller.go | 13 +++++++++++++ .../identityprovideraad/zz_controller.go | 13 +++++++++++++ .../identityproviderfacebook/zz_controller.go | 13 +++++++++++++ .../identityprovidergoogle/zz_controller.go | 13 +++++++++++++ .../identityprovidermicrosoft/zz_controller.go | 13 +++++++++++++ .../identityprovidertwitter/zz_controller.go | 13 +++++++++++++ .../apimanagement/logger/zz_controller.go | 13 +++++++++++++ .../apimanagement/management/zz_controller.go | 13 +++++++++++++ .../apimanagement/namedvalue/zz_controller.go | 13 +++++++++++++ .../notificationrecipientemail/zz_controller.go | 13 +++++++++++++ .../notificationrecipientuser/zz_controller.go | 13 +++++++++++++ .../openidconnectprovider/zz_controller.go | 13 +++++++++++++ .../apimanagement/policy/zz_controller.go | 13 +++++++++++++ .../apimanagement/product/zz_controller.go | 13 +++++++++++++ .../apimanagement/productapi/zz_controller.go | 13 +++++++++++++ .../apimanagement/productpolicy/zz_controller.go | 13 +++++++++++++ .../apimanagement/producttag/zz_controller.go | 13 +++++++++++++ .../apimanagement/rediscache/zz_controller.go | 13 +++++++++++++ .../apimanagement/subscription/zz_controller.go | 13 +++++++++++++ .../controller/apimanagement/tag/zz_controller.go | 13 +++++++++++++ .../controller/apimanagement/user/zz_controller.go | 13 +++++++++++++ .../appconfiguration/configuration/zz_controller.go | 13 +++++++++++++ .../springcloudaccelerator/zz_controller.go | 13 +++++++++++++ .../springcloudactivedeployment/zz_controller.go | 13 +++++++++++++ .../springcloudapiportal/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../appplatform/springcloudapp/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../springcloudappmysqlassociation/zz_controller.go | 13 +++++++++++++ .../springcloudappredisassociation/zz_controller.go | 13 +++++++++++++ .../springcloudbuilddeployment/zz_controller.go | 13 +++++++++++++ .../appplatform/springcloudbuilder/zz_controller.go | 13 +++++++++++++ .../springcloudbuildpackbinding/zz_controller.go | 13 +++++++++++++ .../springcloudcertificate/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../springcloudcontainerdeployment/zz_controller.go | 13 +++++++++++++ .../springcloudcustomdomain/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../springclouddevtoolportal/zz_controller.go | 13 +++++++++++++ .../appplatform/springcloudgateway/zz_controller.go | 13 +++++++++++++ .../springcloudgatewaycustomdomain/zz_controller.go | 13 +++++++++++++ .../springcloudjavadeployment/zz_controller.go | 13 +++++++++++++ .../appplatform/springcloudservice/zz_controller.go | 13 +++++++++++++ .../appplatform/springcloudstorage/zz_controller.go | 13 +++++++++++++ .../attestation/provider/zz_controller.go | 13 +++++++++++++ .../authorization/managementlock/zz_controller.go | 13 +++++++++++++ .../authorization/policydefinition/zz_controller.go | 13 +++++++++++++ .../resourcegrouppolicyassignment/zz_controller.go | 13 +++++++++++++ .../resourcepolicyassignment/zz_controller.go | 13 +++++++++++++ .../resourcepolicyexemption/zz_controller.go | 13 +++++++++++++ .../authorization/roleassignment/zz_controller.go | 13 +++++++++++++ .../authorization/roledefinition/zz_controller.go | 13 +++++++++++++ .../subscriptionpolicyassignment/zz_controller.go | 13 +++++++++++++ .../subscriptionpolicyexemption/zz_controller.go | 13 +++++++++++++ .../controller/automation/account/zz_controller.go | 13 +++++++++++++ .../automation/connection/zz_controller.go | 13 +++++++++++++ .../connectionclassiccertificate/zz_controller.go | 13 +++++++++++++ .../automation/connectiontype/zz_controller.go | 13 +++++++++++++ .../automation/credential/zz_controller.go | 13 +++++++++++++ .../hybridrunbookworkergroup/zz_controller.go | 13 +++++++++++++ .../controller/automation/module/zz_controller.go | 13 +++++++++++++ .../controller/automation/runbook/zz_controller.go | 13 +++++++++++++ .../controller/automation/schedule/zz_controller.go | 13 +++++++++++++ .../automation/variablebool/zz_controller.go | 13 +++++++++++++ .../automation/variabledatetime/zz_controller.go | 13 +++++++++++++ .../automation/variableint/zz_controller.go | 13 +++++++++++++ .../automation/variablestring/zz_controller.go | 13 +++++++++++++ .../controller/automation/webhook/zz_controller.go | 13 +++++++++++++ .../controller/azure/resourcegroup/zz_controller.go | 13 +++++++++++++ .../resourceproviderregistration/zz_controller.go | 13 +++++++++++++ .../controller/azure/subscription/zz_controller.go | 13 +++++++++++++ .../azurestackhci/cluster/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelalexa/zz_controller.go | 13 +++++++++++++ .../botchanneldirectline/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelline/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelmsteams/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelslack/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelsms/zz_controller.go | 13 +++++++++++++ .../botchannelsregistration/zz_controller.go | 13 +++++++++++++ .../botservice/botchannelwebchat/zz_controller.go | 13 +++++++++++++ .../botservice/botconnection/zz_controller.go | 13 +++++++++++++ .../botservice/botwebapp/zz_controller.go | 13 +++++++++++++ .../controller/cache/rediscache/zz_controller.go | 13 +++++++++++++ .../cache/redisenterprisecluster/zz_controller.go | 13 +++++++++++++ .../cache/redisenterprisedatabase/zz_controller.go | 13 +++++++++++++ .../cache/redisfirewallrule/zz_controller.go | 13 +++++++++++++ .../cache/redislinkedserver/zz_controller.go | 13 +++++++++++++ internal/controller/cdn/endpoint/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorcustomdomain/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorendpoint/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorfirewallpolicy/zz_controller.go | 13 +++++++++++++ .../controller/cdn/frontdoororigin/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoororigingroup/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorprofile/zz_controller.go | 13 +++++++++++++ .../controller/cdn/frontdoorroute/zz_controller.go | 13 +++++++++++++ .../controller/cdn/frontdoorrule/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorruleset/zz_controller.go | 13 +++++++++++++ .../cdn/frontdoorsecuritypolicy/zz_controller.go | 13 +++++++++++++ internal/controller/cdn/profile/zz_controller.go | 13 +++++++++++++ .../appservicecertificateorder/zz_controller.go | 13 +++++++++++++ .../cognitiveservices/account/zz_controller.go | 13 +++++++++++++ .../cognitiveservices/deployment/zz_controller.go | 13 +++++++++++++ .../communication/service/zz_controller.go | 13 +++++++++++++ .../compute/availabilityset/zz_controller.go | 13 +++++++++++++ .../compute/capacityreservation/zz_controller.go | 13 +++++++++++++ .../capacityreservationgroup/zz_controller.go | 13 +++++++++++++ .../compute/dedicatedhost/zz_controller.go | 13 +++++++++++++ .../controller/compute/diskaccess/zz_controller.go | 13 +++++++++++++ .../compute/diskencryptionset/zz_controller.go | 13 +++++++++++++ .../compute/galleryapplication/zz_controller.go | 13 +++++++++++++ .../galleryapplicationversion/zz_controller.go | 13 +++++++++++++ internal/controller/compute/image/zz_controller.go | 13 +++++++++++++ .../compute/linuxvirtualmachine/zz_controller.go | 13 +++++++++++++ .../linuxvirtualmachinescaleset/zz_controller.go | 13 +++++++++++++ .../controller/compute/manageddisk/zz_controller.go | 13 +++++++++++++ .../compute/manageddisksastoken/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../proximityplacementgroup/zz_controller.go | 13 +++++++++++++ .../controller/compute/sharedimage/zz_controller.go | 13 +++++++++++++ .../compute/sharedimagegallery/zz_controller.go | 13 +++++++++++++ .../controller/compute/snapshot/zz_controller.go | 13 +++++++++++++ .../compute/sshpublickey/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../virtualmachineextension/zz_controller.go | 13 +++++++++++++ .../compute/windowsvirtualmachine/zz_controller.go | 13 +++++++++++++ .../windowsvirtualmachinescaleset/zz_controller.go | 13 +++++++++++++ .../confidentialledger/ledger/zz_controller.go | 13 +++++++++++++ .../budgetmanagementgroup/zz_controller.go | 13 +++++++++++++ .../budgetresourcegroup/zz_controller.go | 13 +++++++++++++ .../consumption/budgetsubscription/zz_controller.go | 13 +++++++++++++ .../containerapp/containerapp/zz_controller.go | 13 +++++++++++++ .../containerapp/environment/zz_controller.go | 13 +++++++++++++ .../containerregistry/agentpool/zz_controller.go | 13 +++++++++++++ .../containerconnectedregistry/zz_controller.go | 13 +++++++++++++ .../containerregistry/registry/zz_controller.go | 13 +++++++++++++ .../containerregistry/scopemap/zz_controller.go | 13 +++++++++++++ .../containerregistry/token/zz_controller.go | 13 +++++++++++++ .../tokenpassword/zz_controller.go | 13 +++++++++++++ .../containerregistry/webhook/zz_controller.go | 13 +++++++++++++ .../kubernetescluster/zz_controller.go | 13 +++++++++++++ .../kubernetesclusternodepool/zz_controller.go | 13 +++++++++++++ .../kubernetesfleetmanager/zz_controller.go | 13 +++++++++++++ .../controller/cosmosdb/account/zz_controller.go | 13 +++++++++++++ .../cosmosdb/cassandracluster/zz_controller.go | 13 +++++++++++++ .../cosmosdb/cassandradatacenter/zz_controller.go | 13 +++++++++++++ .../cosmosdb/cassandrakeyspace/zz_controller.go | 13 +++++++++++++ .../cosmosdb/cassandratable/zz_controller.go | 13 +++++++++++++ .../cosmosdb/gremlindatabase/zz_controller.go | 13 +++++++++++++ .../cosmosdb/gremlingraph/zz_controller.go | 13 +++++++++++++ .../cosmosdb/mongocollection/zz_controller.go | 13 +++++++++++++ .../cosmosdb/mongodatabase/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqlcontainer/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqldatabase/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqldedicatedgateway/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqlfunction/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqlroleassignment/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqlroledefinition/zz_controller.go | 13 +++++++++++++ .../cosmosdb/sqlstoredprocedure/zz_controller.go | 13 +++++++++++++ .../controller/cosmosdb/sqltrigger/zz_controller.go | 13 +++++++++++++ internal/controller/cosmosdb/table/zz_controller.go | 13 +++++++++++++ .../costanomalyalert/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../customproviders/customprovider/zz_controller.go | 13 +++++++++++++ .../controller/databoxedge/device/zz_controller.go | 13 +++++++++++++ .../databricks/accessconnector/zz_controller.go | 13 +++++++++++++ .../databricks/workspace/zz_controller.go | 13 +++++++++++++ .../workspacecustomermanagedkey/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../datafactory/customdataset/zz_controller.go | 13 +++++++++++++ .../datafactory/dataflow/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetazureblob/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetbinary/zz_controller.go | 13 +++++++++++++ .../datasetcosmosdbsqlapi/zz_controller.go | 13 +++++++++++++ .../datasetdelimitedtext/zz_controller.go | 13 +++++++++++++ .../datafactory/datasethttp/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetjson/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetmysql/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetparquet/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetpostgresql/zz_controller.go | 13 +++++++++++++ .../datafactory/datasetsnowflake/zz_controller.go | 13 +++++++++++++ .../datasetsqlservertable/zz_controller.go | 13 +++++++++++++ .../controller/datafactory/factory/zz_controller.go | 13 +++++++++++++ .../integrationruntimeazure/zz_controller.go | 13 +++++++++++++ .../integrationruntimeazuressis/zz_controller.go | 13 +++++++++++++ .../integrationruntimemanaged/zz_controller.go | 13 +++++++++++++ .../integrationruntimeselfhosted/zz_controller.go | 13 +++++++++++++ .../linkedcustomservice/zz_controller.go | 13 +++++++++++++ .../linkedserviceazureblobstorage/zz_controller.go | 13 +++++++++++++ .../linkedserviceazuredatabricks/zz_controller.go | 13 +++++++++++++ .../linkedserviceazurefilestorage/zz_controller.go | 13 +++++++++++++ .../linkedserviceazurefunction/zz_controller.go | 13 +++++++++++++ .../linkedserviceazuresearch/zz_controller.go | 13 +++++++++++++ .../linkedserviceazuresqldatabase/zz_controller.go | 13 +++++++++++++ .../linkedserviceazuretablestorage/zz_controller.go | 13 +++++++++++++ .../linkedservicecosmosdb/zz_controller.go | 13 +++++++++++++ .../linkedservicecosmosdbmongoapi/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../linkedservicekeyvault/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedservicekusto/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedservicemysql/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedserviceodata/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedserviceodbc/zz_controller.go | 13 +++++++++++++ .../linkedservicepostgresql/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedservicesftp/zz_controller.go | 13 +++++++++++++ .../linkedservicesnowflake/zz_controller.go | 13 +++++++++++++ .../linkedservicesqlserver/zz_controller.go | 13 +++++++++++++ .../linkedservicesynapse/zz_controller.go | 13 +++++++++++++ .../datafactory/linkedserviceweb/zz_controller.go | 13 +++++++++++++ .../managedprivateendpoint/zz_controller.go | 13 +++++++++++++ .../datafactory/pipeline/zz_controller.go | 13 +++++++++++++ .../datafactory/triggerblobevent/zz_controller.go | 13 +++++++++++++ .../datafactory/triggercustomevent/zz_controller.go | 13 +++++++++++++ .../datafactory/triggerschedule/zz_controller.go | 13 +++++++++++++ .../databasemigrationproject/zz_controller.go | 13 +++++++++++++ .../databasemigrationservice/zz_controller.go | 13 +++++++++++++ .../backupinstanceblobstorage/zz_controller.go | 13 +++++++++++++ .../backupinstancedisk/zz_controller.go | 13 +++++++++++++ .../backupinstancepostgresql/zz_controller.go | 13 +++++++++++++ .../backuppolicyblobstorage/zz_controller.go | 13 +++++++++++++ .../backuppolicydisk/zz_controller.go | 13 +++++++++++++ .../backuppolicypostgresql/zz_controller.go | 13 +++++++++++++ .../dataprotection/backupvault/zz_controller.go | 13 +++++++++++++ .../dataprotection/resourceguard/zz_controller.go | 13 +++++++++++++ .../controller/datashare/account/zz_controller.go | 13 +++++++++++++ .../datashare/datasetblobstorage/zz_controller.go | 13 +++++++++++++ .../datashare/datasetdatalakegen2/zz_controller.go | 13 +++++++++++++ .../datashare/datasetkustocluster/zz_controller.go | 13 +++++++++++++ .../datashare/datasetkustodatabase/zz_controller.go | 13 +++++++++++++ .../controller/datashare/datashare/zz_controller.go | 13 +++++++++++++ .../dbformariadb/configuration/zz_controller.go | 13 +++++++++++++ .../dbformariadb/database/zz_controller.go | 13 +++++++++++++ .../dbformariadb/firewallrule/zz_controller.go | 13 +++++++++++++ .../controller/dbformariadb/server/zz_controller.go | 13 +++++++++++++ .../virtualnetworkrule/zz_controller.go | 13 +++++++++++++ .../activedirectoryadministrator/zz_controller.go | 13 +++++++++++++ .../dbformysql/configuration/zz_controller.go | 13 +++++++++++++ .../controller/dbformysql/database/zz_controller.go | 13 +++++++++++++ .../dbformysql/firewallrule/zz_controller.go | 13 +++++++++++++ .../dbformysql/flexibledatabase/zz_controller.go | 13 +++++++++++++ .../dbformysql/flexibleserver/zz_controller.go | 13 +++++++++++++ .../flexibleserverconfiguration/zz_controller.go | 13 +++++++++++++ .../flexibleserverfirewallrule/zz_controller.go | 13 +++++++++++++ .../controller/dbformysql/server/zz_controller.go | 13 +++++++++++++ .../dbformysql/virtualnetworkrule/zz_controller.go | 13 +++++++++++++ .../activedirectoryadministrator/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/configuration/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/database/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/firewallrule/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/flexibleserver/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../flexibleserverconfiguration/zz_controller.go | 13 +++++++++++++ .../flexibleserverdatabase/zz_controller.go | 13 +++++++++++++ .../flexibleserverfirewallrule/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/server/zz_controller.go | 13 +++++++++++++ .../dbforpostgresql/serverkey/zz_controller.go | 13 +++++++++++++ .../virtualnetworkrule/zz_controller.go | 13 +++++++++++++ internal/controller/devices/iothub/zz_controller.go | 13 +++++++++++++ .../devices/iothubcertificate/zz_controller.go | 13 +++++++++++++ .../devices/iothubconsumergroup/zz_controller.go | 13 +++++++++++++ .../controller/devices/iothubdps/zz_controller.go | 13 +++++++++++++ .../devices/iothubdpscertificate/zz_controller.go | 13 +++++++++++++ .../iothubdpssharedaccesspolicy/zz_controller.go | 13 +++++++++++++ .../devices/iothubendpointeventhub/zz_controller.go | 13 +++++++++++++ .../iothubendpointservicebusqueue/zz_controller.go | 13 +++++++++++++ .../iothubendpointservicebustopic/zz_controller.go | 13 +++++++++++++ .../iothubendpointstoragecontainer/zz_controller.go | 13 +++++++++++++ .../devices/iothubenrichment/zz_controller.go | 13 +++++++++++++ .../devices/iothubfallbackroute/zz_controller.go | 13 +++++++++++++ .../controller/devices/iothubroute/zz_controller.go | 13 +++++++++++++ .../iothubsharedaccesspolicy/zz_controller.go | 13 +++++++++++++ .../iothubdeviceupdateaccount/zz_controller.go | 13 +++++++++++++ .../iothubdeviceupdateinstance/zz_controller.go | 13 +++++++++++++ .../globalvmshutdownschedule/zz_controller.go | 13 +++++++++++++ internal/controller/devtestlab/lab/zz_controller.go | 13 +++++++++++++ .../devtestlab/linuxvirtualmachine/zz_controller.go | 13 +++++++++++++ .../controller/devtestlab/policy/zz_controller.go | 13 +++++++++++++ .../controller/devtestlab/schedule/zz_controller.go | 13 +++++++++++++ .../devtestlab/virtualnetwork/zz_controller.go | 13 +++++++++++++ .../windowsvirtualmachine/zz_controller.go | 13 +++++++++++++ .../digitaltwins/instance/zz_controller.go | 13 +++++++++++++ .../elastic/cloudelasticsearch/zz_controller.go | 13 +++++++++++++ .../controller/eventgrid/domain/zz_controller.go | 13 +++++++++++++ .../eventgrid/domaintopic/zz_controller.go | 13 +++++++++++++ .../eventgrid/eventsubscription/zz_controller.go | 13 +++++++++++++ .../eventgrid/systemtopic/zz_controller.go | 13 +++++++++++++ .../controller/eventgrid/topic/zz_controller.go | 13 +++++++++++++ .../eventhub/authorizationrule/zz_controller.go | 13 +++++++++++++ .../eventhub/consumergroup/zz_controller.go | 13 +++++++++++++ .../controller/eventhub/eventhub/zz_controller.go | 13 +++++++++++++ .../eventhub/eventhubnamespace/zz_controller.go | 13 +++++++++++++ .../namespaceauthorizationrule/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../eventhub/namespaceschemagroup/zz_controller.go | 13 +++++++++++++ .../controller/fluidrelay/server/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../hdinsight/hadoopcluster/zz_controller.go | 13 +++++++++++++ .../hdinsight/hbasecluster/zz_controller.go | 13 +++++++++++++ .../interactivequerycluster/zz_controller.go | 13 +++++++++++++ .../hdinsight/kafkacluster/zz_controller.go | 13 +++++++++++++ .../hdinsight/sparkcluster/zz_controller.go | 13 +++++++++++++ .../controller/healthbot/healthbot/zz_controller.go | 13 +++++++++++++ .../healthcaredicomservice/zz_controller.go | 13 +++++++++++++ .../healthcarefhirservice/zz_controller.go | 13 +++++++++++++ .../healthcaremedtechservice/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../healthcareservice/zz_controller.go | 13 +++++++++++++ .../healthcareworkspace/zz_controller.go | 13 +++++++++++++ .../insights/applicationinsights/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../applicationinsightsapikey/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../applicationinsightswebtest/zz_controller.go | 13 +++++++++++++ .../applicationinsightsworkbook/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../insights/monitoractiongroup/zz_controller.go | 13 +++++++++++++ .../monitoractivitylogalert/zz_controller.go | 13 +++++++++++++ .../monitorautoscalesetting/zz_controller.go | 13 +++++++++++++ .../monitordatacollectionendpoint/zz_controller.go | 13 +++++++++++++ .../monitordatacollectionrule/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../monitordiagnosticsetting/zz_controller.go | 13 +++++++++++++ .../insights/monitormetricalert/zz_controller.go | 13 +++++++++++++ .../monitorprivatelinkscope/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../monitorscheduledqueryruleslog/zz_controller.go | 13 +++++++++++++ .../iotcentral/application/zz_controller.go | 13 +++++++++++++ .../applicationnetworkruleset/zz_controller.go | 13 +++++++++++++ .../keyvault/accesspolicy/zz_controller.go | 13 +++++++++++++ .../keyvault/certificate/zz_controller.go | 13 +++++++++++++ .../keyvault/certificatecontacts/zz_controller.go | 13 +++++++++++++ .../keyvault/certificateissuer/zz_controller.go | 13 +++++++++++++ internal/controller/keyvault/key/zz_controller.go | 13 +++++++++++++ .../managedhardwaresecuritymodule/zz_controller.go | 13 +++++++++++++ .../keyvault/managedstorageaccount/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../controller/keyvault/secret/zz_controller.go | 13 +++++++++++++ internal/controller/keyvault/vault/zz_controller.go | 13 +++++++++++++ .../attacheddatabaseconfiguration/zz_controller.go | 13 +++++++++++++ internal/controller/kusto/cluster/zz_controller.go | 13 +++++++++++++ .../clustermanagedprivateendpoint/zz_controller.go | 13 +++++++++++++ .../clusterprincipalassignment/zz_controller.go | 13 +++++++++++++ internal/controller/kusto/database/zz_controller.go | 13 +++++++++++++ .../databaseprincipalassignment/zz_controller.go | 13 +++++++++++++ .../kusto/eventgriddataconnection/zz_controller.go | 13 +++++++++++++ .../kusto/eventhubdataconnection/zz_controller.go | 13 +++++++++++++ .../kusto/iothubdataconnection/zz_controller.go | 13 +++++++++++++ .../labservices/labservicelab/zz_controller.go | 13 +++++++++++++ .../labservices/labserviceplan/zz_controller.go | 13 +++++++++++++ .../loadtestservice/loadtest/zz_controller.go | 13 +++++++++++++ .../logic/appactioncustom/zz_controller.go | 13 +++++++++++++ .../controller/logic/appactionhttp/zz_controller.go | 13 +++++++++++++ .../logic/appintegrationaccount/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../appintegrationaccountpartner/zz_controller.go | 13 +++++++++++++ .../appintegrationaccountschema/zz_controller.go | 13 +++++++++++++ .../appintegrationaccountsession/zz_controller.go | 13 +++++++++++++ .../logic/apptriggercustom/zz_controller.go | 13 +++++++++++++ .../logic/apptriggerhttprequest/zz_controller.go | 13 +++++++++++++ .../logic/apptriggerrecurrence/zz_controller.go | 13 +++++++++++++ .../controller/logic/appworkflow/zz_controller.go | 13 +++++++++++++ .../integrationserviceenvironment/zz_controller.go | 13 +++++++++++++ internal/controller/logz/monitor/zz_controller.go | 13 +++++++++++++ .../controller/logz/subaccount/zz_controller.go | 13 +++++++++++++ .../logz/subaccounttagrule/zz_controller.go | 13 +++++++++++++ internal/controller/logz/tagrule/zz_controller.go | 13 +++++++++++++ .../computecluster/zz_controller.go | 13 +++++++++++++ .../computeinstance/zz_controller.go | 13 +++++++++++++ .../synapsespark/zz_controller.go | 13 +++++++++++++ .../workspace/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../maintenanceconfiguration/zz_controller.go | 13 +++++++++++++ .../federatedidentitycredential/zz_controller.go | 13 +++++++++++++ .../userassignedidentity/zz_controller.go | 13 +++++++++++++ .../management/managementgroup/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ internal/controller/maps/account/zz_controller.go | 13 +++++++++++++ internal/controller/maps/creator/zz_controller.go | 13 +++++++++++++ .../marketplaceagreement/zz_controller.go | 13 +++++++++++++ internal/controller/media/asset/zz_controller.go | 13 +++++++++++++ .../controller/media/assetfilter/zz_controller.go | 13 +++++++++++++ .../media/contentkeypolicy/zz_controller.go | 13 +++++++++++++ internal/controller/media/job/zz_controller.go | 13 +++++++++++++ .../controller/media/liveevent/zz_controller.go | 13 +++++++++++++ .../media/liveeventoutput/zz_controller.go | 13 +++++++++++++ .../media/servicesaccount/zz_controller.go | 13 +++++++++++++ .../media/servicesaccountfilter/zz_controller.go | 13 +++++++++++++ .../media/streamingendpoint/zz_controller.go | 13 +++++++++++++ .../media/streaminglocator/zz_controller.go | 13 +++++++++++++ .../media/streamingpolicy/zz_controller.go | 13 +++++++++++++ .../controller/media/transform/zz_controller.go | 13 +++++++++++++ .../spatialanchorsaccount/zz_controller.go | 13 +++++++++++++ internal/controller/netapp/account/zz_controller.go | 13 +++++++++++++ internal/controller/netapp/pool/zz_controller.go | 13 +++++++++++++ .../controller/netapp/snapshot/zz_controller.go | 13 +++++++++++++ .../netapp/snapshotpolicy/zz_controller.go | 13 +++++++++++++ internal/controller/netapp/volume/zz_controller.go | 13 +++++++++++++ .../network/applicationgateway/zz_controller.go | 13 +++++++++++++ .../applicationsecuritygroup/zz_controller.go | 13 +++++++++++++ .../network/connectionmonitor/zz_controller.go | 13 +++++++++++++ .../network/ddosprotectionplan/zz_controller.go | 13 +++++++++++++ .../network/dnsaaaarecord/zz_controller.go | 13 +++++++++++++ .../controller/network/dnsarecord/zz_controller.go | 13 +++++++++++++ .../network/dnscaarecord/zz_controller.go | 13 +++++++++++++ .../network/dnscnamerecord/zz_controller.go | 13 +++++++++++++ .../controller/network/dnsmxrecord/zz_controller.go | 13 +++++++++++++ .../controller/network/dnsnsrecord/zz_controller.go | 13 +++++++++++++ .../network/dnsptrrecord/zz_controller.go | 13 +++++++++++++ .../network/dnssrvrecord/zz_controller.go | 13 +++++++++++++ .../network/dnstxtrecord/zz_controller.go | 13 +++++++++++++ .../controller/network/dnszone/zz_controller.go | 13 +++++++++++++ .../network/expressroutecircuit/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../expressroutecircuitconnection/zz_controller.go | 13 +++++++++++++ .../expressroutecircuitpeering/zz_controller.go | 13 +++++++++++++ .../network/expressrouteconnection/zz_controller.go | 13 +++++++++++++ .../network/expressroutegateway/zz_controller.go | 13 +++++++++++++ .../network/expressrouteport/zz_controller.go | 13 +++++++++++++ .../controller/network/firewall/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../firewallnatrulecollection/zz_controller.go | 13 +++++++++++++ .../firewallnetworkrulecollection/zz_controller.go | 13 +++++++++++++ .../network/firewallpolicy/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../controller/network/frontdoor/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../frontdoorfirewallpolicy/zz_controller.go | 13 +++++++++++++ .../network/frontdoorrulesengine/zz_controller.go | 13 +++++++++++++ .../controller/network/ipgroup/zz_controller.go | 13 +++++++++++++ .../network/loadbalancer/zz_controller.go | 13 +++++++++++++ .../loadbalancerbackendaddresspool/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/loadbalancernatpool/zz_controller.go | 13 +++++++++++++ .../network/loadbalancernatrule/zz_controller.go | 13 +++++++++++++ .../loadbalanceroutboundrule/zz_controller.go | 13 +++++++++++++ .../network/loadbalancerprobe/zz_controller.go | 13 +++++++++++++ .../network/loadbalancerrule/zz_controller.go | 13 +++++++++++++ .../network/localnetworkgateway/zz_controller.go | 13 +++++++++++++ .../controller/network/manager/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/managernetworkgroup/zz_controller.go | 13 +++++++++++++ .../network/managerstaticmember/zz_controller.go | 13 +++++++++++++ .../managersubscriptionconnection/zz_controller.go | 13 +++++++++++++ .../controller/network/natgateway/zz_controller.go | 13 +++++++++++++ .../natgatewaypublicipassociation/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/networkinterface/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/packetcapture/zz_controller.go | 13 +++++++++++++ .../network/pointtositevpngateway/zz_controller.go | 13 +++++++++++++ .../network/privatednsaaaarecord/zz_controller.go | 13 +++++++++++++ .../network/privatednsarecord/zz_controller.go | 13 +++++++++++++ .../network/privatednscnamerecord/zz_controller.go | 13 +++++++++++++ .../network/privatednsmxrecord/zz_controller.go | 13 +++++++++++++ .../network/privatednsptrrecord/zz_controller.go | 13 +++++++++++++ .../network/privatednsresolver/zz_controller.go | 13 +++++++++++++ .../network/privatednssrvrecord/zz_controller.go | 13 +++++++++++++ .../network/privatednstxtrecord/zz_controller.go | 13 +++++++++++++ .../network/privatednszone/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/privateendpoint/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/privatelinkservice/zz_controller.go | 13 +++++++++++++ .../controller/network/profile/zz_controller.go | 13 +++++++++++++ .../controller/network/publicip/zz_controller.go | 13 +++++++++++++ .../network/publicipprefix/zz_controller.go | 13 +++++++++++++ internal/controller/network/route/zz_controller.go | 13 +++++++++++++ .../controller/network/routefilter/zz_controller.go | 13 +++++++++++++ .../controller/network/routemap/zz_controller.go | 13 +++++++++++++ .../controller/network/routeserver/zz_controller.go | 13 +++++++++++++ .../routeserverbgpconnection/zz_controller.go | 13 +++++++++++++ .../controller/network/routetable/zz_controller.go | 13 +++++++++++++ .../network/securitygroup/zz_controller.go | 13 +++++++++++++ .../network/securityrule/zz_controller.go | 13 +++++++++++++ internal/controller/network/subnet/zz_controller.go | 13 +++++++++++++ .../subnetnatgatewayassociation/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../subnetroutetableassociation/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../trafficmanagerazureendpoint/zz_controller.go | 13 +++++++++++++ .../trafficmanagerexternalendpoint/zz_controller.go | 13 +++++++++++++ .../trafficmanagernestedendpoint/zz_controller.go | 13 +++++++++++++ .../network/trafficmanagerprofile/zz_controller.go | 13 +++++++++++++ .../controller/network/virtualhub/zz_controller.go | 13 +++++++++++++ .../network/virtualhubconnection/zz_controller.go | 13 +++++++++++++ .../network/virtualhubip/zz_controller.go | 13 +++++++++++++ .../network/virtualhubroutetable/zz_controller.go | 13 +++++++++++++ .../virtualhubroutetableroute/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/virtualnetwork/zz_controller.go | 13 +++++++++++++ .../network/virtualnetworkgateway/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../network/virtualnetworkpeering/zz_controller.go | 13 +++++++++++++ .../controller/network/virtualwan/zz_controller.go | 13 +++++++++++++ .../controller/network/vpngateway/zz_controller.go | 13 +++++++++++++ .../network/vpngatewayconnection/zz_controller.go | 13 +++++++++++++ .../network/vpnserverconfiguration/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../controller/network/vpnsite/zz_controller.go | 13 +++++++++++++ .../controller/network/watcher/zz_controller.go | 13 +++++++++++++ .../network/watcherflowlog/zz_controller.go | 13 +++++++++++++ .../webapplicationfirewallpolicy/zz_controller.go | 13 +++++++++++++ .../authorizationrule/zz_controller.go | 13 +++++++++++++ .../notificationhub/zz_controller.go | 13 +++++++++++++ .../notificationhubnamespace/zz_controller.go | 13 +++++++++++++ .../loganalyticsdataexportrule/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../loganalyticslinkedservice/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../loganalyticsquerypack/zz_controller.go | 13 +++++++++++++ .../loganalyticsquerypackquery/zz_controller.go | 13 +++++++++++++ .../loganalyticssavedsearch/zz_controller.go | 13 +++++++++++++ .../operationalinsights/workspace/zz_controller.go | 13 +++++++++++++ .../loganalyticssolution/zz_controller.go | 13 +++++++++++++ .../orbital/contactprofile/zz_controller.go | 13 +++++++++++++ .../controller/orbital/spacecraft/zz_controller.go | 13 +++++++++++++ .../resourcepolicyremediation/zz_controller.go | 13 +++++++++++++ .../subscriptionpolicyremediation/zz_controller.go | 13 +++++++++++++ .../controller/portal/dashboard/zz_controller.go | 13 +++++++++++++ .../powerbiembedded/zz_controller.go | 13 +++++++++++++ .../controller/purview/account/zz_controller.go | 13 +++++++++++++ .../backupcontainerstorageaccount/zz_controller.go | 13 +++++++++++++ .../backuppolicyfileshare/zz_controller.go | 13 +++++++++++++ .../backuppolicyvm/zz_controller.go | 13 +++++++++++++ .../backuppolicyvmworkload/zz_controller.go | 13 +++++++++++++ .../backupprotectedfileshare/zz_controller.go | 13 +++++++++++++ .../backupprotectedvm/zz_controller.go | 13 +++++++++++++ .../siterecoveryfabric/zz_controller.go | 13 +++++++++++++ .../siterecoverynetworkmapping/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../siterecoveryreplicationpolicy/zz_controller.go | 13 +++++++++++++ .../recoveryservices/vault/zz_controller.go | 13 +++++++++++++ .../relay/eventrelaynamespace/zz_controller.go | 13 +++++++++++++ .../relay/hybridconnection/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../namespaceauthorizationrule/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../subscriptiontemplatedeployment/zz_controller.go | 13 +++++++++++++ internal/controller/search/service/zz_controller.go | 13 +++++++++++++ .../sharedprivatelinkservice/zz_controller.go | 13 +++++++++++++ .../advancedthreatprotection/zz_controller.go | 13 +++++++++++++ .../iotsecuritydevicegroup/zz_controller.go | 13 +++++++++++++ .../security/iotsecuritysolution/zz_controller.go | 13 +++++++++++++ .../securitycenterassessment/zz_controller.go | 13 +++++++++++++ .../securitycenterassessmentpolicy/zz_controller.go | 13 +++++++++++++ .../securitycenterautoprovisioning/zz_controller.go | 13 +++++++++++++ .../security/securitycentercontact/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../security/securitycentersetting/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../securitycenterworkspace/zz_controller.go | 13 +++++++++++++ .../sentinelalertrulefusion/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../sentinelautomationrule/zz_controller.go | 13 +++++++++++++ .../sentineldataconnectoriot/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../sentinelwatchlist/zz_controller.go | 13 +++++++++++++ .../namespaceauthorizationrule/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../namespacenetworkruleset/zz_controller.go | 13 +++++++++++++ .../controller/servicebus/queue/zz_controller.go | 13 +++++++++++++ .../queueauthorizationrule/zz_controller.go | 13 +++++++++++++ .../servicebus/servicebusnamespace/zz_controller.go | 13 +++++++++++++ .../servicebus/subscription/zz_controller.go | 13 +++++++++++++ .../servicebus/subscriptionrule/zz_controller.go | 13 +++++++++++++ .../controller/servicebus/topic/zz_controller.go | 13 +++++++++++++ .../topicauthorizationrule/zz_controller.go | 13 +++++++++++++ .../servicefabric/cluster/zz_controller.go | 13 +++++++++++++ .../servicefabric/managedcluster/zz_controller.go | 13 +++++++++++++ .../springcloudconnection/zz_controller.go | 13 +++++++++++++ .../signalrservice/networkacl/zz_controller.go | 13 +++++++++++++ .../signalrservice/service/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../signalrservice/webpubsub/zz_controller.go | 13 +++++++++++++ .../signalrservice/webpubsubhub/zz_controller.go | 13 +++++++++++++ .../webpubsubnetworkacl/zz_controller.go | 13 +++++++++++++ .../managedapplicationdefinition/zz_controller.go | 13 +++++++++++++ .../cloudapplicationliveview/zz_controller.go | 13 +++++++++++++ .../controller/sql/mssqldatabase/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../sql/mssqlelasticpool/zz_controller.go | 13 +++++++++++++ .../sql/mssqlfailovergroup/zz_controller.go | 13 +++++++++++++ .../sql/mssqlfirewallrule/zz_controller.go | 13 +++++++++++++ .../controller/sql/mssqljobagent/zz_controller.go | 13 +++++++++++++ .../sql/mssqljobcredential/zz_controller.go | 13 +++++++++++++ .../sql/mssqlmanageddatabase/zz_controller.go | 13 +++++++++++++ .../sql/mssqlmanagedinstance/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../sql/mssqloutboundfirewallrule/zz_controller.go | 13 +++++++++++++ .../controller/sql/mssqlserver/zz_controller.go | 13 +++++++++++++ .../sql/mssqlserverdnsalias/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../mssqlserversecurityalertpolicy/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../sql/mssqlvirtualnetworkrule/zz_controller.go | 13 +++++++++++++ .../controller/storage/account/zz_controller.go | 13 +++++++++++++ .../storage/accountlocaluser/zz_controller.go | 13 +++++++++++++ .../storage/accountnetworkrules/zz_controller.go | 13 +++++++++++++ internal/controller/storage/blob/zz_controller.go | 13 +++++++++++++ .../storage/blobinventorypolicy/zz_controller.go | 13 +++++++++++++ .../controller/storage/container/zz_controller.go | 13 +++++++++++++ .../storage/datalakegen2filesystem/zz_controller.go | 13 +++++++++++++ .../storage/datalakegen2path/zz_controller.go | 13 +++++++++++++ .../storage/encryptionscope/zz_controller.go | 13 +++++++++++++ .../storage/managementpolicy/zz_controller.go | 13 +++++++++++++ .../storage/objectreplication/zz_controller.go | 13 +++++++++++++ internal/controller/storage/queue/zz_controller.go | 13 +++++++++++++ internal/controller/storage/share/zz_controller.go | 13 +++++++++++++ .../storage/sharedirectory/zz_controller.go | 13 +++++++++++++ internal/controller/storage/table/zz_controller.go | 13 +++++++++++++ .../controller/storage/tableentity/zz_controller.go | 13 +++++++++++++ .../storagecache/hpccache/zz_controller.go | 13 +++++++++++++ .../hpccacheaccesspolicy/zz_controller.go | 13 +++++++++++++ .../hpccacheblobnfstarget/zz_controller.go | 13 +++++++++++++ .../hpccacheblobtarget/zz_controller.go | 13 +++++++++++++ .../storagecache/hpccachenfstarget/zz_controller.go | 13 +++++++++++++ .../storagepool/diskpool/zz_controller.go | 13 +++++++++++++ .../storagesync/storagesync/zz_controller.go | 13 +++++++++++++ .../streamanalytics/cluster/zz_controller.go | 13 +++++++++++++ .../functionjavascriptuda/zz_controller.go | 13 +++++++++++++ .../controller/streamanalytics/job/zz_controller.go | 13 +++++++++++++ .../managedprivateendpoint/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputblob/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputeventhub/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputfunction/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputmssql/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputpowerbi/zz_controller.go | 13 +++++++++++++ .../outputservicebusqueue/zz_controller.go | 13 +++++++++++++ .../outputservicebustopic/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputsynapse/zz_controller.go | 13 +++++++++++++ .../streamanalytics/outputtable/zz_controller.go | 13 +++++++++++++ .../referenceinputblob/zz_controller.go | 13 +++++++++++++ .../referenceinputmssql/zz_controller.go | 13 +++++++++++++ .../streaminputblob/zz_controller.go | 13 +++++++++++++ .../streaminputeventhub/zz_controller.go | 13 +++++++++++++ .../streaminputiothub/zz_controller.go | 13 +++++++++++++ .../synapse/firewallrule/zz_controller.go | 13 +++++++++++++ .../integrationruntimeazure/zz_controller.go | 13 +++++++++++++ .../integrationruntimeselfhosted/zz_controller.go | 13 +++++++++++++ .../synapse/linkedservice/zz_controller.go | 13 +++++++++++++ .../synapse/managedprivateendpoint/zz_controller.go | 13 +++++++++++++ .../synapse/privatelinkhub/zz_controller.go | 13 +++++++++++++ .../synapse/roleassignment/zz_controller.go | 13 +++++++++++++ .../controller/synapse/sparkpool/zz_controller.go | 13 +++++++++++++ .../controller/synapse/sqlpool/zz_controller.go | 13 +++++++++++++ .../sqlpoolextendedauditingpolicy/zz_controller.go | 13 +++++++++++++ .../sqlpoolsecurityalertpolicy/zz_controller.go | 13 +++++++++++++ .../sqlpoolworkloadclassifier/zz_controller.go | 13 +++++++++++++ .../synapse/sqlpoolworkloadgroup/zz_controller.go | 13 +++++++++++++ .../controller/synapse/workspace/zz_controller.go | 13 +++++++++++++ .../synapse/workspaceaadadmin/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../workspacesecurityalertpolicy/zz_controller.go | 13 +++++++++++++ .../synapse/workspacesqlaadadmin/zz_controller.go | 13 +++++++++++++ .../zz_controller.go | 13 +++++++++++++ .../eventsourceeventhub/zz_controller.go | 13 +++++++++++++ .../eventsourceiothub/zz_controller.go | 13 +++++++++++++ .../gen2environment/zz_controller.go | 13 +++++++++++++ .../referencedataset/zz_controller.go | 13 +++++++++++++ .../standardenvironment/zz_controller.go | 13 +++++++++++++ .../controller/web/appactiveslot/zz_controller.go | 13 +++++++++++++ .../web/apphybridconnection/zz_controller.go | 13 +++++++++++++ .../controller/web/appserviceplan/zz_controller.go | 13 +++++++++++++ .../controller/web/functionapp/zz_controller.go | 13 +++++++++++++ .../web/functionappactiveslot/zz_controller.go | 13 +++++++++++++ .../web/functionappfunction/zz_controller.go | 13 +++++++++++++ .../functionapphybridconnection/zz_controller.go | 13 +++++++++++++ .../controller/web/functionappslot/zz_controller.go | 13 +++++++++++++ .../web/linuxfunctionapp/zz_controller.go | 13 +++++++++++++ .../web/linuxfunctionappslot/zz_controller.go | 13 +++++++++++++ .../controller/web/linuxwebapp/zz_controller.go | 13 +++++++++++++ .../controller/web/linuxwebappslot/zz_controller.go | 13 +++++++++++++ .../controller/web/serviceplan/zz_controller.go | 13 +++++++++++++ .../web/sourcecontroltoken/zz_controller.go | 13 +++++++++++++ internal/controller/web/staticsite/zz_controller.go | 13 +++++++++++++ .../web/windowsfunctionapp/zz_controller.go | 13 +++++++++++++ .../web/windowsfunctionappslot/zz_controller.go | 13 +++++++++++++ .../controller/web/windowswebapp/zz_controller.go | 13 +++++++++++++ .../web/windowswebappslot/zz_controller.go | 13 +++++++++++++ 724 files changed, 9379 insertions(+), 6 deletions(-) diff --git a/config/registry.go b/config/registry.go index 8cd1b8ed9..6f43c191b 100644 --- a/config/registry.go +++ b/config/registry.go @@ -197,9 +197,9 @@ func bumpVersionsWithEmbeddedLists(pc *ujconfig.Provider) { // downgrades. r.SetCRDStorageVersion("v1beta1") r.Conversions = []conversion.Conversion{ - 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)} + conversion.NewIdentityConversionExpandPaths(conversion.AllVersions, conversion.AllVersions, conversion.DefaultPathPrefixes(), r.CRDListConversionPaths()...), + conversion.NewSingletonListConversion("v1beta1", "v1beta2", conversion.DefaultPathPrefixes(), r.CRDListConversionPaths(), conversion.ToEmbeddedObject), + conversion.NewSingletonListConversion("v1beta2", "v1beta1", conversion.DefaultPathPrefixes(), r.CRDListConversionPaths(), conversion.ToSingletonList)} pc.Resources[name] = r } } diff --git a/go.mod b/go.mod index 1748dbd85..2247464f8 100644 --- a/go.mod +++ b/go.mod @@ -169,4 +169,4 @@ replace github.com/hashicorp/terraform-provider-azurerm => 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-20240422072143-9a463d567f9c +replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a diff --git a/go.sum b/go.sum index 847bc8bfa..90a45ec83 100644 --- a/go.sum +++ b/go.sum @@ -356,8 +356,8 @@ github.com/tombuildsstuff/giovanni v0.20.0 h1:IM/I/iNWMXnPYwcSq8uxV7TKDlv7Nejq0b github.com/tombuildsstuff/giovanni v0.20.0/go.mod h1:66KVLYma2whJhEdxPSPL3GQHkulhK+C5CluKfHGfPF4= github.com/tombuildsstuff/kermit v0.20240122.1123108 h1:icQaxsv/ANv/KC4Sr0V1trrWA/XIL+3QAVBDpiSTgj8= github.com/tombuildsstuff/kermit v0.20240122.1123108/go.mod h1:T3YBVFhRV4qA7SbnRaNE6eapIMpKDA9rG/V7Ocsjlno= -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/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a h1:KNFeHy6dvZvY8ZS+OqYI216nJamQNh5Kem1h3KM0pXQ= +github.com/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= github.com/upbound/terraform-provider-azurerm v0.0.0-20240311113236-25a51734d3da h1:Rj/LhOVcK8IOSIBYk7L6LZpuOHsXkkit+JrV4nNmi9o= github.com/upbound/terraform-provider-azurerm v0.0.0-20240311113236-25a51734d3da/go.mod h1:GCUoUr4wIRHz+ZYmDI3Y1oE0M64rqJcr3oY60wwJdVc= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/internal/controller/alertsmanagement/monitoractionruleactiongroup/zz_controller.go b/internal/controller/alertsmanagement/monitoractionruleactiongroup/zz_controller.go index 41443cbbb..2f3a87dad 100755 --- a/internal/controller/alertsmanagement/monitoractionruleactiongroup/zz_controller.go +++ b/internal/controller/alertsmanagement/monitoractionruleactiongroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorActionRuleActionGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorActionRuleActionGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorActionRuleActionGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorActionRuleActionGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/alertsmanagement/monitoractionrulesuppression/zz_controller.go b/internal/controller/alertsmanagement/monitoractionrulesuppression/zz_controller.go index 6bfe45b8d..bda3a8dd7 100755 --- a/internal/controller/alertsmanagement/monitoractionrulesuppression/zz_controller.go +++ b/internal/controller/alertsmanagement/monitoractionrulesuppression/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorActionRuleSuppression // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorActionRuleSuppressionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorActionRuleSuppressionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorActionRuleSuppression_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/alertsmanagement/monitoralertprocessingruleactiongroup/zz_controller.go b/internal/controller/alertsmanagement/monitoralertprocessingruleactiongroup/zz_controller.go index d2612a465..f7bc84338 100755 --- a/internal/controller/alertsmanagement/monitoralertprocessingruleactiongroup/zz_controller.go +++ b/internal/controller/alertsmanagement/monitoralertprocessingruleactiongroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorAlertProcessingRuleActionGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorAlertProcessingRuleActionGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorAlertProcessingRuleActionGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorAlertProcessingRuleActionGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/alertsmanagement/monitoralertprocessingrulesuppression/zz_controller.go b/internal/controller/alertsmanagement/monitoralertprocessingrulesuppression/zz_controller.go index e6dcd1ab8..d5eeb3c6a 100755 --- a/internal/controller/alertsmanagement/monitoralertprocessingrulesuppression/zz_controller.go +++ b/internal/controller/alertsmanagement/monitoralertprocessingrulesuppression/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorAlertProcessingRuleSuppression // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorAlertProcessingRuleSuppressionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorAlertProcessingRuleSuppressionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorAlertProcessingRuleSuppression_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/alertsmanagement/monitorsmartdetectoralertrule/zz_controller.go b/internal/controller/alertsmanagement/monitorsmartdetectoralertrule/zz_controller.go index 89a9968d7..05f6fd8f6 100755 --- a/internal/controller/alertsmanagement/monitorsmartdetectoralertrule/zz_controller.go +++ b/internal/controller/alertsmanagement/monitorsmartdetectoralertrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorSmartDetectorAlertRule // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorSmartDetectorAlertRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorSmartDetectorAlertRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorSmartDetectorAlertRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/analysisservices/server/zz_controller.go b/internal/controller/analysisservices/server/zz_controller.go index c680f0b7c..753e935c6 100755 --- a/internal/controller/analysisservices/server/zz_controller.go +++ b/internal/controller/analysisservices/server/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Server // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/api/zz_controller.go b/internal/controller/apimanagement/api/zz_controller.go index 4afd5b440..bf6b04bd9 100755 --- a/internal/controller/apimanagement/api/zz_controller.go +++ b/internal/controller/apimanagement/api/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.API // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.APIList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.APIList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.API_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apidiagnostic/zz_controller.go b/internal/controller/apimanagement/apidiagnostic/zz_controller.go index 45251fbf9..728ffe52f 100755 --- a/internal/controller/apimanagement/apidiagnostic/zz_controller.go +++ b/internal/controller/apimanagement/apidiagnostic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.APIDiagnostic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.APIDiagnosticList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.APIDiagnosticList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.APIDiagnostic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apioperation/zz_controller.go b/internal/controller/apimanagement/apioperation/zz_controller.go index f45bd2b89..95ac0116d 100755 --- a/internal/controller/apimanagement/apioperation/zz_controller.go +++ b/internal/controller/apimanagement/apioperation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.APIOperation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.APIOperationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.APIOperationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.APIOperation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apioperationpolicy/zz_controller.go b/internal/controller/apimanagement/apioperationpolicy/zz_controller.go index 304320c55..8964bb647 100755 --- a/internal/controller/apimanagement/apioperationpolicy/zz_controller.go +++ b/internal/controller/apimanagement/apioperationpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APIOperationPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APIOperationPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APIOperationPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIOperationPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apioperationtag/zz_controller.go b/internal/controller/apimanagement/apioperationtag/zz_controller.go index 98cae6534..9e3d9858d 100755 --- a/internal/controller/apimanagement/apioperationtag/zz_controller.go +++ b/internal/controller/apimanagement/apioperationtag/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APIOperationTag // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APIOperationTagList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APIOperationTagList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIOperationTag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apipolicy/zz_controller.go b/internal/controller/apimanagement/apipolicy/zz_controller.go index 9adc9abd2..28a3baa0f 100755 --- a/internal/controller/apimanagement/apipolicy/zz_controller.go +++ b/internal/controller/apimanagement/apipolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APIPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APIPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APIPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apirelease/zz_controller.go b/internal/controller/apimanagement/apirelease/zz_controller.go index bc63dccb7..1483dbf8c 100755 --- a/internal/controller/apimanagement/apirelease/zz_controller.go +++ b/internal/controller/apimanagement/apirelease/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APIRelease // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APIReleaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APIReleaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIRelease_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apischema/zz_controller.go b/internal/controller/apimanagement/apischema/zz_controller.go index 299db2627..b5c135285 100755 --- a/internal/controller/apimanagement/apischema/zz_controller.go +++ b/internal/controller/apimanagement/apischema/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APISchema // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APISchemaList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APISchemaList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APISchema_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apitag/zz_controller.go b/internal/controller/apimanagement/apitag/zz_controller.go index 67cd02186..f6746c474 100755 --- a/internal/controller/apimanagement/apitag/zz_controller.go +++ b/internal/controller/apimanagement/apitag/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APITag // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APITagList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APITagList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APITag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/apiversionset/zz_controller.go b/internal/controller/apimanagement/apiversionset/zz_controller.go index 1d24e4ef2..c608fbf62 100755 --- a/internal/controller/apimanagement/apiversionset/zz_controller.go +++ b/internal/controller/apimanagement/apiversionset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.APIVersionSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.APIVersionSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.APIVersionSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIVersionSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/authorizationserver/zz_controller.go b/internal/controller/apimanagement/authorizationserver/zz_controller.go index 2a99a4656..7e11a7384 100755 --- a/internal/controller/apimanagement/authorizationserver/zz_controller.go +++ b/internal/controller/apimanagement/authorizationserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AuthorizationServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AuthorizationServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AuthorizationServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AuthorizationServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/backend/zz_controller.go b/internal/controller/apimanagement/backend/zz_controller.go index 1d5560b7f..6a00e417c 100755 --- a/internal/controller/apimanagement/backend/zz_controller.go +++ b/internal/controller/apimanagement/backend/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Backend // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackendList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackendList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Backend_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/certificate/zz_controller.go b/internal/controller/apimanagement/certificate/zz_controller.go index 6a4c38c5c..66b3e3153 100755 --- a/internal/controller/apimanagement/certificate/zz_controller.go +++ b/internal/controller/apimanagement/certificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Certificate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/customdomain/zz_controller.go b/internal/controller/apimanagement/customdomain/zz_controller.go index f176b29b9..d98939236 100755 --- a/internal/controller/apimanagement/customdomain/zz_controller.go +++ b/internal/controller/apimanagement/customdomain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CustomDomain // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CustomDomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CustomDomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/diagnostic/zz_controller.go b/internal/controller/apimanagement/diagnostic/zz_controller.go index 55157fe44..d9be0ce9d 100755 --- a/internal/controller/apimanagement/diagnostic/zz_controller.go +++ b/internal/controller/apimanagement/diagnostic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Diagnostic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DiagnosticList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DiagnosticList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Diagnostic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/emailtemplate/zz_controller.go b/internal/controller/apimanagement/emailtemplate/zz_controller.go index 66fb4498c..3b0e221c5 100755 --- a/internal/controller/apimanagement/emailtemplate/zz_controller.go +++ b/internal/controller/apimanagement/emailtemplate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EmailTemplate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EmailTemplateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EmailTemplateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EmailTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/gateway/zz_controller.go b/internal/controller/apimanagement/gateway/zz_controller.go index 2cd51dc23..8bde5ac45 100755 --- a/internal/controller/apimanagement/gateway/zz_controller.go +++ b/internal/controller/apimanagement/gateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Gateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.GatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.GatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Gateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/gatewayapi/zz_controller.go b/internal/controller/apimanagement/gatewayapi/zz_controller.go index f91d9fa11..628b2e6fe 100755 --- a/internal/controller/apimanagement/gatewayapi/zz_controller.go +++ b/internal/controller/apimanagement/gatewayapi/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.GatewayAPI // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.GatewayAPIList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.GatewayAPIList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GatewayAPI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/globalschema/zz_controller.go b/internal/controller/apimanagement/globalschema/zz_controller.go index db0ada7ea..7b6010867 100755 --- a/internal/controller/apimanagement/globalschema/zz_controller.go +++ b/internal/controller/apimanagement/globalschema/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.GlobalSchema // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.GlobalSchemaList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.GlobalSchemaList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalSchema_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/identityprovideraad/zz_controller.go b/internal/controller/apimanagement/identityprovideraad/zz_controller.go index 2bcac81fa..f614f12db 100755 --- a/internal/controller/apimanagement/identityprovideraad/zz_controller.go +++ b/internal/controller/apimanagement/identityprovideraad/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IdentityProviderAAD // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IdentityProviderAADList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IdentityProviderAADList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderAAD_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/identityproviderfacebook/zz_controller.go b/internal/controller/apimanagement/identityproviderfacebook/zz_controller.go index 31c14db71..6ea4b6bdb 100755 --- a/internal/controller/apimanagement/identityproviderfacebook/zz_controller.go +++ b/internal/controller/apimanagement/identityproviderfacebook/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IdentityProviderFacebook // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IdentityProviderFacebookList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IdentityProviderFacebookList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderFacebook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/identityprovidergoogle/zz_controller.go b/internal/controller/apimanagement/identityprovidergoogle/zz_controller.go index ceadbfbb7..f49e53f9e 100755 --- a/internal/controller/apimanagement/identityprovidergoogle/zz_controller.go +++ b/internal/controller/apimanagement/identityprovidergoogle/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IdentityProviderGoogle // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IdentityProviderGoogleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IdentityProviderGoogleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderGoogle_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/identityprovidermicrosoft/zz_controller.go b/internal/controller/apimanagement/identityprovidermicrosoft/zz_controller.go index 7eed266ca..cc7b57068 100755 --- a/internal/controller/apimanagement/identityprovidermicrosoft/zz_controller.go +++ b/internal/controller/apimanagement/identityprovidermicrosoft/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IdentityProviderMicrosoft // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IdentityProviderMicrosoftList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IdentityProviderMicrosoftList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderMicrosoft_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/identityprovidertwitter/zz_controller.go b/internal/controller/apimanagement/identityprovidertwitter/zz_controller.go index f185f05a2..7fbc1cad9 100755 --- a/internal/controller/apimanagement/identityprovidertwitter/zz_controller.go +++ b/internal/controller/apimanagement/identityprovidertwitter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IdentityProviderTwitter // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IdentityProviderTwitterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IdentityProviderTwitterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderTwitter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/logger/zz_controller.go b/internal/controller/apimanagement/logger/zz_controller.go index 7bc2b5cbe..e4ff59559 100755 --- a/internal/controller/apimanagement/logger/zz_controller.go +++ b/internal/controller/apimanagement/logger/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Logger // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LoggerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LoggerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Logger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/management/zz_controller.go b/internal/controller/apimanagement/management/zz_controller.go index ec1721b49..53309108d 100755 --- a/internal/controller/apimanagement/management/zz_controller.go +++ b/internal/controller/apimanagement/management/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Management // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagementList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagementList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Management_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/namedvalue/zz_controller.go b/internal/controller/apimanagement/namedvalue/zz_controller.go index 132cd9bb3..5192dbc36 100755 --- a/internal/controller/apimanagement/namedvalue/zz_controller.go +++ b/internal/controller/apimanagement/namedvalue/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.NamedValue // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.NamedValueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.NamedValueList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.NamedValue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/notificationrecipientemail/zz_controller.go b/internal/controller/apimanagement/notificationrecipientemail/zz_controller.go index 2e51761a8..ff8d465bc 100755 --- a/internal/controller/apimanagement/notificationrecipientemail/zz_controller.go +++ b/internal/controller/apimanagement/notificationrecipientemail/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NotificationRecipientEmail // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NotificationRecipientEmailList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NotificationRecipientEmailList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotificationRecipientEmail_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/notificationrecipientuser/zz_controller.go b/internal/controller/apimanagement/notificationrecipientuser/zz_controller.go index fd3b4ab4c..d91031f1e 100755 --- a/internal/controller/apimanagement/notificationrecipientuser/zz_controller.go +++ b/internal/controller/apimanagement/notificationrecipientuser/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NotificationRecipientUser // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NotificationRecipientUserList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NotificationRecipientUserList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotificationRecipientUser_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/openidconnectprovider/zz_controller.go b/internal/controller/apimanagement/openidconnectprovider/zz_controller.go index 6dbdc8327..922c12805 100755 --- a/internal/controller/apimanagement/openidconnectprovider/zz_controller.go +++ b/internal/controller/apimanagement/openidconnectprovider/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OpenIDConnectProvider // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OpenIDConnectProviderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OpenIDConnectProviderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OpenIDConnectProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/policy/zz_controller.go b/internal/controller/apimanagement/policy/zz_controller.go index 520f27ced..978f58dad 100755 --- a/internal/controller/apimanagement/policy/zz_controller.go +++ b/internal/controller/apimanagement/policy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Policy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/product/zz_controller.go b/internal/controller/apimanagement/product/zz_controller.go index 2b4214934..a329e23ce 100755 --- a/internal/controller/apimanagement/product/zz_controller.go +++ b/internal/controller/apimanagement/product/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Product // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProductList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProductList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Product_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/productapi/zz_controller.go b/internal/controller/apimanagement/productapi/zz_controller.go index 4e15abaa5..f24b5b10b 100755 --- a/internal/controller/apimanagement/productapi/zz_controller.go +++ b/internal/controller/apimanagement/productapi/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ProductAPI // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProductAPIList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProductAPIList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProductAPI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/productpolicy/zz_controller.go b/internal/controller/apimanagement/productpolicy/zz_controller.go index 44b0b7365..c6805ed95 100755 --- a/internal/controller/apimanagement/productpolicy/zz_controller.go +++ b/internal/controller/apimanagement/productpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ProductPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProductPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProductPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProductPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/producttag/zz_controller.go b/internal/controller/apimanagement/producttag/zz_controller.go index a05bd18e7..ca5c07aef 100755 --- a/internal/controller/apimanagement/producttag/zz_controller.go +++ b/internal/controller/apimanagement/producttag/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ProductTag // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProductTagList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProductTagList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProductTag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/rediscache/zz_controller.go b/internal/controller/apimanagement/rediscache/zz_controller.go index 0f7388bb6..11bdfee6b 100755 --- a/internal/controller/apimanagement/rediscache/zz_controller.go +++ b/internal/controller/apimanagement/rediscache/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RedisCache // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RedisCacheList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RedisCacheList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedisCache_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/subscription/zz_controller.go b/internal/controller/apimanagement/subscription/zz_controller.go index 8f84ffd5e..7f8026b3b 100755 --- a/internal/controller/apimanagement/subscription/zz_controller.go +++ b/internal/controller/apimanagement/subscription/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Subscription // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubscriptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubscriptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Subscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/tag/zz_controller.go b/internal/controller/apimanagement/tag/zz_controller.go index fe36e11f1..499ede8ab 100755 --- a/internal/controller/apimanagement/tag/zz_controller.go +++ b/internal/controller/apimanagement/tag/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Tag // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TagList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TagList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apimanagement/user/zz_controller.go b/internal/controller/apimanagement/user/zz_controller.go index c4c14128c..3188f1eb0 100755 --- a/internal/controller/apimanagement/user/zz_controller.go +++ b/internal/controller/apimanagement/user/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.User // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.UserList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.UserList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfiguration/configuration/zz_controller.go b/internal/controller/appconfiguration/configuration/zz_controller.go index 1b0e62a78..8ad1b24cd 100755 --- a/internal/controller/appconfiguration/configuration/zz_controller.go +++ b/internal/controller/appconfiguration/configuration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Configuration // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudaccelerator/zz_controller.go b/internal/controller/appplatform/springcloudaccelerator/zz_controller.go index 5fb66ca93..290b7bba6 100755 --- a/internal/controller/appplatform/springcloudaccelerator/zz_controller.go +++ b/internal/controller/appplatform/springcloudaccelerator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudAccelerator // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudAcceleratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudAcceleratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudAccelerator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudactivedeployment/zz_controller.go b/internal/controller/appplatform/springcloudactivedeployment/zz_controller.go index 0509f9bd5..a13aec7ea 100755 --- a/internal/controller/appplatform/springcloudactivedeployment/zz_controller.go +++ b/internal/controller/appplatform/springcloudactivedeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudActiveDeployment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudActiveDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudActiveDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudActiveDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudapiportal/zz_controller.go b/internal/controller/appplatform/springcloudapiportal/zz_controller.go index 7892fe168..3ef7876ef 100755 --- a/internal/controller/appplatform/springcloudapiportal/zz_controller.go +++ b/internal/controller/appplatform/springcloudapiportal/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudAPIPortal // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudAPIPortalList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudAPIPortalList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudAPIPortal_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudapiportalcustomdomain/zz_controller.go b/internal/controller/appplatform/springcloudapiportalcustomdomain/zz_controller.go index dc5c5ed0a..f42536c5a 100755 --- a/internal/controller/appplatform/springcloudapiportalcustomdomain/zz_controller.go +++ b/internal/controller/appplatform/springcloudapiportalcustomdomain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudAPIPortalCustomDomain // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudAPIPortalCustomDomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudAPIPortalCustomDomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudAPIPortalCustomDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudapp/zz_controller.go b/internal/controller/appplatform/springcloudapp/zz_controller.go index 78a8baeb5..3cda111a8 100755 --- a/internal/controller/appplatform/springcloudapp/zz_controller.go +++ b/internal/controller/appplatform/springcloudapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudappcosmosdbassociation/zz_controller.go b/internal/controller/appplatform/springcloudappcosmosdbassociation/zz_controller.go index 5a93e3917..8a0db18b7 100755 --- a/internal/controller/appplatform/springcloudappcosmosdbassociation/zz_controller.go +++ b/internal/controller/appplatform/springcloudappcosmosdbassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudAppCosmosDBAssociation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudAppCosmosDBAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudAppCosmosDBAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudAppCosmosDBAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudappmysqlassociation/zz_controller.go b/internal/controller/appplatform/springcloudappmysqlassociation/zz_controller.go index 97c31f98a..aed60d6ba 100755 --- a/internal/controller/appplatform/springcloudappmysqlassociation/zz_controller.go +++ b/internal/controller/appplatform/springcloudappmysqlassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudAppMySQLAssociation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudAppMySQLAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudAppMySQLAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudAppMySQLAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudappredisassociation/zz_controller.go b/internal/controller/appplatform/springcloudappredisassociation/zz_controller.go index 4c3ecf0da..5a02e57a8 100755 --- a/internal/controller/appplatform/springcloudappredisassociation/zz_controller.go +++ b/internal/controller/appplatform/springcloudappredisassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudAppRedisAssociation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudAppRedisAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudAppRedisAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudAppRedisAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudbuilddeployment/zz_controller.go b/internal/controller/appplatform/springcloudbuilddeployment/zz_controller.go index b7f8e4f2a..87fb5a072 100755 --- a/internal/controller/appplatform/springcloudbuilddeployment/zz_controller.go +++ b/internal/controller/appplatform/springcloudbuilddeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudBuildDeployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudBuildDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudBuildDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudBuildDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudbuilder/zz_controller.go b/internal/controller/appplatform/springcloudbuilder/zz_controller.go index ef21a91d5..c03aeff16 100755 --- a/internal/controller/appplatform/springcloudbuilder/zz_controller.go +++ b/internal/controller/appplatform/springcloudbuilder/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudBuilder // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudBuilderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudBuilderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudBuilder_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudbuildpackbinding/zz_controller.go b/internal/controller/appplatform/springcloudbuildpackbinding/zz_controller.go index 890559115..43a99cb55 100755 --- a/internal/controller/appplatform/springcloudbuildpackbinding/zz_controller.go +++ b/internal/controller/appplatform/springcloudbuildpackbinding/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudBuildPackBinding // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudBuildPackBindingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudBuildPackBindingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudBuildPackBinding_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudcertificate/zz_controller.go b/internal/controller/appplatform/springcloudcertificate/zz_controller.go index df05c56d6..3abddc5ec 100755 --- a/internal/controller/appplatform/springcloudcertificate/zz_controller.go +++ b/internal/controller/appplatform/springcloudcertificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudCertificate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudCertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudCertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudconfigurationservice/zz_controller.go b/internal/controller/appplatform/springcloudconfigurationservice/zz_controller.go index 198766422..313580042 100755 --- a/internal/controller/appplatform/springcloudconfigurationservice/zz_controller.go +++ b/internal/controller/appplatform/springcloudconfigurationservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudConfigurationService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudConfigurationServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudConfigurationServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudConfigurationService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudcontainerdeployment/zz_controller.go b/internal/controller/appplatform/springcloudcontainerdeployment/zz_controller.go index d1ca1163c..cd67fefa9 100755 --- a/internal/controller/appplatform/springcloudcontainerdeployment/zz_controller.go +++ b/internal/controller/appplatform/springcloudcontainerdeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudContainerDeployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudContainerDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudContainerDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudContainerDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudcustomdomain/zz_controller.go b/internal/controller/appplatform/springcloudcustomdomain/zz_controller.go index ea70f9688..927bb3be5 100755 --- a/internal/controller/appplatform/springcloudcustomdomain/zz_controller.go +++ b/internal/controller/appplatform/springcloudcustomdomain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudCustomDomain // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudCustomDomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudCustomDomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudCustomDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudcustomizedaccelerator/zz_controller.go b/internal/controller/appplatform/springcloudcustomizedaccelerator/zz_controller.go index 0e3a6fc0a..be8abe833 100755 --- a/internal/controller/appplatform/springcloudcustomizedaccelerator/zz_controller.go +++ b/internal/controller/appplatform/springcloudcustomizedaccelerator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudCustomizedAccelerator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudCustomizedAcceleratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudCustomizedAcceleratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudCustomizedAccelerator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springclouddevtoolportal/zz_controller.go b/internal/controller/appplatform/springclouddevtoolportal/zz_controller.go index 53753d285..f77e44d81 100755 --- a/internal/controller/appplatform/springclouddevtoolportal/zz_controller.go +++ b/internal/controller/appplatform/springclouddevtoolportal/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudDevToolPortal // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudDevToolPortalList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudDevToolPortalList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudDevToolPortal_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudgateway/zz_controller.go b/internal/controller/appplatform/springcloudgateway/zz_controller.go index bd27eb18a..e42b352f7 100755 --- a/internal/controller/appplatform/springcloudgateway/zz_controller.go +++ b/internal/controller/appplatform/springcloudgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudgatewaycustomdomain/zz_controller.go b/internal/controller/appplatform/springcloudgatewaycustomdomain/zz_controller.go index 55fdf86cc..eb2267a61 100755 --- a/internal/controller/appplatform/springcloudgatewaycustomdomain/zz_controller.go +++ b/internal/controller/appplatform/springcloudgatewaycustomdomain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudGatewayCustomDomain // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudGatewayCustomDomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudGatewayCustomDomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudGatewayCustomDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudjavadeployment/zz_controller.go b/internal/controller/appplatform/springcloudjavadeployment/zz_controller.go index 60faf8a43..9793d56db 100755 --- a/internal/controller/appplatform/springcloudjavadeployment/zz_controller.go +++ b/internal/controller/appplatform/springcloudjavadeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudJavaDeployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudJavaDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudJavaDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudJavaDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudservice/zz_controller.go b/internal/controller/appplatform/springcloudservice/zz_controller.go index 2f19df5c6..6a86f37bc 100755 --- a/internal/controller/appplatform/springcloudservice/zz_controller.go +++ b/internal/controller/appplatform/springcloudservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appplatform/springcloudstorage/zz_controller.go b/internal/controller/appplatform/springcloudstorage/zz_controller.go index afc0f3938..befb06de7 100755 --- a/internal/controller/appplatform/springcloudstorage/zz_controller.go +++ b/internal/controller/appplatform/springcloudstorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpringCloudStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpringCloudStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpringCloudStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpringCloudStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/attestation/provider/zz_controller.go b/internal/controller/attestation/provider/zz_controller.go index 2553746a9..9e179eebb 100755 --- a/internal/controller/attestation/provider/zz_controller.go +++ b/internal/controller/attestation/provider/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Provider // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProviderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProviderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Provider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/managementlock/zz_controller.go b/internal/controller/authorization/managementlock/zz_controller.go index a5c04cdb9..6f349ec80 100755 --- a/internal/controller/authorization/managementlock/zz_controller.go +++ b/internal/controller/authorization/managementlock/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagementLock // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagementLockList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagementLockList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagementLock_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/policydefinition/zz_controller.go b/internal/controller/authorization/policydefinition/zz_controller.go index 4023637ca..e44088971 100755 --- a/internal/controller/authorization/policydefinition/zz_controller.go +++ b/internal/controller/authorization/policydefinition/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PolicyDefinition // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PolicyDefinitionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PolicyDefinitionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PolicyDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/resourcegrouppolicyassignment/zz_controller.go b/internal/controller/authorization/resourcegrouppolicyassignment/zz_controller.go index 1499569ac..aa05d017f 100755 --- a/internal/controller/authorization/resourcegrouppolicyassignment/zz_controller.go +++ b/internal/controller/authorization/resourcegrouppolicyassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ResourceGroupPolicyAssignment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ResourceGroupPolicyAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ResourceGroupPolicyAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ResourceGroupPolicyAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/resourcepolicyassignment/zz_controller.go b/internal/controller/authorization/resourcepolicyassignment/zz_controller.go index 39ac66e8c..504aa5c87 100755 --- a/internal/controller/authorization/resourcepolicyassignment/zz_controller.go +++ b/internal/controller/authorization/resourcepolicyassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ResourcePolicyAssignment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ResourcePolicyAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ResourcePolicyAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ResourcePolicyAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/resourcepolicyexemption/zz_controller.go b/internal/controller/authorization/resourcepolicyexemption/zz_controller.go index 11ac442dc..cf47a46f8 100755 --- a/internal/controller/authorization/resourcepolicyexemption/zz_controller.go +++ b/internal/controller/authorization/resourcepolicyexemption/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourcePolicyExemption // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourcePolicyExemptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourcePolicyExemptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicyExemption_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/roleassignment/zz_controller.go b/internal/controller/authorization/roleassignment/zz_controller.go index 28e3e06fb..04609ccd8 100755 --- a/internal/controller/authorization/roleassignment/zz_controller.go +++ b/internal/controller/authorization/roleassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RoleAssignment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RoleAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RoleAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/roledefinition/zz_controller.go b/internal/controller/authorization/roledefinition/zz_controller.go index 49b2045aa..6a453198b 100755 --- a/internal/controller/authorization/roledefinition/zz_controller.go +++ b/internal/controller/authorization/roledefinition/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RoleDefinition // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RoleDefinitionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RoleDefinitionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoleDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/subscriptionpolicyassignment/zz_controller.go b/internal/controller/authorization/subscriptionpolicyassignment/zz_controller.go index 6ff65663e..ee420ea9c 100755 --- a/internal/controller/authorization/subscriptionpolicyassignment/zz_controller.go +++ b/internal/controller/authorization/subscriptionpolicyassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SubscriptionPolicyAssignment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubscriptionPolicyAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubscriptionPolicyAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SubscriptionPolicyAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/authorization/subscriptionpolicyexemption/zz_controller.go b/internal/controller/authorization/subscriptionpolicyexemption/zz_controller.go index 7fdeb2314..bb556e521 100755 --- a/internal/controller/authorization/subscriptionpolicyexemption/zz_controller.go +++ b/internal/controller/authorization/subscriptionpolicyexemption/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubscriptionPolicyExemption // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubscriptionPolicyExemptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubscriptionPolicyExemptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubscriptionPolicyExemption_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/account/zz_controller.go b/internal/controller/automation/account/zz_controller.go index 1e34c000a..1ce25535a 100755 --- a/internal/controller/automation/account/zz_controller.go +++ b/internal/controller/automation/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/connection/zz_controller.go b/internal/controller/automation/connection/zz_controller.go index e48eb729e..6e9ffd28c 100755 --- a/internal/controller/automation/connection/zz_controller.go +++ b/internal/controller/automation/connection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Connection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/connectionclassiccertificate/zz_controller.go b/internal/controller/automation/connectionclassiccertificate/zz_controller.go index c85c66282..42701dd1b 100755 --- a/internal/controller/automation/connectionclassiccertificate/zz_controller.go +++ b/internal/controller/automation/connectionclassiccertificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ConnectionClassicCertificate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConnectionClassicCertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConnectionClassicCertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConnectionClassicCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/connectiontype/zz_controller.go b/internal/controller/automation/connectiontype/zz_controller.go index 46347b1de..12ccb0cc4 100755 --- a/internal/controller/automation/connectiontype/zz_controller.go +++ b/internal/controller/automation/connectiontype/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ConnectionType // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConnectionTypeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConnectionTypeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConnectionType_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/credential/zz_controller.go b/internal/controller/automation/credential/zz_controller.go index d753057d2..715abdb6f 100755 --- a/internal/controller/automation/credential/zz_controller.go +++ b/internal/controller/automation/credential/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Credential // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CredentialList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CredentialList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Credential_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/hybridrunbookworkergroup/zz_controller.go b/internal/controller/automation/hybridrunbookworkergroup/zz_controller.go index 403b6a2b6..b3f4fb87e 100755 --- a/internal/controller/automation/hybridrunbookworkergroup/zz_controller.go +++ b/internal/controller/automation/hybridrunbookworkergroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HybridRunBookWorkerGroup // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HybridRunBookWorkerGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HybridRunBookWorkerGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HybridRunBookWorkerGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/module/zz_controller.go b/internal/controller/automation/module/zz_controller.go index 2c2589c91..c0901be66 100755 --- a/internal/controller/automation/module/zz_controller.go +++ b/internal/controller/automation/module/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Module // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ModuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ModuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Module_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/runbook/zz_controller.go b/internal/controller/automation/runbook/zz_controller.go index b59139d83..136c95e33 100755 --- a/internal/controller/automation/runbook/zz_controller.go +++ b/internal/controller/automation/runbook/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.RunBook // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.RunBookList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.RunBookList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.RunBook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/schedule/zz_controller.go b/internal/controller/automation/schedule/zz_controller.go index 5b3c901fc..3030475f0 100755 --- a/internal/controller/automation/schedule/zz_controller.go +++ b/internal/controller/automation/schedule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Schedule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ScheduleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ScheduleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Schedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/variablebool/zz_controller.go b/internal/controller/automation/variablebool/zz_controller.go index 8619052e0..d0c0c20fe 100755 --- a/internal/controller/automation/variablebool/zz_controller.go +++ b/internal/controller/automation/variablebool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VariableBool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VariableBoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VariableBoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VariableBool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/variabledatetime/zz_controller.go b/internal/controller/automation/variabledatetime/zz_controller.go index 8b75e1975..0a2f5e897 100755 --- a/internal/controller/automation/variabledatetime/zz_controller.go +++ b/internal/controller/automation/variabledatetime/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VariableDateTime // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VariableDateTimeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VariableDateTimeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VariableDateTime_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/variableint/zz_controller.go b/internal/controller/automation/variableint/zz_controller.go index defc2d7a9..6deaef740 100755 --- a/internal/controller/automation/variableint/zz_controller.go +++ b/internal/controller/automation/variableint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VariableInt // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VariableIntList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VariableIntList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VariableInt_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/variablestring/zz_controller.go b/internal/controller/automation/variablestring/zz_controller.go index 311240327..56887de7c 100755 --- a/internal/controller/automation/variablestring/zz_controller.go +++ b/internal/controller/automation/variablestring/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VariableString // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VariableStringList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VariableStringList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VariableString_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/automation/webhook/zz_controller.go b/internal/controller/automation/webhook/zz_controller.go index e09e66331..43b2c3fdb 100755 --- a/internal/controller/automation/webhook/zz_controller.go +++ b/internal/controller/automation/webhook/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Webhook // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WebhookList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WebhookList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/azure/resourcegroup/zz_controller.go b/internal/controller/azure/resourcegroup/zz_controller.go index a4bf25a10..9c9e30ef5 100755 --- a/internal/controller/azure/resourcegroup/zz_controller.go +++ b/internal/controller/azure/resourcegroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourceGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourceGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourceGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/azure/resourceproviderregistration/zz_controller.go b/internal/controller/azure/resourceproviderregistration/zz_controller.go index 41ce4edf0..448fe0ecb 100755 --- a/internal/controller/azure/resourceproviderregistration/zz_controller.go +++ b/internal/controller/azure/resourceproviderregistration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourceProviderRegistration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourceProviderRegistrationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourceProviderRegistrationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceProviderRegistration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/azure/subscription/zz_controller.go b/internal/controller/azure/subscription/zz_controller.go index 39bf64c2a..581822045 100755 --- a/internal/controller/azure/subscription/zz_controller.go +++ b/internal/controller/azure/subscription/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Subscription // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubscriptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubscriptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Subscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/azurestackhci/cluster/zz_controller.go b/internal/controller/azurestackhci/cluster/zz_controller.go index 199296dc8..f96afe1a0 100755 --- a/internal/controller/azurestackhci/cluster/zz_controller.go +++ b/internal/controller/azurestackhci/cluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Cluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelalexa/zz_controller.go b/internal/controller/botservice/botchannelalexa/zz_controller.go index 8f195177a..e1ac20a26 100755 --- a/internal/controller/botservice/botchannelalexa/zz_controller.go +++ b/internal/controller/botservice/botchannelalexa/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelAlexa // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelAlexaList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelAlexaList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelAlexa_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchanneldirectline/zz_controller.go b/internal/controller/botservice/botchanneldirectline/zz_controller.go index 0d691dafb..e124fa5a0 100755 --- a/internal/controller/botservice/botchanneldirectline/zz_controller.go +++ b/internal/controller/botservice/botchanneldirectline/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelDirectLine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelDirectLineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelDirectLineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelDirectLine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelline/zz_controller.go b/internal/controller/botservice/botchannelline/zz_controller.go index 263f86436..2099e1ad8 100755 --- a/internal/controller/botservice/botchannelline/zz_controller.go +++ b/internal/controller/botservice/botchannelline/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelLine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelLineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelLineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelLine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelmsteams/zz_controller.go b/internal/controller/botservice/botchannelmsteams/zz_controller.go index 78cba3e05..5e2009a39 100755 --- a/internal/controller/botservice/botchannelmsteams/zz_controller.go +++ b/internal/controller/botservice/botchannelmsteams/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelMSTeams // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelMSTeamsList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelMSTeamsList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelMSTeams_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelslack/zz_controller.go b/internal/controller/botservice/botchannelslack/zz_controller.go index 16fb84b21..fcae8274c 100755 --- a/internal/controller/botservice/botchannelslack/zz_controller.go +++ b/internal/controller/botservice/botchannelslack/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelSlack // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelSlackList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelSlackList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelSlack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelsms/zz_controller.go b/internal/controller/botservice/botchannelsms/zz_controller.go index df0ad13c7..c2d96d9ae 100755 --- a/internal/controller/botservice/botchannelsms/zz_controller.go +++ b/internal/controller/botservice/botchannelsms/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelSMS // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelSMSList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelSMSList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelSMS_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelsregistration/zz_controller.go b/internal/controller/botservice/botchannelsregistration/zz_controller.go index 9b0291c57..757063d32 100755 --- a/internal/controller/botservice/botchannelsregistration/zz_controller.go +++ b/internal/controller/botservice/botchannelsregistration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelsRegistration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelsRegistrationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelsRegistrationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelsRegistration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botchannelwebchat/zz_controller.go b/internal/controller/botservice/botchannelwebchat/zz_controller.go index 33d52a2e3..a7ca5dad4 100755 --- a/internal/controller/botservice/botchannelwebchat/zz_controller.go +++ b/internal/controller/botservice/botchannelwebchat/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotChannelWebChat // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotChannelWebChatList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotChannelWebChatList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotChannelWebChat_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botconnection/zz_controller.go b/internal/controller/botservice/botconnection/zz_controller.go index 878245d1a..3c41d8690 100755 --- a/internal/controller/botservice/botconnection/zz_controller.go +++ b/internal/controller/botservice/botconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/botservice/botwebapp/zz_controller.go b/internal/controller/botservice/botwebapp/zz_controller.go index d94c396dc..07322840c 100755 --- a/internal/controller/botservice/botwebapp/zz_controller.go +++ b/internal/controller/botservice/botwebapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BotWebApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BotWebAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BotWebAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotWebApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cache/rediscache/zz_controller.go b/internal/controller/cache/rediscache/zz_controller.go index 6c13c34b2..9ebdef445 100755 --- a/internal/controller/cache/rediscache/zz_controller.go +++ b/internal/controller/cache/rediscache/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.RedisCache // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.RedisCacheList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.RedisCacheList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.RedisCache_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cache/redisenterprisecluster/zz_controller.go b/internal/controller/cache/redisenterprisecluster/zz_controller.go index c97b2540a..4de0c15b9 100755 --- a/internal/controller/cache/redisenterprisecluster/zz_controller.go +++ b/internal/controller/cache/redisenterprisecluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RedisEnterpriseCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RedisEnterpriseClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RedisEnterpriseClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedisEnterpriseCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cache/redisenterprisedatabase/zz_controller.go b/internal/controller/cache/redisenterprisedatabase/zz_controller.go index d6dd3e15e..8cc283057 100755 --- a/internal/controller/cache/redisenterprisedatabase/zz_controller.go +++ b/internal/controller/cache/redisenterprisedatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RedisEnterpriseDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RedisEnterpriseDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RedisEnterpriseDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedisEnterpriseDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cache/redisfirewallrule/zz_controller.go b/internal/controller/cache/redisfirewallrule/zz_controller.go index 52951d457..704c218a1 100755 --- a/internal/controller/cache/redisfirewallrule/zz_controller.go +++ b/internal/controller/cache/redisfirewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RedisFirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RedisFirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RedisFirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedisFirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cache/redislinkedserver/zz_controller.go b/internal/controller/cache/redislinkedserver/zz_controller.go index 24815f115..0456a7162 100755 --- a/internal/controller/cache/redislinkedserver/zz_controller.go +++ b/internal/controller/cache/redislinkedserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RedisLinkedServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RedisLinkedServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RedisLinkedServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedisLinkedServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/endpoint/zz_controller.go b/internal/controller/cdn/endpoint/zz_controller.go index cd29d49c8..52264507b 100755 --- a/internal/controller/cdn/endpoint/zz_controller.go +++ b/internal/controller/cdn/endpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Endpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.EndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.EndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Endpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorcustomdomain/zz_controller.go b/internal/controller/cdn/frontdoorcustomdomain/zz_controller.go index 4597215e6..e8b47913b 100755 --- a/internal/controller/cdn/frontdoorcustomdomain/zz_controller.go +++ b/internal/controller/cdn/frontdoorcustomdomain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorCustomDomain // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorCustomDomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorCustomDomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorCustomDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorcustomdomainassociation/zz_controller.go b/internal/controller/cdn/frontdoorcustomdomainassociation/zz_controller.go index b4a79ee4a..ef24b1b4c 100755 --- a/internal/controller/cdn/frontdoorcustomdomainassociation/zz_controller.go +++ b/internal/controller/cdn/frontdoorcustomdomainassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorCustomDomainAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorCustomDomainAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorCustomDomainAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorCustomDomainAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorendpoint/zz_controller.go b/internal/controller/cdn/frontdoorendpoint/zz_controller.go index 79fba6829..23b782591 100755 --- a/internal/controller/cdn/frontdoorendpoint/zz_controller.go +++ b/internal/controller/cdn/frontdoorendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorfirewallpolicy/zz_controller.go b/internal/controller/cdn/frontdoorfirewallpolicy/zz_controller.go index a15336ab9..e40477af2 100755 --- a/internal/controller/cdn/frontdoorfirewallpolicy/zz_controller.go +++ b/internal/controller/cdn/frontdoorfirewallpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorFirewallPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorFirewallPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorFirewallPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorFirewallPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoororigin/zz_controller.go b/internal/controller/cdn/frontdoororigin/zz_controller.go index 4a671b163..d98662171 100755 --- a/internal/controller/cdn/frontdoororigin/zz_controller.go +++ b/internal/controller/cdn/frontdoororigin/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorOrigin // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorOriginList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorOriginList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorOrigin_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoororigingroup/zz_controller.go b/internal/controller/cdn/frontdoororigingroup/zz_controller.go index fdfb7b274..574019a5e 100755 --- a/internal/controller/cdn/frontdoororigingroup/zz_controller.go +++ b/internal/controller/cdn/frontdoororigingroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorOriginGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorOriginGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorOriginGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorOriginGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorprofile/zz_controller.go b/internal/controller/cdn/frontdoorprofile/zz_controller.go index e336ae2a1..d52ce41bd 100755 --- a/internal/controller/cdn/frontdoorprofile/zz_controller.go +++ b/internal/controller/cdn/frontdoorprofile/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorProfile // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorProfileList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorProfileList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorroute/zz_controller.go b/internal/controller/cdn/frontdoorroute/zz_controller.go index 82a9a5535..a386b6607 100755 --- a/internal/controller/cdn/frontdoorroute/zz_controller.go +++ b/internal/controller/cdn/frontdoorroute/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorRoute // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorRouteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorRouteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorrule/zz_controller.go b/internal/controller/cdn/frontdoorrule/zz_controller.go index f68f9896b..326174f39 100755 --- a/internal/controller/cdn/frontdoorrule/zz_controller.go +++ b/internal/controller/cdn/frontdoorrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorruleset/zz_controller.go b/internal/controller/cdn/frontdoorruleset/zz_controller.go index 4dafeca65..83fcd2eba 100755 --- a/internal/controller/cdn/frontdoorruleset/zz_controller.go +++ b/internal/controller/cdn/frontdoorruleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorRuleSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorRuleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorRuleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorRuleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/frontdoorsecuritypolicy/zz_controller.go b/internal/controller/cdn/frontdoorsecuritypolicy/zz_controller.go index e853d6d34..fb040de25 100755 --- a/internal/controller/cdn/frontdoorsecuritypolicy/zz_controller.go +++ b/internal/controller/cdn/frontdoorsecuritypolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorSecurityPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorSecurityPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorSecurityPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorSecurityPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cdn/profile/zz_controller.go b/internal/controller/cdn/profile/zz_controller.go index e7a979617..cdec89c55 100755 --- a/internal/controller/cdn/profile/zz_controller.go +++ b/internal/controller/cdn/profile/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Profile // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProfileList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProfileList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Profile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/certificateregistration/appservicecertificateorder/zz_controller.go b/internal/controller/certificateregistration/appservicecertificateorder/zz_controller.go index 2ff601d66..328b4c575 100755 --- a/internal/controller/certificateregistration/appservicecertificateorder/zz_controller.go +++ b/internal/controller/certificateregistration/appservicecertificateorder/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppServiceCertificateOrder // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppServiceCertificateOrderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppServiceCertificateOrderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppServiceCertificateOrder_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitiveservices/account/zz_controller.go b/internal/controller/cognitiveservices/account/zz_controller.go index f35963aa2..a793756f1 100755 --- a/internal/controller/cognitiveservices/account/zz_controller.go +++ b/internal/controller/cognitiveservices/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitiveservices/deployment/zz_controller.go b/internal/controller/cognitiveservices/deployment/zz_controller.go index 6c83c8a7f..af90dab9a 100755 --- a/internal/controller/cognitiveservices/deployment/zz_controller.go +++ b/internal/controller/cognitiveservices/deployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Deployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Deployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/communication/service/zz_controller.go b/internal/controller/communication/service/zz_controller.go index 597ce9945..cf117df30 100755 --- a/internal/controller/communication/service/zz_controller.go +++ b/internal/controller/communication/service/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Service // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/availabilityset/zz_controller.go b/internal/controller/compute/availabilityset/zz_controller.go index 5d0239fa8..aa1d55b51 100755 --- a/internal/controller/compute/availabilityset/zz_controller.go +++ b/internal/controller/compute/availabilityset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AvailabilitySet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AvailabilitySetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AvailabilitySetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AvailabilitySet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/capacityreservation/zz_controller.go b/internal/controller/compute/capacityreservation/zz_controller.go index 1997391aa..71353f18b 100755 --- a/internal/controller/compute/capacityreservation/zz_controller.go +++ b/internal/controller/compute/capacityreservation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CapacityReservation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CapacityReservationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CapacityReservationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CapacityReservation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/capacityreservationgroup/zz_controller.go b/internal/controller/compute/capacityreservationgroup/zz_controller.go index 13e698f51..012fbe354 100755 --- a/internal/controller/compute/capacityreservationgroup/zz_controller.go +++ b/internal/controller/compute/capacityreservationgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CapacityReservationGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CapacityReservationGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CapacityReservationGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CapacityReservationGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/dedicatedhost/zz_controller.go b/internal/controller/compute/dedicatedhost/zz_controller.go index 97d9f16a6..7209cf686 100755 --- a/internal/controller/compute/dedicatedhost/zz_controller.go +++ b/internal/controller/compute/dedicatedhost/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DedicatedHost // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DedicatedHostList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DedicatedHostList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DedicatedHost_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/diskaccess/zz_controller.go b/internal/controller/compute/diskaccess/zz_controller.go index 31bfd9aa9..1be9d33c0 100755 --- a/internal/controller/compute/diskaccess/zz_controller.go +++ b/internal/controller/compute/diskaccess/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DiskAccess // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DiskAccessList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DiskAccessList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DiskAccess_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/diskencryptionset/zz_controller.go b/internal/controller/compute/diskencryptionset/zz_controller.go index ca1c6eaab..c481f1b87 100755 --- a/internal/controller/compute/diskencryptionset/zz_controller.go +++ b/internal/controller/compute/diskencryptionset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DiskEncryptionSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DiskEncryptionSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DiskEncryptionSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DiskEncryptionSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/galleryapplication/zz_controller.go b/internal/controller/compute/galleryapplication/zz_controller.go index 9778b8198..5948fdaea 100755 --- a/internal/controller/compute/galleryapplication/zz_controller.go +++ b/internal/controller/compute/galleryapplication/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.GalleryApplication // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.GalleryApplicationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.GalleryApplicationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GalleryApplication_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/galleryapplicationversion/zz_controller.go b/internal/controller/compute/galleryapplicationversion/zz_controller.go index c97fdde1b..83e828501 100755 --- a/internal/controller/compute/galleryapplicationversion/zz_controller.go +++ b/internal/controller/compute/galleryapplicationversion/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.GalleryApplicationVersion // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.GalleryApplicationVersionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.GalleryApplicationVersionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.GalleryApplicationVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/image/zz_controller.go b/internal/controller/compute/image/zz_controller.go index 9085b6107..005f3811f 100755 --- a/internal/controller/compute/image/zz_controller.go +++ b/internal/controller/compute/image/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Image // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ImageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ImageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Image_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/linuxvirtualmachine/zz_controller.go b/internal/controller/compute/linuxvirtualmachine/zz_controller.go index 1818b61a1..5d0484311 100755 --- a/internal/controller/compute/linuxvirtualmachine/zz_controller.go +++ b/internal/controller/compute/linuxvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxVirtualMachine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/linuxvirtualmachinescaleset/zz_controller.go b/internal/controller/compute/linuxvirtualmachinescaleset/zz_controller.go index dea5bfe0e..748cf2ae2 100755 --- a/internal/controller/compute/linuxvirtualmachinescaleset/zz_controller.go +++ b/internal/controller/compute/linuxvirtualmachinescaleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxVirtualMachineScaleSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxVirtualMachineScaleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxVirtualMachineScaleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxVirtualMachineScaleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/manageddisk/zz_controller.go b/internal/controller/compute/manageddisk/zz_controller.go index 8a9f049df..4392e9033 100755 --- a/internal/controller/compute/manageddisk/zz_controller.go +++ b/internal/controller/compute/manageddisk/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ManagedDisk // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagedDiskList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagedDiskList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ManagedDisk_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/manageddisksastoken/zz_controller.go b/internal/controller/compute/manageddisksastoken/zz_controller.go index 9437e9447..83bc00ec0 100755 --- a/internal/controller/compute/manageddisksastoken/zz_controller.go +++ b/internal/controller/compute/manageddisksastoken/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedDiskSASToken // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedDiskSASTokenList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedDiskSASTokenList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedDiskSASToken_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/orchestratedvirtualmachinescaleset/zz_controller.go b/internal/controller/compute/orchestratedvirtualmachinescaleset/zz_controller.go index 544cdf3bb..b6037987a 100755 --- a/internal/controller/compute/orchestratedvirtualmachinescaleset/zz_controller.go +++ b/internal/controller/compute/orchestratedvirtualmachinescaleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.OrchestratedVirtualMachineScaleSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.OrchestratedVirtualMachineScaleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.OrchestratedVirtualMachineScaleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.OrchestratedVirtualMachineScaleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/proximityplacementgroup/zz_controller.go b/internal/controller/compute/proximityplacementgroup/zz_controller.go index d09914952..314568f78 100755 --- a/internal/controller/compute/proximityplacementgroup/zz_controller.go +++ b/internal/controller/compute/proximityplacementgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ProximityPlacementGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ProximityPlacementGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ProximityPlacementGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProximityPlacementGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/sharedimage/zz_controller.go b/internal/controller/compute/sharedimage/zz_controller.go index c196992ee..5677bbea8 100755 --- a/internal/controller/compute/sharedimage/zz_controller.go +++ b/internal/controller/compute/sharedimage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SharedImage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SharedImageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SharedImageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SharedImage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/sharedimagegallery/zz_controller.go b/internal/controller/compute/sharedimagegallery/zz_controller.go index 1010cbec3..c2cf67549 100755 --- a/internal/controller/compute/sharedimagegallery/zz_controller.go +++ b/internal/controller/compute/sharedimagegallery/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SharedImageGallery // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SharedImageGalleryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SharedImageGalleryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SharedImageGallery_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/snapshot/zz_controller.go b/internal/controller/compute/snapshot/zz_controller.go index 580359eca..a79779691 100755 --- a/internal/controller/compute/snapshot/zz_controller.go +++ b/internal/controller/compute/snapshot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Snapshot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SnapshotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SnapshotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Snapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/sshpublickey/zz_controller.go b/internal/controller/compute/sshpublickey/zz_controller.go index 7d00368e6..a1d015e12 100755 --- a/internal/controller/compute/sshpublickey/zz_controller.go +++ b/internal/controller/compute/sshpublickey/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SSHPublicKey // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SSHPublicKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SSHPublicKeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SSHPublicKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/virtualmachinedatadiskattachment/zz_controller.go b/internal/controller/compute/virtualmachinedatadiskattachment/zz_controller.go index 9a54147e1..7ddbf6acd 100755 --- a/internal/controller/compute/virtualmachinedatadiskattachment/zz_controller.go +++ b/internal/controller/compute/virtualmachinedatadiskattachment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualMachineDataDiskAttachment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualMachineDataDiskAttachmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualMachineDataDiskAttachmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualMachineDataDiskAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/virtualmachineextension/zz_controller.go b/internal/controller/compute/virtualmachineextension/zz_controller.go index af1097483..7a378286d 100755 --- a/internal/controller/compute/virtualmachineextension/zz_controller.go +++ b/internal/controller/compute/virtualmachineextension/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualMachineExtension // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualMachineExtensionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualMachineExtensionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualMachineExtension_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/windowsvirtualmachine/zz_controller.go b/internal/controller/compute/windowsvirtualmachine/zz_controller.go index e911041e8..d6747591b 100755 --- a/internal/controller/compute/windowsvirtualmachine/zz_controller.go +++ b/internal/controller/compute/windowsvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsVirtualMachine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/compute/windowsvirtualmachinescaleset/zz_controller.go b/internal/controller/compute/windowsvirtualmachinescaleset/zz_controller.go index f3d907abf..1ecac966a 100755 --- a/internal/controller/compute/windowsvirtualmachinescaleset/zz_controller.go +++ b/internal/controller/compute/windowsvirtualmachinescaleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsVirtualMachineScaleSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsVirtualMachineScaleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsVirtualMachineScaleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsVirtualMachineScaleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/confidentialledger/ledger/zz_controller.go b/internal/controller/confidentialledger/ledger/zz_controller.go index f0a2dd14e..3b5d9ecda 100755 --- a/internal/controller/confidentialledger/ledger/zz_controller.go +++ b/internal/controller/confidentialledger/ledger/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Ledger // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LedgerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LedgerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Ledger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/consumption/budgetmanagementgroup/zz_controller.go b/internal/controller/consumption/budgetmanagementgroup/zz_controller.go index 982102fbf..d8d626951 100755 --- a/internal/controller/consumption/budgetmanagementgroup/zz_controller.go +++ b/internal/controller/consumption/budgetmanagementgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BudgetManagementGroup // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BudgetManagementGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BudgetManagementGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BudgetManagementGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/consumption/budgetresourcegroup/zz_controller.go b/internal/controller/consumption/budgetresourcegroup/zz_controller.go index 2bee7ae9f..7f6cb8b81 100755 --- a/internal/controller/consumption/budgetresourcegroup/zz_controller.go +++ b/internal/controller/consumption/budgetresourcegroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BudgetResourceGroup // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BudgetResourceGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BudgetResourceGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BudgetResourceGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/consumption/budgetsubscription/zz_controller.go b/internal/controller/consumption/budgetsubscription/zz_controller.go index 1d96361d6..40fe50492 100755 --- a/internal/controller/consumption/budgetsubscription/zz_controller.go +++ b/internal/controller/consumption/budgetsubscription/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BudgetSubscription // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BudgetSubscriptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BudgetSubscriptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BudgetSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerapp/containerapp/zz_controller.go b/internal/controller/containerapp/containerapp/zz_controller.go index fba7ce55a..31a377494 100755 --- a/internal/controller/containerapp/containerapp/zz_controller.go +++ b/internal/controller/containerapp/containerapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ContainerApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ContainerAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ContainerAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ContainerApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerapp/environment/zz_controller.go b/internal/controller/containerapp/environment/zz_controller.go index 4d4ad6a10..e48d0b179 100755 --- a/internal/controller/containerapp/environment/zz_controller.go +++ b/internal/controller/containerapp/environment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Environment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EnvironmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EnvironmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/agentpool/zz_controller.go b/internal/controller/containerregistry/agentpool/zz_controller.go index 2f2c59f27..44eed8d92 100755 --- a/internal/controller/containerregistry/agentpool/zz_controller.go +++ b/internal/controller/containerregistry/agentpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AgentPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AgentPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AgentPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AgentPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/containerconnectedregistry/zz_controller.go b/internal/controller/containerregistry/containerconnectedregistry/zz_controller.go index 8ce361672..fd56286af 100755 --- a/internal/controller/containerregistry/containerconnectedregistry/zz_controller.go +++ b/internal/controller/containerregistry/containerconnectedregistry/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ContainerConnectedRegistry // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ContainerConnectedRegistryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ContainerConnectedRegistryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContainerConnectedRegistry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/registry/zz_controller.go b/internal/controller/containerregistry/registry/zz_controller.go index fb235bec7..17eb4762d 100755 --- a/internal/controller/containerregistry/registry/zz_controller.go +++ b/internal/controller/containerregistry/registry/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Registry // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.RegistryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.RegistryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Registry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/scopemap/zz_controller.go b/internal/controller/containerregistry/scopemap/zz_controller.go index c10d19957..d803e186e 100755 --- a/internal/controller/containerregistry/scopemap/zz_controller.go +++ b/internal/controller/containerregistry/scopemap/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ScopeMap // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ScopeMapList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ScopeMapList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScopeMap_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/token/zz_controller.go b/internal/controller/containerregistry/token/zz_controller.go index 29c094a3b..3f3b3fec6 100755 --- a/internal/controller/containerregistry/token/zz_controller.go +++ b/internal/controller/containerregistry/token/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Token // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TokenList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TokenList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Token_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/tokenpassword/zz_controller.go b/internal/controller/containerregistry/tokenpassword/zz_controller.go index e22353569..f48a15b8b 100755 --- a/internal/controller/containerregistry/tokenpassword/zz_controller.go +++ b/internal/controller/containerregistry/tokenpassword/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.TokenPassword // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TokenPasswordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TokenPasswordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.TokenPassword_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerregistry/webhook/zz_controller.go b/internal/controller/containerregistry/webhook/zz_controller.go index a57869362..40b5d09d2 100755 --- a/internal/controller/containerregistry/webhook/zz_controller.go +++ b/internal/controller/containerregistry/webhook/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Webhook // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WebhookList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WebhookList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerservice/kubernetescluster/zz_controller.go b/internal/controller/containerservice/kubernetescluster/zz_controller.go index b8258bb07..de7cca69b 100755 --- a/internal/controller/containerservice/kubernetescluster/zz_controller.go +++ b/internal/controller/containerservice/kubernetescluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.KubernetesCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.KubernetesClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.KubernetesClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.KubernetesCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerservice/kubernetesclusternodepool/zz_controller.go b/internal/controller/containerservice/kubernetesclusternodepool/zz_controller.go index 6241badf1..a35c4ec79 100755 --- a/internal/controller/containerservice/kubernetesclusternodepool/zz_controller.go +++ b/internal/controller/containerservice/kubernetesclusternodepool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.KubernetesClusterNodePool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.KubernetesClusterNodePoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.KubernetesClusterNodePoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.KubernetesClusterNodePool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/containerservice/kubernetesfleetmanager/zz_controller.go b/internal/controller/containerservice/kubernetesfleetmanager/zz_controller.go index bfb94ecc5..b96f4ac0e 100755 --- a/internal/controller/containerservice/kubernetesfleetmanager/zz_controller.go +++ b/internal/controller/containerservice/kubernetesfleetmanager/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.KubernetesFleetManager // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.KubernetesFleetManagerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.KubernetesFleetManagerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.KubernetesFleetManager_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/account/zz_controller.go b/internal/controller/cosmosdb/account/zz_controller.go index e0214ed9c..81ea40320 100755 --- a/internal/controller/cosmosdb/account/zz_controller.go +++ b/internal/controller/cosmosdb/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/cassandracluster/zz_controller.go b/internal/controller/cosmosdb/cassandracluster/zz_controller.go index 80ec4bded..8635fa483 100755 --- a/internal/controller/cosmosdb/cassandracluster/zz_controller.go +++ b/internal/controller/cosmosdb/cassandracluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CassandraCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CassandraClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CassandraClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CassandraCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/cassandradatacenter/zz_controller.go b/internal/controller/cosmosdb/cassandradatacenter/zz_controller.go index 2419e47ec..4d9a1817a 100755 --- a/internal/controller/cosmosdb/cassandradatacenter/zz_controller.go +++ b/internal/controller/cosmosdb/cassandradatacenter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CassandraDatacenter // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CassandraDatacenterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CassandraDatacenterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CassandraDatacenter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/cassandrakeyspace/zz_controller.go b/internal/controller/cosmosdb/cassandrakeyspace/zz_controller.go index 758fb7a6e..1d53dc7da 100755 --- a/internal/controller/cosmosdb/cassandrakeyspace/zz_controller.go +++ b/internal/controller/cosmosdb/cassandrakeyspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CassandraKeySpace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CassandraKeySpaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CassandraKeySpaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CassandraKeySpace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/cassandratable/zz_controller.go b/internal/controller/cosmosdb/cassandratable/zz_controller.go index cd771b04a..df4cfb886 100755 --- a/internal/controller/cosmosdb/cassandratable/zz_controller.go +++ b/internal/controller/cosmosdb/cassandratable/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CassandraTable // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CassandraTableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CassandraTableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CassandraTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/gremlindatabase/zz_controller.go b/internal/controller/cosmosdb/gremlindatabase/zz_controller.go index 3732c1a43..ffff2c2b1 100755 --- a/internal/controller/cosmosdb/gremlindatabase/zz_controller.go +++ b/internal/controller/cosmosdb/gremlindatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.GremlinDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.GremlinDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.GremlinDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.GremlinDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/gremlingraph/zz_controller.go b/internal/controller/cosmosdb/gremlingraph/zz_controller.go index 98fa4142b..e2728b766 100755 --- a/internal/controller/cosmosdb/gremlingraph/zz_controller.go +++ b/internal/controller/cosmosdb/gremlingraph/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.GremlinGraph // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.GremlinGraphList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.GremlinGraphList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.GremlinGraph_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/mongocollection/zz_controller.go b/internal/controller/cosmosdb/mongocollection/zz_controller.go index c943947d4..7e4f27f90 100755 --- a/internal/controller/cosmosdb/mongocollection/zz_controller.go +++ b/internal/controller/cosmosdb/mongocollection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MongoCollection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MongoCollectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MongoCollectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MongoCollection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/mongodatabase/zz_controller.go b/internal/controller/cosmosdb/mongodatabase/zz_controller.go index 87f818948..e1fa9d69b 100755 --- a/internal/controller/cosmosdb/mongodatabase/zz_controller.go +++ b/internal/controller/cosmosdb/mongodatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MongoDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MongoDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MongoDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MongoDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqlcontainer/zz_controller.go b/internal/controller/cosmosdb/sqlcontainer/zz_controller.go index 101e0ee4b..0d1b7a59c 100755 --- a/internal/controller/cosmosdb/sqlcontainer/zz_controller.go +++ b/internal/controller/cosmosdb/sqlcontainer/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SQLContainer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SQLContainerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SQLContainerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SQLContainer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqldatabase/zz_controller.go b/internal/controller/cosmosdb/sqldatabase/zz_controller.go index 8f1825d18..4048af88e 100755 --- a/internal/controller/cosmosdb/sqldatabase/zz_controller.go +++ b/internal/controller/cosmosdb/sqldatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SQLDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SQLDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SQLDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SQLDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqldedicatedgateway/zz_controller.go b/internal/controller/cosmosdb/sqldedicatedgateway/zz_controller.go index 6c9a08aea..13101b5d6 100755 --- a/internal/controller/cosmosdb/sqldedicatedgateway/zz_controller.go +++ b/internal/controller/cosmosdb/sqldedicatedgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLDedicatedGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLDedicatedGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLDedicatedGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLDedicatedGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqlfunction/zz_controller.go b/internal/controller/cosmosdb/sqlfunction/zz_controller.go index dff3eabee..4819c6f8e 100755 --- a/internal/controller/cosmosdb/sqlfunction/zz_controller.go +++ b/internal/controller/cosmosdb/sqlfunction/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLFunction // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLFunctionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLFunctionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLFunction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqlroleassignment/zz_controller.go b/internal/controller/cosmosdb/sqlroleassignment/zz_controller.go index 67d3a4ce8..a6c1c76fe 100755 --- a/internal/controller/cosmosdb/sqlroleassignment/zz_controller.go +++ b/internal/controller/cosmosdb/sqlroleassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLRoleAssignment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLRoleAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLRoleAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLRoleAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqlroledefinition/zz_controller.go b/internal/controller/cosmosdb/sqlroledefinition/zz_controller.go index 26790737f..351d44fbc 100755 --- a/internal/controller/cosmosdb/sqlroledefinition/zz_controller.go +++ b/internal/controller/cosmosdb/sqlroledefinition/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLRoleDefinition // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLRoleDefinitionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLRoleDefinitionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLRoleDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqlstoredprocedure/zz_controller.go b/internal/controller/cosmosdb/sqlstoredprocedure/zz_controller.go index 15af13c2f..8d7f72ad0 100755 --- a/internal/controller/cosmosdb/sqlstoredprocedure/zz_controller.go +++ b/internal/controller/cosmosdb/sqlstoredprocedure/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLStoredProcedure // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLStoredProcedureList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLStoredProcedureList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLStoredProcedure_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/sqltrigger/zz_controller.go b/internal/controller/cosmosdb/sqltrigger/zz_controller.go index 1731bf8c9..ab2af9064 100755 --- a/internal/controller/cosmosdb/sqltrigger/zz_controller.go +++ b/internal/controller/cosmosdb/sqltrigger/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLTrigger // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLTriggerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLTriggerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLTrigger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cosmosdb/table/zz_controller.go b/internal/controller/cosmosdb/table/zz_controller.go index 7b991bfd0..fd337c9c1 100755 --- a/internal/controller/cosmosdb/table/zz_controller.go +++ b/internal/controller/cosmosdb/table/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Table // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Table_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/costmanagement/costanomalyalert/zz_controller.go b/internal/controller/costmanagement/costanomalyalert/zz_controller.go index d20c8a343..e4abdff00 100755 --- a/internal/controller/costmanagement/costanomalyalert/zz_controller.go +++ b/internal/controller/costmanagement/costanomalyalert/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CostAnomalyAlert // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CostAnomalyAlertList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CostAnomalyAlertList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CostAnomalyAlert_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/costmanagement/resourcegroupcostmanagementexport/zz_controller.go b/internal/controller/costmanagement/resourcegroupcostmanagementexport/zz_controller.go index f0ff6adad..0826cbf46 100755 --- a/internal/controller/costmanagement/resourcegroupcostmanagementexport/zz_controller.go +++ b/internal/controller/costmanagement/resourcegroupcostmanagementexport/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ResourceGroupCostManagementExport // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ResourceGroupCostManagementExportList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ResourceGroupCostManagementExportList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ResourceGroupCostManagementExport_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/costmanagement/subscriptioncostmanagementexport/zz_controller.go b/internal/controller/costmanagement/subscriptioncostmanagementexport/zz_controller.go index c09ee153a..ed96b8ceb 100755 --- a/internal/controller/costmanagement/subscriptioncostmanagementexport/zz_controller.go +++ b/internal/controller/costmanagement/subscriptioncostmanagementexport/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SubscriptionCostManagementExport // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubscriptionCostManagementExportList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubscriptionCostManagementExportList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SubscriptionCostManagementExport_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/customproviders/customprovider/zz_controller.go b/internal/controller/customproviders/customprovider/zz_controller.go index 72eeac7f7..035663f56 100755 --- a/internal/controller/customproviders/customprovider/zz_controller.go +++ b/internal/controller/customproviders/customprovider/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CustomProvider // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CustomProviderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CustomProviderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/databoxedge/device/zz_controller.go b/internal/controller/databoxedge/device/zz_controller.go index e2728307b..8ba5a9b47 100755 --- a/internal/controller/databoxedge/device/zz_controller.go +++ b/internal/controller/databoxedge/device/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Device // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DeviceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DeviceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/databricks/accessconnector/zz_controller.go b/internal/controller/databricks/accessconnector/zz_controller.go index f6b7623d2..2f4879e84 100755 --- a/internal/controller/databricks/accessconnector/zz_controller.go +++ b/internal/controller/databricks/accessconnector/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AccessConnector // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccessConnectorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccessConnectorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AccessConnector_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/databricks/workspace/zz_controller.go b/internal/controller/databricks/workspace/zz_controller.go index 72c8ac138..e147e4bb8 100755 --- a/internal/controller/databricks/workspace/zz_controller.go +++ b/internal/controller/databricks/workspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Workspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/databricks/workspacecustomermanagedkey/zz_controller.go b/internal/controller/databricks/workspacecustomermanagedkey/zz_controller.go index b9fd8461e..60ad54f5c 100755 --- a/internal/controller/databricks/workspacecustomermanagedkey/zz_controller.go +++ b/internal/controller/databricks/workspacecustomermanagedkey/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceCustomerManagedKey // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceCustomerManagedKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceCustomerManagedKeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceCustomerManagedKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/databricks/workspacerootdbfscustomermanagedkey/zz_controller.go b/internal/controller/databricks/workspacerootdbfscustomermanagedkey/zz_controller.go index 5fa996fa6..19ed19e50 100755 --- a/internal/controller/databricks/workspacerootdbfscustomermanagedkey/zz_controller.go +++ b/internal/controller/databricks/workspacerootdbfscustomermanagedkey/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceRootDbfsCustomerManagedKey // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceRootDbfsCustomerManagedKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceRootDbfsCustomerManagedKeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceRootDbfsCustomerManagedKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/customdataset/zz_controller.go b/internal/controller/datafactory/customdataset/zz_controller.go index 1e00bb1de..c1e3efb79 100755 --- a/internal/controller/datafactory/customdataset/zz_controller.go +++ b/internal/controller/datafactory/customdataset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CustomDataSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CustomDataSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CustomDataSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CustomDataSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/dataflow/zz_controller.go b/internal/controller/datafactory/dataflow/zz_controller.go index 46d9aeff8..5ed81bd79 100755 --- a/internal/controller/datafactory/dataflow/zz_controller.go +++ b/internal/controller/datafactory/dataflow/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataFlow // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataFlowList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataFlowList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataFlow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetazureblob/zz_controller.go b/internal/controller/datafactory/datasetazureblob/zz_controller.go index f36ccad08..f32d3e1ed 100755 --- a/internal/controller/datafactory/datasetazureblob/zz_controller.go +++ b/internal/controller/datafactory/datasetazureblob/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetAzureBlob // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetAzureBlobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetAzureBlobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetAzureBlob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetbinary/zz_controller.go b/internal/controller/datafactory/datasetbinary/zz_controller.go index 0b8ec939a..66461a671 100755 --- a/internal/controller/datafactory/datasetbinary/zz_controller.go +++ b/internal/controller/datafactory/datasetbinary/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataSetBinary // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataSetBinaryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataSetBinaryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataSetBinary_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetcosmosdbsqlapi/zz_controller.go b/internal/controller/datafactory/datasetcosmosdbsqlapi/zz_controller.go index 977f7bed4..1bd4f71d3 100755 --- a/internal/controller/datafactory/datasetcosmosdbsqlapi/zz_controller.go +++ b/internal/controller/datafactory/datasetcosmosdbsqlapi/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetCosmosDBSQLAPI // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetCosmosDBSQLAPIList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetCosmosDBSQLAPIList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetCosmosDBSQLAPI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetdelimitedtext/zz_controller.go b/internal/controller/datafactory/datasetdelimitedtext/zz_controller.go index 95472a606..7cc4ce21d 100755 --- a/internal/controller/datafactory/datasetdelimitedtext/zz_controller.go +++ b/internal/controller/datafactory/datasetdelimitedtext/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataSetDelimitedText // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataSetDelimitedTextList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataSetDelimitedTextList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataSetDelimitedText_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasethttp/zz_controller.go b/internal/controller/datafactory/datasethttp/zz_controller.go index 17505d21d..5fd62fa4b 100755 --- a/internal/controller/datafactory/datasethttp/zz_controller.go +++ b/internal/controller/datafactory/datasethttp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetHTTP // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetHTTPList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetHTTPList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetHTTP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetjson/zz_controller.go b/internal/controller/datafactory/datasetjson/zz_controller.go index b2a7127e2..8b8e55839 100755 --- a/internal/controller/datafactory/datasetjson/zz_controller.go +++ b/internal/controller/datafactory/datasetjson/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataSetJSON // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataSetJSONList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataSetJSONList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataSetJSON_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetmysql/zz_controller.go b/internal/controller/datafactory/datasetmysql/zz_controller.go index 41c8f3ff6..1ba83dcb4 100755 --- a/internal/controller/datafactory/datasetmysql/zz_controller.go +++ b/internal/controller/datafactory/datasetmysql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetMySQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetMySQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetMySQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetMySQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetparquet/zz_controller.go b/internal/controller/datafactory/datasetparquet/zz_controller.go index 3227897b9..a624b8c6c 100755 --- a/internal/controller/datafactory/datasetparquet/zz_controller.go +++ b/internal/controller/datafactory/datasetparquet/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataSetParquet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataSetParquetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataSetParquetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataSetParquet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetpostgresql/zz_controller.go b/internal/controller/datafactory/datasetpostgresql/zz_controller.go index d710d8303..cc1816945 100755 --- a/internal/controller/datafactory/datasetpostgresql/zz_controller.go +++ b/internal/controller/datafactory/datasetpostgresql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetPostgreSQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetPostgreSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetPostgreSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetPostgreSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetsnowflake/zz_controller.go b/internal/controller/datafactory/datasetsnowflake/zz_controller.go index 7751065de..181a1807d 100755 --- a/internal/controller/datafactory/datasetsnowflake/zz_controller.go +++ b/internal/controller/datafactory/datasetsnowflake/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetSnowflake // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetSnowflakeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetSnowflakeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetSnowflake_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/datasetsqlservertable/zz_controller.go b/internal/controller/datafactory/datasetsqlservertable/zz_controller.go index da06e3af4..1e2363a93 100755 --- a/internal/controller/datafactory/datasetsqlservertable/zz_controller.go +++ b/internal/controller/datafactory/datasetsqlservertable/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetSQLServerTable // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetSQLServerTableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetSQLServerTableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetSQLServerTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/factory/zz_controller.go b/internal/controller/datafactory/factory/zz_controller.go index f4e043772..95f536aa8 100755 --- a/internal/controller/datafactory/factory/zz_controller.go +++ b/internal/controller/datafactory/factory/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Factory // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FactoryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FactoryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Factory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/integrationruntimeazure/zz_controller.go b/internal/controller/datafactory/integrationruntimeazure/zz_controller.go index b50ca17e1..37f89ab2e 100755 --- a/internal/controller/datafactory/integrationruntimeazure/zz_controller.go +++ b/internal/controller/datafactory/integrationruntimeazure/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IntegrationRuntimeAzure // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IntegrationRuntimeAzureList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IntegrationRuntimeAzureList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationRuntimeAzure_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/integrationruntimeazuressis/zz_controller.go b/internal/controller/datafactory/integrationruntimeazuressis/zz_controller.go index 073351eb7..04d702202 100755 --- a/internal/controller/datafactory/integrationruntimeazuressis/zz_controller.go +++ b/internal/controller/datafactory/integrationruntimeazuressis/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IntegrationRuntimeAzureSSIS // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IntegrationRuntimeAzureSSISList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IntegrationRuntimeAzureSSISList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IntegrationRuntimeAzureSSIS_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/integrationruntimemanaged/zz_controller.go b/internal/controller/datafactory/integrationruntimemanaged/zz_controller.go index c55809eef..c19383f39 100755 --- a/internal/controller/datafactory/integrationruntimemanaged/zz_controller.go +++ b/internal/controller/datafactory/integrationruntimemanaged/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IntegrationRuntimeManaged // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IntegrationRuntimeManagedList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IntegrationRuntimeManagedList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IntegrationRuntimeManaged_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/integrationruntimeselfhosted/zz_controller.go b/internal/controller/datafactory/integrationruntimeselfhosted/zz_controller.go index 230abfd57..a0c52d27b 100755 --- a/internal/controller/datafactory/integrationruntimeselfhosted/zz_controller.go +++ b/internal/controller/datafactory/integrationruntimeselfhosted/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IntegrationRuntimeSelfHosted // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IntegrationRuntimeSelfHostedList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IntegrationRuntimeSelfHostedList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationRuntimeSelfHosted_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedcustomservice/zz_controller.go b/internal/controller/datafactory/linkedcustomservice/zz_controller.go index e86d4a256..938fd3b56 100755 --- a/internal/controller/datafactory/linkedcustomservice/zz_controller.go +++ b/internal/controller/datafactory/linkedcustomservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedCustomService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedCustomServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedCustomServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedCustomService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazureblobstorage/zz_controller.go b/internal/controller/datafactory/linkedserviceazureblobstorage/zz_controller.go index 08f92ae06..6ef4e88ed 100755 --- a/internal/controller/datafactory/linkedserviceazureblobstorage/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazureblobstorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceAzureBlobStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceAzureBlobStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceAzureBlobStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceAzureBlobStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazuredatabricks/zz_controller.go b/internal/controller/datafactory/linkedserviceazuredatabricks/zz_controller.go index 23714e28b..4479f3d8d 100755 --- a/internal/controller/datafactory/linkedserviceazuredatabricks/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazuredatabricks/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceAzureDatabricks // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceAzureDatabricksList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceAzureDatabricksList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceAzureDatabricks_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazurefilestorage/zz_controller.go b/internal/controller/datafactory/linkedserviceazurefilestorage/zz_controller.go index d9343409e..6db1ea785 100755 --- a/internal/controller/datafactory/linkedserviceazurefilestorage/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazurefilestorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceAzureFileStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceAzureFileStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceAzureFileStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceAzureFileStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazurefunction/zz_controller.go b/internal/controller/datafactory/linkedserviceazurefunction/zz_controller.go index 52f849713..6ba41e30c 100755 --- a/internal/controller/datafactory/linkedserviceazurefunction/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazurefunction/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceAzureFunction // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceAzureFunctionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceAzureFunctionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceAzureFunction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazuresearch/zz_controller.go b/internal/controller/datafactory/linkedserviceazuresearch/zz_controller.go index b739293fe..54d06dae9 100755 --- a/internal/controller/datafactory/linkedserviceazuresearch/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazuresearch/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceAzureSearch // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceAzureSearchList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceAzureSearchList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceAzureSearch_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazuresqldatabase/zz_controller.go b/internal/controller/datafactory/linkedserviceazuresqldatabase/zz_controller.go index b6e673654..547019836 100755 --- a/internal/controller/datafactory/linkedserviceazuresqldatabase/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazuresqldatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceAzureSQLDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceAzureSQLDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceAzureSQLDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceAzureSQLDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceazuretablestorage/zz_controller.go b/internal/controller/datafactory/linkedserviceazuretablestorage/zz_controller.go index d11ceb32e..df80dd103 100755 --- a/internal/controller/datafactory/linkedserviceazuretablestorage/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceazuretablestorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceAzureTableStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceAzureTableStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceAzureTableStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceAzureTableStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicecosmosdb/zz_controller.go b/internal/controller/datafactory/linkedservicecosmosdb/zz_controller.go index a8949d3be..b9e856e67 100755 --- a/internal/controller/datafactory/linkedservicecosmosdb/zz_controller.go +++ b/internal/controller/datafactory/linkedservicecosmosdb/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceCosmosDB // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceCosmosDBList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceCosmosDBList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceCosmosDB_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicecosmosdbmongoapi/zz_controller.go b/internal/controller/datafactory/linkedservicecosmosdbmongoapi/zz_controller.go index 30cc1a0be..e1cf5b26f 100755 --- a/internal/controller/datafactory/linkedservicecosmosdbmongoapi/zz_controller.go +++ b/internal/controller/datafactory/linkedservicecosmosdbmongoapi/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceCosmosDBMongoapi // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceCosmosDBMongoapiList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceCosmosDBMongoapiList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceCosmosDBMongoapi_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicedatalakestoragegen2/zz_controller.go b/internal/controller/datafactory/linkedservicedatalakestoragegen2/zz_controller.go index 5c37188fc..502536f0e 100755 --- a/internal/controller/datafactory/linkedservicedatalakestoragegen2/zz_controller.go +++ b/internal/controller/datafactory/linkedservicedatalakestoragegen2/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceDataLakeStorageGen2 // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceDataLakeStorageGen2List{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceDataLakeStorageGen2List") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceDataLakeStorageGen2_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicekeyvault/zz_controller.go b/internal/controller/datafactory/linkedservicekeyvault/zz_controller.go index d5b6b10bf..6c675023b 100755 --- a/internal/controller/datafactory/linkedservicekeyvault/zz_controller.go +++ b/internal/controller/datafactory/linkedservicekeyvault/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceKeyVault // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceKeyVaultList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceKeyVaultList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceKeyVault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicekusto/zz_controller.go b/internal/controller/datafactory/linkedservicekusto/zz_controller.go index 8c523e989..1fe54e707 100755 --- a/internal/controller/datafactory/linkedservicekusto/zz_controller.go +++ b/internal/controller/datafactory/linkedservicekusto/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceKusto // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceKustoList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceKustoList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceKusto_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicemysql/zz_controller.go b/internal/controller/datafactory/linkedservicemysql/zz_controller.go index b51c7f804..ade53575b 100755 --- a/internal/controller/datafactory/linkedservicemysql/zz_controller.go +++ b/internal/controller/datafactory/linkedservicemysql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceMySQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceMySQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceMySQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceMySQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceodata/zz_controller.go b/internal/controller/datafactory/linkedserviceodata/zz_controller.go index c925e7b84..0b0381bb7 100755 --- a/internal/controller/datafactory/linkedserviceodata/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceodata/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceOData // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceODataList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceODataList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceOData_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceodbc/zz_controller.go b/internal/controller/datafactory/linkedserviceodbc/zz_controller.go index 3020a9f19..0236701a7 100755 --- a/internal/controller/datafactory/linkedserviceodbc/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceodbc/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceOdbc // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceOdbcList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceOdbcList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceOdbc_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicepostgresql/zz_controller.go b/internal/controller/datafactory/linkedservicepostgresql/zz_controller.go index 945722391..bb4dffea4 100755 --- a/internal/controller/datafactory/linkedservicepostgresql/zz_controller.go +++ b/internal/controller/datafactory/linkedservicepostgresql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServicePostgreSQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServicePostgreSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServicePostgreSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServicePostgreSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicesftp/zz_controller.go b/internal/controller/datafactory/linkedservicesftp/zz_controller.go index 82333efe8..da59582ff 100755 --- a/internal/controller/datafactory/linkedservicesftp/zz_controller.go +++ b/internal/controller/datafactory/linkedservicesftp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceSFTP // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceSFTPList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceSFTPList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceSFTP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicesnowflake/zz_controller.go b/internal/controller/datafactory/linkedservicesnowflake/zz_controller.go index 24ae208df..1156c4efe 100755 --- a/internal/controller/datafactory/linkedservicesnowflake/zz_controller.go +++ b/internal/controller/datafactory/linkedservicesnowflake/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceSnowflake // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceSnowflakeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceSnowflakeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceSnowflake_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicesqlserver/zz_controller.go b/internal/controller/datafactory/linkedservicesqlserver/zz_controller.go index 8b01311f7..822efe0f9 100755 --- a/internal/controller/datafactory/linkedservicesqlserver/zz_controller.go +++ b/internal/controller/datafactory/linkedservicesqlserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceSQLServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceSQLServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceSQLServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceSQLServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedservicesynapse/zz_controller.go b/internal/controller/datafactory/linkedservicesynapse/zz_controller.go index 5b37c8b56..36982f1b9 100755 --- a/internal/controller/datafactory/linkedservicesynapse/zz_controller.go +++ b/internal/controller/datafactory/linkedservicesynapse/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedServiceSynapse // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceSynapseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceSynapseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedServiceSynapse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/linkedserviceweb/zz_controller.go b/internal/controller/datafactory/linkedserviceweb/zz_controller.go index e9f8d687a..b57688452 100755 --- a/internal/controller/datafactory/linkedserviceweb/zz_controller.go +++ b/internal/controller/datafactory/linkedserviceweb/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LinkedServiceWeb // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LinkedServiceWebList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LinkedServiceWebList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkedServiceWeb_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/managedprivateendpoint/zz_controller.go b/internal/controller/datafactory/managedprivateendpoint/zz_controller.go index d5044475f..8e0f2bced 100755 --- a/internal/controller/datafactory/managedprivateendpoint/zz_controller.go +++ b/internal/controller/datafactory/managedprivateendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedPrivateEndpoint // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedPrivateEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedPrivateEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPrivateEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/pipeline/zz_controller.go b/internal/controller/datafactory/pipeline/zz_controller.go index 516263b25..bff26f326 100755 --- a/internal/controller/datafactory/pipeline/zz_controller.go +++ b/internal/controller/datafactory/pipeline/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Pipeline // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PipelineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PipelineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Pipeline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/triggerblobevent/zz_controller.go b/internal/controller/datafactory/triggerblobevent/zz_controller.go index 16d963a03..97e02dea5 100755 --- a/internal/controller/datafactory/triggerblobevent/zz_controller.go +++ b/internal/controller/datafactory/triggerblobevent/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TriggerBlobEvent // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TriggerBlobEventList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TriggerBlobEventList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TriggerBlobEvent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/triggercustomevent/zz_controller.go b/internal/controller/datafactory/triggercustomevent/zz_controller.go index 90fde35cb..553044429 100755 --- a/internal/controller/datafactory/triggercustomevent/zz_controller.go +++ b/internal/controller/datafactory/triggercustomevent/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TriggerCustomEvent // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TriggerCustomEventList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TriggerCustomEventList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TriggerCustomEvent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datafactory/triggerschedule/zz_controller.go b/internal/controller/datafactory/triggerschedule/zz_controller.go index d496bdeb5..4f0d00000 100755 --- a/internal/controller/datafactory/triggerschedule/zz_controller.go +++ b/internal/controller/datafactory/triggerschedule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.TriggerSchedule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TriggerScheduleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TriggerScheduleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.TriggerSchedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datamigration/databasemigrationproject/zz_controller.go b/internal/controller/datamigration/databasemigrationproject/zz_controller.go index a31e6bf38..f3fad087f 100755 --- a/internal/controller/datamigration/databasemigrationproject/zz_controller.go +++ b/internal/controller/datamigration/databasemigrationproject/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DatabaseMigrationProject // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseMigrationProjectList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseMigrationProjectList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DatabaseMigrationProject_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datamigration/databasemigrationservice/zz_controller.go b/internal/controller/datamigration/databasemigrationservice/zz_controller.go index be39fdc73..965ae1808 100755 --- a/internal/controller/datamigration/databasemigrationservice/zz_controller.go +++ b/internal/controller/datamigration/databasemigrationservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DatabaseMigrationService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseMigrationServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseMigrationServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DatabaseMigrationService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backupinstanceblobstorage/zz_controller.go b/internal/controller/dataprotection/backupinstanceblobstorage/zz_controller.go index bca7c1bac..d3ff32ed7 100755 --- a/internal/controller/dataprotection/backupinstanceblobstorage/zz_controller.go +++ b/internal/controller/dataprotection/backupinstanceblobstorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupInstanceBlobStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupInstanceBlobStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupInstanceBlobStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupInstanceBlobStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backupinstancedisk/zz_controller.go b/internal/controller/dataprotection/backupinstancedisk/zz_controller.go index eff5b00df..bb9640b45 100755 --- a/internal/controller/dataprotection/backupinstancedisk/zz_controller.go +++ b/internal/controller/dataprotection/backupinstancedisk/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupInstanceDisk // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupInstanceDiskList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupInstanceDiskList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupInstanceDisk_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backupinstancepostgresql/zz_controller.go b/internal/controller/dataprotection/backupinstancepostgresql/zz_controller.go index ebaf17d23..e0357c33d 100755 --- a/internal/controller/dataprotection/backupinstancepostgresql/zz_controller.go +++ b/internal/controller/dataprotection/backupinstancepostgresql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupInstancePostgreSQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupInstancePostgreSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupInstancePostgreSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupInstancePostgreSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backuppolicyblobstorage/zz_controller.go b/internal/controller/dataprotection/backuppolicyblobstorage/zz_controller.go index a022666de..0c7c243a4 100755 --- a/internal/controller/dataprotection/backuppolicyblobstorage/zz_controller.go +++ b/internal/controller/dataprotection/backuppolicyblobstorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupPolicyBlobStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupPolicyBlobStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupPolicyBlobStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupPolicyBlobStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backuppolicydisk/zz_controller.go b/internal/controller/dataprotection/backuppolicydisk/zz_controller.go index 0c9df9ab6..e6294108c 100755 --- a/internal/controller/dataprotection/backuppolicydisk/zz_controller.go +++ b/internal/controller/dataprotection/backuppolicydisk/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupPolicyDisk // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupPolicyDiskList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupPolicyDiskList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupPolicyDisk_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backuppolicypostgresql/zz_controller.go b/internal/controller/dataprotection/backuppolicypostgresql/zz_controller.go index 4d0c9eda3..2907683f6 100755 --- a/internal/controller/dataprotection/backuppolicypostgresql/zz_controller.go +++ b/internal/controller/dataprotection/backuppolicypostgresql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupPolicyPostgreSQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupPolicyPostgreSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupPolicyPostgreSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupPolicyPostgreSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/backupvault/zz_controller.go b/internal/controller/dataprotection/backupvault/zz_controller.go index 0d67c28a1..ddeb00434 100755 --- a/internal/controller/dataprotection/backupvault/zz_controller.go +++ b/internal/controller/dataprotection/backupvault/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupVault // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupVaultList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupVaultList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupVault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataprotection/resourceguard/zz_controller.go b/internal/controller/dataprotection/resourceguard/zz_controller.go index a72b7b30e..33755a4e4 100755 --- a/internal/controller/dataprotection/resourceguard/zz_controller.go +++ b/internal/controller/dataprotection/resourceguard/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourceGuard // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourceGuardList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourceGuardList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceGuard_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/account/zz_controller.go b/internal/controller/datashare/account/zz_controller.go index 6787f7964..aaf2f9f06 100755 --- a/internal/controller/datashare/account/zz_controller.go +++ b/internal/controller/datashare/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/datasetblobstorage/zz_controller.go b/internal/controller/datashare/datasetblobstorage/zz_controller.go index 30d8179ac..ebd7068ba 100755 --- a/internal/controller/datashare/datasetblobstorage/zz_controller.go +++ b/internal/controller/datashare/datasetblobstorage/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataSetBlobStorage // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataSetBlobStorageList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataSetBlobStorageList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataSetBlobStorage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/datasetdatalakegen2/zz_controller.go b/internal/controller/datashare/datasetdatalakegen2/zz_controller.go index f3b67a236..0733eae60 100755 --- a/internal/controller/datashare/datasetdatalakegen2/zz_controller.go +++ b/internal/controller/datashare/datasetdatalakegen2/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetDataLakeGen2 // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetDataLakeGen2List{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetDataLakeGen2List") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetDataLakeGen2_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/datasetkustocluster/zz_controller.go b/internal/controller/datashare/datasetkustocluster/zz_controller.go index 6b351a894..7f765e17f 100755 --- a/internal/controller/datashare/datasetkustocluster/zz_controller.go +++ b/internal/controller/datashare/datasetkustocluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetKustoCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetKustoClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetKustoClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetKustoCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/datasetkustodatabase/zz_controller.go b/internal/controller/datashare/datasetkustodatabase/zz_controller.go index e4c2d3642..37aed919d 100755 --- a/internal/controller/datashare/datasetkustodatabase/zz_controller.go +++ b/internal/controller/datashare/datasetkustodatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataSetKustoDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataSetKustoDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataSetKustoDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSetKustoDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datashare/datashare/zz_controller.go b/internal/controller/datashare/datashare/zz_controller.go index 70391209a..1246b8b5c 100755 --- a/internal/controller/datashare/datashare/zz_controller.go +++ b/internal/controller/datashare/datashare/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DataShare // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DataShareList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DataShareList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DataShare_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformariadb/configuration/zz_controller.go b/internal/controller/dbformariadb/configuration/zz_controller.go index 973968be2..e9b91e372 100755 --- a/internal/controller/dbformariadb/configuration/zz_controller.go +++ b/internal/controller/dbformariadb/configuration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Configuration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformariadb/database/zz_controller.go b/internal/controller/dbformariadb/database/zz_controller.go index 963b00ce0..a57086b02 100755 --- a/internal/controller/dbformariadb/database/zz_controller.go +++ b/internal/controller/dbformariadb/database/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Database // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformariadb/firewallrule/zz_controller.go b/internal/controller/dbformariadb/firewallrule/zz_controller.go index 6ce9728c8..983aa18be 100755 --- a/internal/controller/dbformariadb/firewallrule/zz_controller.go +++ b/internal/controller/dbformariadb/firewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformariadb/server/zz_controller.go b/internal/controller/dbformariadb/server/zz_controller.go index a4d7399c6..1bc5de0ba 100755 --- a/internal/controller/dbformariadb/server/zz_controller.go +++ b/internal/controller/dbformariadb/server/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Server // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformariadb/virtualnetworkrule/zz_controller.go b/internal/controller/dbformariadb/virtualnetworkrule/zz_controller.go index 3ba8ddec6..d3f7ef582 100755 --- a/internal/controller/dbformariadb/virtualnetworkrule/zz_controller.go +++ b/internal/controller/dbformariadb/virtualnetworkrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualNetworkRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualNetworkRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualNetworkRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualNetworkRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/activedirectoryadministrator/zz_controller.go b/internal/controller/dbformysql/activedirectoryadministrator/zz_controller.go index 774812b28..0a617bc34 100755 --- a/internal/controller/dbformysql/activedirectoryadministrator/zz_controller.go +++ b/internal/controller/dbformysql/activedirectoryadministrator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ActiveDirectoryAdministrator // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ActiveDirectoryAdministratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ActiveDirectoryAdministratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ActiveDirectoryAdministrator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/configuration/zz_controller.go b/internal/controller/dbformysql/configuration/zz_controller.go index c2f5b131c..3b3cb9f0e 100755 --- a/internal/controller/dbformysql/configuration/zz_controller.go +++ b/internal/controller/dbformysql/configuration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Configuration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/database/zz_controller.go b/internal/controller/dbformysql/database/zz_controller.go index 92f219bf3..9d2999fdb 100755 --- a/internal/controller/dbformysql/database/zz_controller.go +++ b/internal/controller/dbformysql/database/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Database // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/firewallrule/zz_controller.go b/internal/controller/dbformysql/firewallrule/zz_controller.go index 7cc3602b2..a20ff8a11 100755 --- a/internal/controller/dbformysql/firewallrule/zz_controller.go +++ b/internal/controller/dbformysql/firewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/flexibledatabase/zz_controller.go b/internal/controller/dbformysql/flexibledatabase/zz_controller.go index 9fd5931c4..3672d90c5 100755 --- a/internal/controller/dbformysql/flexibledatabase/zz_controller.go +++ b/internal/controller/dbformysql/flexibledatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/flexibleserver/zz_controller.go b/internal/controller/dbformysql/flexibleserver/zz_controller.go index 4d0ac303a..206308ff2 100755 --- a/internal/controller/dbformysql/flexibleserver/zz_controller.go +++ b/internal/controller/dbformysql/flexibleserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FlexibleServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FlexibleServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FlexibleServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FlexibleServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/flexibleserverconfiguration/zz_controller.go b/internal/controller/dbformysql/flexibleserverconfiguration/zz_controller.go index 7c2203540..47378bd42 100755 --- a/internal/controller/dbformysql/flexibleserverconfiguration/zz_controller.go +++ b/internal/controller/dbformysql/flexibleserverconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerConfiguration // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/flexibleserverfirewallrule/zz_controller.go b/internal/controller/dbformysql/flexibleserverfirewallrule/zz_controller.go index 03f29fc69..ae0904624 100755 --- a/internal/controller/dbformysql/flexibleserverfirewallrule/zz_controller.go +++ b/internal/controller/dbformysql/flexibleserverfirewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerFirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerFirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerFirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerFirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/server/zz_controller.go b/internal/controller/dbformysql/server/zz_controller.go index 520c5ea83..8f6354a4b 100755 --- a/internal/controller/dbformysql/server/zz_controller.go +++ b/internal/controller/dbformysql/server/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Server // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbformysql/virtualnetworkrule/zz_controller.go b/internal/controller/dbformysql/virtualnetworkrule/zz_controller.go index db00eae8f..7630a01cf 100755 --- a/internal/controller/dbformysql/virtualnetworkrule/zz_controller.go +++ b/internal/controller/dbformysql/virtualnetworkrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualNetworkRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualNetworkRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualNetworkRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualNetworkRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/activedirectoryadministrator/zz_controller.go b/internal/controller/dbforpostgresql/activedirectoryadministrator/zz_controller.go index 9ca57ad1e..6382835fc 100755 --- a/internal/controller/dbforpostgresql/activedirectoryadministrator/zz_controller.go +++ b/internal/controller/dbforpostgresql/activedirectoryadministrator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ActiveDirectoryAdministrator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ActiveDirectoryAdministratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ActiveDirectoryAdministratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ActiveDirectoryAdministrator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/configuration/zz_controller.go b/internal/controller/dbforpostgresql/configuration/zz_controller.go index 95c8579a5..ff71f1f12 100755 --- a/internal/controller/dbforpostgresql/configuration/zz_controller.go +++ b/internal/controller/dbforpostgresql/configuration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Configuration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/database/zz_controller.go b/internal/controller/dbforpostgresql/database/zz_controller.go index 3845c732e..a5081d6b4 100755 --- a/internal/controller/dbforpostgresql/database/zz_controller.go +++ b/internal/controller/dbforpostgresql/database/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Database // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/firewallrule/zz_controller.go b/internal/controller/dbforpostgresql/firewallrule/zz_controller.go index de7374852..c162d8c0d 100755 --- a/internal/controller/dbforpostgresql/firewallrule/zz_controller.go +++ b/internal/controller/dbforpostgresql/firewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/flexibleserver/zz_controller.go b/internal/controller/dbforpostgresql/flexibleserver/zz_controller.go index 343b4add5..8beb613bd 100755 --- a/internal/controller/dbforpostgresql/flexibleserver/zz_controller.go +++ b/internal/controller/dbforpostgresql/flexibleserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -60,6 +61,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FlexibleServer // if they're enabled. @@ -71,6 +75,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FlexibleServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FlexibleServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FlexibleServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/flexibleserveractivedirectoryadministrator/zz_controller.go b/internal/controller/dbforpostgresql/flexibleserveractivedirectoryadministrator/zz_controller.go index d87f6e42a..2c00028be 100755 --- a/internal/controller/dbforpostgresql/flexibleserveractivedirectoryadministrator/zz_controller.go +++ b/internal/controller/dbforpostgresql/flexibleserveractivedirectoryadministrator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerActiveDirectoryAdministrator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerActiveDirectoryAdministratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerActiveDirectoryAdministratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerActiveDirectoryAdministrator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/flexibleserverconfiguration/zz_controller.go b/internal/controller/dbforpostgresql/flexibleserverconfiguration/zz_controller.go index fe162b587..c3b222743 100755 --- a/internal/controller/dbforpostgresql/flexibleserverconfiguration/zz_controller.go +++ b/internal/controller/dbforpostgresql/flexibleserverconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerConfiguration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/flexibleserverdatabase/zz_controller.go b/internal/controller/dbforpostgresql/flexibleserverdatabase/zz_controller.go index 4f30d137e..4ed819a7a 100755 --- a/internal/controller/dbforpostgresql/flexibleserverdatabase/zz_controller.go +++ b/internal/controller/dbforpostgresql/flexibleserverdatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/flexibleserverfirewallrule/zz_controller.go b/internal/controller/dbforpostgresql/flexibleserverfirewallrule/zz_controller.go index a6003686e..9c63e1b19 100755 --- a/internal/controller/dbforpostgresql/flexibleserverfirewallrule/zz_controller.go +++ b/internal/controller/dbforpostgresql/flexibleserverfirewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FlexibleServerFirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FlexibleServerFirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FlexibleServerFirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlexibleServerFirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/server/zz_controller.go b/internal/controller/dbforpostgresql/server/zz_controller.go index 52818c39e..b77c5895b 100755 --- a/internal/controller/dbforpostgresql/server/zz_controller.go +++ b/internal/controller/dbforpostgresql/server/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Server // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/serverkey/zz_controller.go b/internal/controller/dbforpostgresql/serverkey/zz_controller.go index cc41cffd6..1c72e9e06 100755 --- a/internal/controller/dbforpostgresql/serverkey/zz_controller.go +++ b/internal/controller/dbforpostgresql/serverkey/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ServerKey // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServerKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServerKeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServerKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dbforpostgresql/virtualnetworkrule/zz_controller.go b/internal/controller/dbforpostgresql/virtualnetworkrule/zz_controller.go index 990d646e1..2f111bf9f 100755 --- a/internal/controller/dbforpostgresql/virtualnetworkrule/zz_controller.go +++ b/internal/controller/dbforpostgresql/virtualnetworkrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualNetworkRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualNetworkRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualNetworkRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualNetworkRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothub/zz_controller.go b/internal/controller/devices/iothub/zz_controller.go index d0cebc051..675c9e928 100755 --- a/internal/controller/devices/iothub/zz_controller.go +++ b/internal/controller/devices/iothub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubcertificate/zz_controller.go b/internal/controller/devices/iothubcertificate/zz_controller.go index df69b4be0..067982eb7 100755 --- a/internal/controller/devices/iothubcertificate/zz_controller.go +++ b/internal/controller/devices/iothubcertificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubCertificate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubCertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubCertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubconsumergroup/zz_controller.go b/internal/controller/devices/iothubconsumergroup/zz_controller.go index 88132c08b..8af0f763f 100755 --- a/internal/controller/devices/iothubconsumergroup/zz_controller.go +++ b/internal/controller/devices/iothubconsumergroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubConsumerGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubConsumerGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubConsumerGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubConsumerGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubdps/zz_controller.go b/internal/controller/devices/iothubdps/zz_controller.go index a28c52a16..2baf999f0 100755 --- a/internal/controller/devices/iothubdps/zz_controller.go +++ b/internal/controller/devices/iothubdps/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTHubDPS // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTHubDPSList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTHubDPSList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTHubDPS_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubdpscertificate/zz_controller.go b/internal/controller/devices/iothubdpscertificate/zz_controller.go index f4985b486..a069af1e8 100755 --- a/internal/controller/devices/iothubdpscertificate/zz_controller.go +++ b/internal/controller/devices/iothubdpscertificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubDPSCertificate // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubDPSCertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubDPSCertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubDPSCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubdpssharedaccesspolicy/zz_controller.go b/internal/controller/devices/iothubdpssharedaccesspolicy/zz_controller.go index 23ece2a85..84b961f59 100755 --- a/internal/controller/devices/iothubdpssharedaccesspolicy/zz_controller.go +++ b/internal/controller/devices/iothubdpssharedaccesspolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubDPSSharedAccessPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubDPSSharedAccessPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubDPSSharedAccessPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubDPSSharedAccessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubendpointeventhub/zz_controller.go b/internal/controller/devices/iothubendpointeventhub/zz_controller.go index afa1fac49..68828a738 100755 --- a/internal/controller/devices/iothubendpointeventhub/zz_controller.go +++ b/internal/controller/devices/iothubendpointeventhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubEndpointEventHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubEndpointEventHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubEndpointEventHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubEndpointEventHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubendpointservicebusqueue/zz_controller.go b/internal/controller/devices/iothubendpointservicebusqueue/zz_controller.go index e40da9dde..af7dd8d2a 100755 --- a/internal/controller/devices/iothubendpointservicebusqueue/zz_controller.go +++ b/internal/controller/devices/iothubendpointservicebusqueue/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubEndpointServiceBusQueue // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubEndpointServiceBusQueueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubEndpointServiceBusQueueList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubEndpointServiceBusQueue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubendpointservicebustopic/zz_controller.go b/internal/controller/devices/iothubendpointservicebustopic/zz_controller.go index e1b46ad11..524dc4e39 100755 --- a/internal/controller/devices/iothubendpointservicebustopic/zz_controller.go +++ b/internal/controller/devices/iothubendpointservicebustopic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubEndpointServiceBusTopic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubEndpointServiceBusTopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubEndpointServiceBusTopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubEndpointServiceBusTopic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubendpointstoragecontainer/zz_controller.go b/internal/controller/devices/iothubendpointstoragecontainer/zz_controller.go index 399568e5d..fb2d56689 100755 --- a/internal/controller/devices/iothubendpointstoragecontainer/zz_controller.go +++ b/internal/controller/devices/iothubendpointstoragecontainer/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubEndpointStorageContainer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubEndpointStorageContainerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubEndpointStorageContainerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubEndpointStorageContainer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubenrichment/zz_controller.go b/internal/controller/devices/iothubenrichment/zz_controller.go index 30ac52ad5..0337bdcdb 100755 --- a/internal/controller/devices/iothubenrichment/zz_controller.go +++ b/internal/controller/devices/iothubenrichment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubEnrichment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubEnrichmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubEnrichmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubEnrichment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubfallbackroute/zz_controller.go b/internal/controller/devices/iothubfallbackroute/zz_controller.go index 4f9a23752..00e23dc6e 100755 --- a/internal/controller/devices/iothubfallbackroute/zz_controller.go +++ b/internal/controller/devices/iothubfallbackroute/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubFallbackRoute // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubFallbackRouteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubFallbackRouteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubFallbackRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubroute/zz_controller.go b/internal/controller/devices/iothubroute/zz_controller.go index c72fe7d6c..9e10d9341 100755 --- a/internal/controller/devices/iothubroute/zz_controller.go +++ b/internal/controller/devices/iothubroute/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubRoute // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubRouteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubRouteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devices/iothubsharedaccesspolicy/zz_controller.go b/internal/controller/devices/iothubsharedaccesspolicy/zz_controller.go index f3a95c9ad..ffa3f21f0 100755 --- a/internal/controller/devices/iothubsharedaccesspolicy/zz_controller.go +++ b/internal/controller/devices/iothubsharedaccesspolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubSharedAccessPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubSharedAccessPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubSharedAccessPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubSharedAccessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/deviceupdate/iothubdeviceupdateaccount/zz_controller.go b/internal/controller/deviceupdate/iothubdeviceupdateaccount/zz_controller.go index d8bb2c42f..a15928f91 100755 --- a/internal/controller/deviceupdate/iothubdeviceupdateaccount/zz_controller.go +++ b/internal/controller/deviceupdate/iothubdeviceupdateaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTHubDeviceUpdateAccount // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTHubDeviceUpdateAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTHubDeviceUpdateAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTHubDeviceUpdateAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/deviceupdate/iothubdeviceupdateinstance/zz_controller.go b/internal/controller/deviceupdate/iothubdeviceupdateinstance/zz_controller.go index d1dd2dfc9..5ff1afdf2 100755 --- a/internal/controller/deviceupdate/iothubdeviceupdateinstance/zz_controller.go +++ b/internal/controller/deviceupdate/iothubdeviceupdateinstance/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTHubDeviceUpdateInstance // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTHubDeviceUpdateInstanceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTHubDeviceUpdateInstanceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTHubDeviceUpdateInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/globalvmshutdownschedule/zz_controller.go b/internal/controller/devtestlab/globalvmshutdownschedule/zz_controller.go index 40eba7caf..b0e975e1f 100755 --- a/internal/controller/devtestlab/globalvmshutdownschedule/zz_controller.go +++ b/internal/controller/devtestlab/globalvmshutdownschedule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.GlobalVMShutdownSchedule // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.GlobalVMShutdownScheduleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.GlobalVMShutdownScheduleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.GlobalVMShutdownSchedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/lab/zz_controller.go b/internal/controller/devtestlab/lab/zz_controller.go index cb084c330..846fb31d2 100755 --- a/internal/controller/devtestlab/lab/zz_controller.go +++ b/internal/controller/devtestlab/lab/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Lab // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LabList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LabList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Lab_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/linuxvirtualmachine/zz_controller.go b/internal/controller/devtestlab/linuxvirtualmachine/zz_controller.go index 50fdd0fa2..fe9cfe3e6 100755 --- a/internal/controller/devtestlab/linuxvirtualmachine/zz_controller.go +++ b/internal/controller/devtestlab/linuxvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxVirtualMachine // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/policy/zz_controller.go b/internal/controller/devtestlab/policy/zz_controller.go index f649050d3..117cec53d 100755 --- a/internal/controller/devtestlab/policy/zz_controller.go +++ b/internal/controller/devtestlab/policy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Policy // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/schedule/zz_controller.go b/internal/controller/devtestlab/schedule/zz_controller.go index 465ad04f4..464bb7a0e 100755 --- a/internal/controller/devtestlab/schedule/zz_controller.go +++ b/internal/controller/devtestlab/schedule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Schedule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ScheduleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ScheduleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Schedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/virtualnetwork/zz_controller.go b/internal/controller/devtestlab/virtualnetwork/zz_controller.go index ee9bf70ab..4b361ae96 100755 --- a/internal/controller/devtestlab/virtualnetwork/zz_controller.go +++ b/internal/controller/devtestlab/virtualnetwork/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualNetwork // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualNetworkList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualNetworkList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualNetwork_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devtestlab/windowsvirtualmachine/zz_controller.go b/internal/controller/devtestlab/windowsvirtualmachine/zz_controller.go index 1121651b6..c5890aacb 100755 --- a/internal/controller/devtestlab/windowsvirtualmachine/zz_controller.go +++ b/internal/controller/devtestlab/windowsvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsVirtualMachine // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/digitaltwins/instance/zz_controller.go b/internal/controller/digitaltwins/instance/zz_controller.go index c4061e64a..fbeafd87e 100755 --- a/internal/controller/digitaltwins/instance/zz_controller.go +++ b/internal/controller/digitaltwins/instance/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Instance // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.InstanceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.InstanceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elastic/cloudelasticsearch/zz_controller.go b/internal/controller/elastic/cloudelasticsearch/zz_controller.go index 4f1172b64..91d6aabfa 100755 --- a/internal/controller/elastic/cloudelasticsearch/zz_controller.go +++ b/internal/controller/elastic/cloudelasticsearch/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.CloudElasticsearch // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CloudElasticsearchList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CloudElasticsearchList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.CloudElasticsearch_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventgrid/domain/zz_controller.go b/internal/controller/eventgrid/domain/zz_controller.go index df72fbe29..ed65a36b1 100755 --- a/internal/controller/eventgrid/domain/zz_controller.go +++ b/internal/controller/eventgrid/domain/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Domain // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DomainList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DomainList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventgrid/domaintopic/zz_controller.go b/internal/controller/eventgrid/domaintopic/zz_controller.go index c91a971db..ed949ffd9 100755 --- a/internal/controller/eventgrid/domaintopic/zz_controller.go +++ b/internal/controller/eventgrid/domaintopic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DomainTopic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DomainTopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DomainTopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainTopic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventgrid/eventsubscription/zz_controller.go b/internal/controller/eventgrid/eventsubscription/zz_controller.go index d87bc3332..66ead0416 100755 --- a/internal/controller/eventgrid/eventsubscription/zz_controller.go +++ b/internal/controller/eventgrid/eventsubscription/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.EventSubscription // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.EventSubscriptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.EventSubscriptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventgrid/systemtopic/zz_controller.go b/internal/controller/eventgrid/systemtopic/zz_controller.go index 53811a995..2eaf0f219 100755 --- a/internal/controller/eventgrid/systemtopic/zz_controller.go +++ b/internal/controller/eventgrid/systemtopic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SystemTopic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SystemTopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SystemTopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SystemTopic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventgrid/topic/zz_controller.go b/internal/controller/eventgrid/topic/zz_controller.go index 2cbe9aaa7..267d7fdd4 100755 --- a/internal/controller/eventgrid/topic/zz_controller.go +++ b/internal/controller/eventgrid/topic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Topic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Topic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/authorizationrule/zz_controller.go b/internal/controller/eventhub/authorizationrule/zz_controller.go index da4a7ce95..88ff570ba 100755 --- a/internal/controller/eventhub/authorizationrule/zz_controller.go +++ b/internal/controller/eventhub/authorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/consumergroup/zz_controller.go b/internal/controller/eventhub/consumergroup/zz_controller.go index b7a140a4e..2a992364d 100755 --- a/internal/controller/eventhub/consumergroup/zz_controller.go +++ b/internal/controller/eventhub/consumergroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ConsumerGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ConsumerGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ConsumerGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConsumerGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/eventhub/zz_controller.go b/internal/controller/eventhub/eventhub/zz_controller.go index f353e9fd1..28544505c 100755 --- a/internal/controller/eventhub/eventhub/zz_controller.go +++ b/internal/controller/eventhub/eventhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.EventHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.EventHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.EventHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.EventHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/eventhubnamespace/zz_controller.go b/internal/controller/eventhub/eventhubnamespace/zz_controller.go index cc590696c..f037add02 100755 --- a/internal/controller/eventhub/eventhubnamespace/zz_controller.go +++ b/internal/controller/eventhub/eventhubnamespace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.EventHubNamespace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.EventHubNamespaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.EventHubNamespaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.EventHubNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/namespaceauthorizationrule/zz_controller.go b/internal/controller/eventhub/namespaceauthorizationrule/zz_controller.go index 8418c78f3..7bbd12d2a 100755 --- a/internal/controller/eventhub/namespaceauthorizationrule/zz_controller.go +++ b/internal/controller/eventhub/namespaceauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/namespacedisasterrecoveryconfig/zz_controller.go b/internal/controller/eventhub/namespacedisasterrecoveryconfig/zz_controller.go index fe1ced2e7..887dffb70 100755 --- a/internal/controller/eventhub/namespacedisasterrecoveryconfig/zz_controller.go +++ b/internal/controller/eventhub/namespacedisasterrecoveryconfig/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceDisasterRecoveryConfig // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceDisasterRecoveryConfigList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceDisasterRecoveryConfigList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceDisasterRecoveryConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eventhub/namespaceschemagroup/zz_controller.go b/internal/controller/eventhub/namespaceschemagroup/zz_controller.go index 141fe3c72..2138372d8 100755 --- a/internal/controller/eventhub/namespaceschemagroup/zz_controller.go +++ b/internal/controller/eventhub/namespaceschemagroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceSchemaGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceSchemaGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceSchemaGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceSchemaGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fluidrelay/server/zz_controller.go b/internal/controller/fluidrelay/server/zz_controller.go index 9c04b1c33..403404c72 100755 --- a/internal/controller/fluidrelay/server/zz_controller.go +++ b/internal/controller/fluidrelay/server/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Server // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/guestconfiguration/policyvirtualmachineconfigurationassignment/zz_controller.go b/internal/controller/guestconfiguration/policyvirtualmachineconfigurationassignment/zz_controller.go index 75867095b..034e8f665 100755 --- a/internal/controller/guestconfiguration/policyvirtualmachineconfigurationassignment/zz_controller.go +++ b/internal/controller/guestconfiguration/policyvirtualmachineconfigurationassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.PolicyVirtualMachineConfigurationAssignment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.PolicyVirtualMachineConfigurationAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.PolicyVirtualMachineConfigurationAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.PolicyVirtualMachineConfigurationAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/hdinsight/hadoopcluster/zz_controller.go b/internal/controller/hdinsight/hadoopcluster/zz_controller.go index 5c4aeb78a..6a85fa251 100755 --- a/internal/controller/hdinsight/hadoopcluster/zz_controller.go +++ b/internal/controller/hdinsight/hadoopcluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HadoopCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HadoopClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HadoopClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HadoopCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/hdinsight/hbasecluster/zz_controller.go b/internal/controller/hdinsight/hbasecluster/zz_controller.go index d3da6015a..2b7cc5c51 100755 --- a/internal/controller/hdinsight/hbasecluster/zz_controller.go +++ b/internal/controller/hdinsight/hbasecluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HBaseCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HBaseClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HBaseClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HBaseCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/hdinsight/interactivequerycluster/zz_controller.go b/internal/controller/hdinsight/interactivequerycluster/zz_controller.go index 876680db3..ad64756f0 100755 --- a/internal/controller/hdinsight/interactivequerycluster/zz_controller.go +++ b/internal/controller/hdinsight/interactivequerycluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.InteractiveQueryCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.InteractiveQueryClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.InteractiveQueryClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.InteractiveQueryCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/hdinsight/kafkacluster/zz_controller.go b/internal/controller/hdinsight/kafkacluster/zz_controller.go index e996d9b4f..3c8431a45 100755 --- a/internal/controller/hdinsight/kafkacluster/zz_controller.go +++ b/internal/controller/hdinsight/kafkacluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.KafkaCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.KafkaClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.KafkaClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.KafkaCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/hdinsight/sparkcluster/zz_controller.go b/internal/controller/hdinsight/sparkcluster/zz_controller.go index 267d6e384..12e425fd1 100755 --- a/internal/controller/hdinsight/sparkcluster/zz_controller.go +++ b/internal/controller/hdinsight/sparkcluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SparkCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SparkClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SparkClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SparkCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthbot/healthbot/zz_controller.go b/internal/controller/healthbot/healthbot/zz_controller.go index d134483ba..0f7507c24 100755 --- a/internal/controller/healthbot/healthbot/zz_controller.go +++ b/internal/controller/healthbot/healthbot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HealthBot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HealthBotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HealthBotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HealthBot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcaredicomservice/zz_controller.go b/internal/controller/healthcareapis/healthcaredicomservice/zz_controller.go index 52bee5c9c..ecb2f34a8 100755 --- a/internal/controller/healthcareapis/healthcaredicomservice/zz_controller.go +++ b/internal/controller/healthcareapis/healthcaredicomservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HealthcareDICOMService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HealthcareDICOMServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HealthcareDICOMServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HealthcareDICOMService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcarefhirservice/zz_controller.go b/internal/controller/healthcareapis/healthcarefhirservice/zz_controller.go index ad54543ee..e4cfb34f6 100755 --- a/internal/controller/healthcareapis/healthcarefhirservice/zz_controller.go +++ b/internal/controller/healthcareapis/healthcarefhirservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HealthcareFHIRService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HealthcareFHIRServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HealthcareFHIRServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HealthcareFHIRService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcaremedtechservice/zz_controller.go b/internal/controller/healthcareapis/healthcaremedtechservice/zz_controller.go index 47051e0c7..e374a0716 100755 --- a/internal/controller/healthcareapis/healthcaremedtechservice/zz_controller.go +++ b/internal/controller/healthcareapis/healthcaremedtechservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HealthcareMedtechService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HealthcareMedtechServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HealthcareMedtechServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HealthcareMedtechService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcaremedtechservicefhirdestination/zz_controller.go b/internal/controller/healthcareapis/healthcaremedtechservicefhirdestination/zz_controller.go index 6c796678b..91b22a2fa 100755 --- a/internal/controller/healthcareapis/healthcaremedtechservicefhirdestination/zz_controller.go +++ b/internal/controller/healthcareapis/healthcaremedtechservicefhirdestination/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HealthcareMedtechServiceFHIRDestination // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HealthcareMedtechServiceFHIRDestinationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HealthcareMedtechServiceFHIRDestinationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HealthcareMedtechServiceFHIRDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcareservice/zz_controller.go b/internal/controller/healthcareapis/healthcareservice/zz_controller.go index b6bd84636..687c495a9 100755 --- a/internal/controller/healthcareapis/healthcareservice/zz_controller.go +++ b/internal/controller/healthcareapis/healthcareservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HealthcareService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HealthcareServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HealthcareServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HealthcareService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/healthcareapis/healthcareworkspace/zz_controller.go b/internal/controller/healthcareapis/healthcareworkspace/zz_controller.go index f04136091..300a04cc5 100755 --- a/internal/controller/healthcareapis/healthcareworkspace/zz_controller.go +++ b/internal/controller/healthcareapis/healthcareworkspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HealthcareWorkspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HealthcareWorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HealthcareWorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HealthcareWorkspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsights/zz_controller.go b/internal/controller/insights/applicationinsights/zz_controller.go index e3cf89468..b4caa5447 100755 --- a/internal/controller/insights/applicationinsights/zz_controller.go +++ b/internal/controller/insights/applicationinsights/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsights // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsights_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightsanalyticsitem/zz_controller.go b/internal/controller/insights/applicationinsightsanalyticsitem/zz_controller.go index 83fa6eea3..b1267e997 100755 --- a/internal/controller/insights/applicationinsightsanalyticsitem/zz_controller.go +++ b/internal/controller/insights/applicationinsightsanalyticsitem/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsightsAnalyticsItem // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsAnalyticsItemList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsAnalyticsItemList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsightsAnalyticsItem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightsapikey/zz_controller.go b/internal/controller/insights/applicationinsightsapikey/zz_controller.go index 495c6e4fc..f4f16ca15 100755 --- a/internal/controller/insights/applicationinsightsapikey/zz_controller.go +++ b/internal/controller/insights/applicationinsightsapikey/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsightsAPIKey // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsAPIKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsAPIKeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsightsAPIKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightssmartdetectionrule/zz_controller.go b/internal/controller/insights/applicationinsightssmartdetectionrule/zz_controller.go index 640df9a98..03860d392 100755 --- a/internal/controller/insights/applicationinsightssmartdetectionrule/zz_controller.go +++ b/internal/controller/insights/applicationinsightssmartdetectionrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsightsSmartDetectionRule // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsSmartDetectionRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsSmartDetectionRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsightsSmartDetectionRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightsstandardwebtest/zz_controller.go b/internal/controller/insights/applicationinsightsstandardwebtest/zz_controller.go index fcfa137c3..6b8fb99b6 100755 --- a/internal/controller/insights/applicationinsightsstandardwebtest/zz_controller.go +++ b/internal/controller/insights/applicationinsightsstandardwebtest/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ApplicationInsightsStandardWebTest // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ApplicationInsightsStandardWebTestList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ApplicationInsightsStandardWebTestList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ApplicationInsightsStandardWebTest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightswebtest/zz_controller.go b/internal/controller/insights/applicationinsightswebtest/zz_controller.go index a36b14566..355ef9a4e 100755 --- a/internal/controller/insights/applicationinsightswebtest/zz_controller.go +++ b/internal/controller/insights/applicationinsightswebtest/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsightsWebTest // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsWebTestList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsWebTestList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsightsWebTest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightsworkbook/zz_controller.go b/internal/controller/insights/applicationinsightsworkbook/zz_controller.go index 32801c87d..30d50153d 100755 --- a/internal/controller/insights/applicationinsightsworkbook/zz_controller.go +++ b/internal/controller/insights/applicationinsightsworkbook/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ApplicationInsightsWorkbook // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ApplicationInsightsWorkbookList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ApplicationInsightsWorkbookList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ApplicationInsightsWorkbook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/applicationinsightsworkbooktemplate/zz_controller.go b/internal/controller/insights/applicationinsightsworkbooktemplate/zz_controller.go index f2895c3ca..f71e35267 100755 --- a/internal/controller/insights/applicationinsightsworkbooktemplate/zz_controller.go +++ b/internal/controller/insights/applicationinsightsworkbooktemplate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationInsightsWorkbookTemplate // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationInsightsWorkbookTemplateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationInsightsWorkbookTemplateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationInsightsWorkbookTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitoractiongroup/zz_controller.go b/internal/controller/insights/monitoractiongroup/zz_controller.go index 3688b5ce5..d37a69d76 100755 --- a/internal/controller/insights/monitoractiongroup/zz_controller.go +++ b/internal/controller/insights/monitoractiongroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorActionGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorActionGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorActionGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorActionGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitoractivitylogalert/zz_controller.go b/internal/controller/insights/monitoractivitylogalert/zz_controller.go index 77c950a69..e10a8354d 100755 --- a/internal/controller/insights/monitoractivitylogalert/zz_controller.go +++ b/internal/controller/insights/monitoractivitylogalert/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorActivityLogAlert // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorActivityLogAlertList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorActivityLogAlertList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorActivityLogAlert_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorautoscalesetting/zz_controller.go b/internal/controller/insights/monitorautoscalesetting/zz_controller.go index 7bf95c7ad..ebe57b510 100755 --- a/internal/controller/insights/monitorautoscalesetting/zz_controller.go +++ b/internal/controller/insights/monitorautoscalesetting/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorAutoscaleSetting // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorAutoscaleSettingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorAutoscaleSettingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorAutoscaleSetting_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitordatacollectionendpoint/zz_controller.go b/internal/controller/insights/monitordatacollectionendpoint/zz_controller.go index 34150e242..b0b5ccd2c 100755 --- a/internal/controller/insights/monitordatacollectionendpoint/zz_controller.go +++ b/internal/controller/insights/monitordatacollectionendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MonitorDataCollectionEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MonitorDataCollectionEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MonitorDataCollectionEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MonitorDataCollectionEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitordatacollectionrule/zz_controller.go b/internal/controller/insights/monitordatacollectionrule/zz_controller.go index ec9120157..2046421e6 100755 --- a/internal/controller/insights/monitordatacollectionrule/zz_controller.go +++ b/internal/controller/insights/monitordatacollectionrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorDataCollectionRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorDataCollectionRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorDataCollectionRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorDataCollectionRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitordatacollectionruleassociation/zz_controller.go b/internal/controller/insights/monitordatacollectionruleassociation/zz_controller.go index df382137f..75c4c83da 100755 --- a/internal/controller/insights/monitordatacollectionruleassociation/zz_controller.go +++ b/internal/controller/insights/monitordatacollectionruleassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MonitorDataCollectionRuleAssociation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MonitorDataCollectionRuleAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MonitorDataCollectionRuleAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MonitorDataCollectionRuleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitordiagnosticsetting/zz_controller.go b/internal/controller/insights/monitordiagnosticsetting/zz_controller.go index bca37dee4..6e4a89a58 100755 --- a/internal/controller/insights/monitordiagnosticsetting/zz_controller.go +++ b/internal/controller/insights/monitordiagnosticsetting/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorDiagnosticSetting // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorDiagnosticSettingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorDiagnosticSettingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorDiagnosticSetting_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitormetricalert/zz_controller.go b/internal/controller/insights/monitormetricalert/zz_controller.go index 05cf6116f..30f8ba99e 100755 --- a/internal/controller/insights/monitormetricalert/zz_controller.go +++ b/internal/controller/insights/monitormetricalert/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorMetricAlert // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorMetricAlertList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorMetricAlertList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorMetricAlert_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorprivatelinkscope/zz_controller.go b/internal/controller/insights/monitorprivatelinkscope/zz_controller.go index 793c4a400..d0676c702 100755 --- a/internal/controller/insights/monitorprivatelinkscope/zz_controller.go +++ b/internal/controller/insights/monitorprivatelinkscope/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MonitorPrivateLinkScope // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MonitorPrivateLinkScopeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MonitorPrivateLinkScopeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MonitorPrivateLinkScope_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorprivatelinkscopedservice/zz_controller.go b/internal/controller/insights/monitorprivatelinkscopedservice/zz_controller.go index 624d08f8c..852b03884 100755 --- a/internal/controller/insights/monitorprivatelinkscopedservice/zz_controller.go +++ b/internal/controller/insights/monitorprivatelinkscopedservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MonitorPrivateLinkScopedService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MonitorPrivateLinkScopedServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MonitorPrivateLinkScopedServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MonitorPrivateLinkScopedService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorscheduledqueryrulesalert/zz_controller.go b/internal/controller/insights/monitorscheduledqueryrulesalert/zz_controller.go index 5ed13a886..37635d16e 100755 --- a/internal/controller/insights/monitorscheduledqueryrulesalert/zz_controller.go +++ b/internal/controller/insights/monitorscheduledqueryrulesalert/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorScheduledQueryRulesAlert // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorScheduledQueryRulesAlertList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorScheduledQueryRulesAlertList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorScheduledQueryRulesAlert_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorscheduledqueryrulesalertv2/zz_controller.go b/internal/controller/insights/monitorscheduledqueryrulesalertv2/zz_controller.go index 00937c988..9cfb5bf63 100755 --- a/internal/controller/insights/monitorscheduledqueryrulesalertv2/zz_controller.go +++ b/internal/controller/insights/monitorscheduledqueryrulesalertv2/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorScheduledQueryRulesAlertV2 // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorScheduledQueryRulesAlertV2List{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorScheduledQueryRulesAlertV2List") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorScheduledQueryRulesAlertV2_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/insights/monitorscheduledqueryruleslog/zz_controller.go b/internal/controller/insights/monitorscheduledqueryruleslog/zz_controller.go index 50a4c71a8..b50046719 100755 --- a/internal/controller/insights/monitorscheduledqueryruleslog/zz_controller.go +++ b/internal/controller/insights/monitorscheduledqueryruleslog/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MonitorScheduledQueryRulesLog // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorScheduledQueryRulesLogList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorScheduledQueryRulesLogList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MonitorScheduledQueryRulesLog_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iotcentral/application/zz_controller.go b/internal/controller/iotcentral/application/zz_controller.go index 9157546ed..314180b32 100755 --- a/internal/controller/iotcentral/application/zz_controller.go +++ b/internal/controller/iotcentral/application/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Application // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ApplicationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ApplicationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iotcentral/applicationnetworkruleset/zz_controller.go b/internal/controller/iotcentral/applicationnetworkruleset/zz_controller.go index 9d02ee173..503cdac41 100755 --- a/internal/controller/iotcentral/applicationnetworkruleset/zz_controller.go +++ b/internal/controller/iotcentral/applicationnetworkruleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationNetworkRuleSet // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationNetworkRuleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationNetworkRuleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationNetworkRuleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/accesspolicy/zz_controller.go b/internal/controller/keyvault/accesspolicy/zz_controller.go index f8d61dd47..78ec7ece1 100755 --- a/internal/controller/keyvault/accesspolicy/zz_controller.go +++ b/internal/controller/keyvault/accesspolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AccessPolicy // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AccessPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AccessPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/certificate/zz_controller.go b/internal/controller/keyvault/certificate/zz_controller.go index bc186a790..0eef0d0d9 100755 --- a/internal/controller/keyvault/certificate/zz_controller.go +++ b/internal/controller/keyvault/certificate/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Certificate // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.CertificateList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.CertificateList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/certificatecontacts/zz_controller.go b/internal/controller/keyvault/certificatecontacts/zz_controller.go index e9f37a3c3..4f048e5bc 100755 --- a/internal/controller/keyvault/certificatecontacts/zz_controller.go +++ b/internal/controller/keyvault/certificatecontacts/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CertificateContacts // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CertificateContactsList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CertificateContactsList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CertificateContacts_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/certificateissuer/zz_controller.go b/internal/controller/keyvault/certificateissuer/zz_controller.go index a98ee4c08..89e0b4d98 100755 --- a/internal/controller/keyvault/certificateissuer/zz_controller.go +++ b/internal/controller/keyvault/certificateissuer/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CertificateIssuer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CertificateIssuerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CertificateIssuerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CertificateIssuer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/key/zz_controller.go b/internal/controller/keyvault/key/zz_controller.go index 5623761de..5290d33d4 100755 --- a/internal/controller/keyvault/key/zz_controller.go +++ b/internal/controller/keyvault/key/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Key // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.KeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.KeyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Key_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/managedhardwaresecuritymodule/zz_controller.go b/internal/controller/keyvault/managedhardwaresecuritymodule/zz_controller.go index 6c6332256..d7244243f 100755 --- a/internal/controller/keyvault/managedhardwaresecuritymodule/zz_controller.go +++ b/internal/controller/keyvault/managedhardwaresecuritymodule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ManagedHardwareSecurityModule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagedHardwareSecurityModuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagedHardwareSecurityModuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ManagedHardwareSecurityModule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/managedstorageaccount/zz_controller.go b/internal/controller/keyvault/managedstorageaccount/zz_controller.go index ec2986a59..47cde45cc 100755 --- a/internal/controller/keyvault/managedstorageaccount/zz_controller.go +++ b/internal/controller/keyvault/managedstorageaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedStorageAccount // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedStorageAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedStorageAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedStorageAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/managedstorageaccountsastokendefinition/zz_controller.go b/internal/controller/keyvault/managedstorageaccountsastokendefinition/zz_controller.go index 317c07e04..c03b8a9e1 100755 --- a/internal/controller/keyvault/managedstorageaccountsastokendefinition/zz_controller.go +++ b/internal/controller/keyvault/managedstorageaccountsastokendefinition/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedStorageAccountSASTokenDefinition // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedStorageAccountSASTokenDefinitionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedStorageAccountSASTokenDefinitionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedStorageAccountSASTokenDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/secret/zz_controller.go b/internal/controller/keyvault/secret/zz_controller.go index 8ff9a547e..fdcb69ea1 100755 --- a/internal/controller/keyvault/secret/zz_controller.go +++ b/internal/controller/keyvault/secret/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Secret // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecretList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecretList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyvault/vault/zz_controller.go b/internal/controller/keyvault/vault/zz_controller.go index 41c1df64b..40d0e771c 100755 --- a/internal/controller/keyvault/vault/zz_controller.go +++ b/internal/controller/keyvault/vault/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Vault // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VaultList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VaultList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Vault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/attacheddatabaseconfiguration/zz_controller.go b/internal/controller/kusto/attacheddatabaseconfiguration/zz_controller.go index ccf258ba7..98d7f8345 100755 --- a/internal/controller/kusto/attacheddatabaseconfiguration/zz_controller.go +++ b/internal/controller/kusto/attacheddatabaseconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AttachedDatabaseConfiguration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AttachedDatabaseConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AttachedDatabaseConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AttachedDatabaseConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/cluster/zz_controller.go b/internal/controller/kusto/cluster/zz_controller.go index 476b2b0e4..5cefe9d72 100755 --- a/internal/controller/kusto/cluster/zz_controller.go +++ b/internal/controller/kusto/cluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Cluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/clustermanagedprivateendpoint/zz_controller.go b/internal/controller/kusto/clustermanagedprivateendpoint/zz_controller.go index ae60db196..766ab033c 100755 --- a/internal/controller/kusto/clustermanagedprivateendpoint/zz_controller.go +++ b/internal/controller/kusto/clustermanagedprivateendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ClusterManagedPrivateEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ClusterManagedPrivateEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ClusterManagedPrivateEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterManagedPrivateEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/clusterprincipalassignment/zz_controller.go b/internal/controller/kusto/clusterprincipalassignment/zz_controller.go index 911d0ec62..46fcd1fcb 100755 --- a/internal/controller/kusto/clusterprincipalassignment/zz_controller.go +++ b/internal/controller/kusto/clusterprincipalassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ClusterPrincipalAssignment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ClusterPrincipalAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ClusterPrincipalAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterPrincipalAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/database/zz_controller.go b/internal/controller/kusto/database/zz_controller.go index 9d2545745..ac8d988b4 100755 --- a/internal/controller/kusto/database/zz_controller.go +++ b/internal/controller/kusto/database/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Database // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/databaseprincipalassignment/zz_controller.go b/internal/controller/kusto/databaseprincipalassignment/zz_controller.go index 80969e639..311b2d65f 100755 --- a/internal/controller/kusto/databaseprincipalassignment/zz_controller.go +++ b/internal/controller/kusto/databaseprincipalassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DatabasePrincipalAssignment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DatabasePrincipalAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DatabasePrincipalAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DatabasePrincipalAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/eventgriddataconnection/zz_controller.go b/internal/controller/kusto/eventgriddataconnection/zz_controller.go index 52bbcff2a..91f33aad6 100755 --- a/internal/controller/kusto/eventgriddataconnection/zz_controller.go +++ b/internal/controller/kusto/eventgriddataconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EventGridDataConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EventGridDataConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EventGridDataConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventGridDataConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/eventhubdataconnection/zz_controller.go b/internal/controller/kusto/eventhubdataconnection/zz_controller.go index c2a22201a..530b1dd0b 100755 --- a/internal/controller/kusto/eventhubdataconnection/zz_controller.go +++ b/internal/controller/kusto/eventhubdataconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EventHubDataConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EventHubDataConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EventHubDataConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventHubDataConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kusto/iothubdataconnection/zz_controller.go b/internal/controller/kusto/iothubdataconnection/zz_controller.go index 7684298ea..552ec4b25 100755 --- a/internal/controller/kusto/iothubdataconnection/zz_controller.go +++ b/internal/controller/kusto/iothubdataconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IOTHubDataConnection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IOTHubDataConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IOTHubDataConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IOTHubDataConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/labservices/labservicelab/zz_controller.go b/internal/controller/labservices/labservicelab/zz_controller.go index 42f339a42..00e222157 100755 --- a/internal/controller/labservices/labservicelab/zz_controller.go +++ b/internal/controller/labservices/labservicelab/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LabServiceLab // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LabServiceLabList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LabServiceLabList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LabServiceLab_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/labservices/labserviceplan/zz_controller.go b/internal/controller/labservices/labserviceplan/zz_controller.go index 6585e4388..53afbef57 100755 --- a/internal/controller/labservices/labserviceplan/zz_controller.go +++ b/internal/controller/labservices/labserviceplan/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LabServicePlan // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LabServicePlanList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LabServicePlanList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LabServicePlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/loadtestservice/loadtest/zz_controller.go b/internal/controller/loadtestservice/loadtest/zz_controller.go index 3f40dff4a..3d938d8a7 100755 --- a/internal/controller/loadtestservice/loadtest/zz_controller.go +++ b/internal/controller/loadtestservice/loadtest/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LoadTest // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LoadTestList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LoadTestList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LoadTest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appactioncustom/zz_controller.go b/internal/controller/logic/appactioncustom/zz_controller.go index 86539d4c1..0a48f2d9f 100755 --- a/internal/controller/logic/appactioncustom/zz_controller.go +++ b/internal/controller/logic/appactioncustom/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppActionCustom // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppActionCustomList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppActionCustomList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppActionCustom_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appactionhttp/zz_controller.go b/internal/controller/logic/appactionhttp/zz_controller.go index 1c869a523..0012647b8 100755 --- a/internal/controller/logic/appactionhttp/zz_controller.go +++ b/internal/controller/logic/appactionhttp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppActionHTTP // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppActionHTTPList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppActionHTTPList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppActionHTTP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appintegrationaccount/zz_controller.go b/internal/controller/logic/appintegrationaccount/zz_controller.go index 05880a902..781f33036 100755 --- a/internal/controller/logic/appintegrationaccount/zz_controller.go +++ b/internal/controller/logic/appintegrationaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppIntegrationAccount // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppIntegrationAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppIntegrationAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppIntegrationAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appintegrationaccountbatchconfiguration/zz_controller.go b/internal/controller/logic/appintegrationaccountbatchconfiguration/zz_controller.go index 8e958ea1e..5eb6e44ec 100755 --- a/internal/controller/logic/appintegrationaccountbatchconfiguration/zz_controller.go +++ b/internal/controller/logic/appintegrationaccountbatchconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AppIntegrationAccountBatchConfiguration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AppIntegrationAccountBatchConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AppIntegrationAccountBatchConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AppIntegrationAccountBatchConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appintegrationaccountpartner/zz_controller.go b/internal/controller/logic/appintegrationaccountpartner/zz_controller.go index c87bb5968..8d0d0125c 100755 --- a/internal/controller/logic/appintegrationaccountpartner/zz_controller.go +++ b/internal/controller/logic/appintegrationaccountpartner/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppIntegrationAccountPartner // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppIntegrationAccountPartnerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppIntegrationAccountPartnerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppIntegrationAccountPartner_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appintegrationaccountschema/zz_controller.go b/internal/controller/logic/appintegrationaccountschema/zz_controller.go index 1d33b3de0..2dfc57b22 100755 --- a/internal/controller/logic/appintegrationaccountschema/zz_controller.go +++ b/internal/controller/logic/appintegrationaccountschema/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppIntegrationAccountSchema // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppIntegrationAccountSchemaList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppIntegrationAccountSchemaList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppIntegrationAccountSchema_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appintegrationaccountsession/zz_controller.go b/internal/controller/logic/appintegrationaccountsession/zz_controller.go index 844404669..e3f85ca8c 100755 --- a/internal/controller/logic/appintegrationaccountsession/zz_controller.go +++ b/internal/controller/logic/appintegrationaccountsession/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppIntegrationAccountSession // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppIntegrationAccountSessionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppIntegrationAccountSessionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppIntegrationAccountSession_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/apptriggercustom/zz_controller.go b/internal/controller/logic/apptriggercustom/zz_controller.go index f021ef7b6..e2aff4820 100755 --- a/internal/controller/logic/apptriggercustom/zz_controller.go +++ b/internal/controller/logic/apptriggercustom/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppTriggerCustom // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppTriggerCustomList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppTriggerCustomList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppTriggerCustom_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/apptriggerhttprequest/zz_controller.go b/internal/controller/logic/apptriggerhttprequest/zz_controller.go index 0d4f3d49a..725fe9411 100755 --- a/internal/controller/logic/apptriggerhttprequest/zz_controller.go +++ b/internal/controller/logic/apptriggerhttprequest/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppTriggerHTTPRequest // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppTriggerHTTPRequestList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppTriggerHTTPRequestList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppTriggerHTTPRequest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/apptriggerrecurrence/zz_controller.go b/internal/controller/logic/apptriggerrecurrence/zz_controller.go index e2c06110d..f8e4abc3f 100755 --- a/internal/controller/logic/apptriggerrecurrence/zz_controller.go +++ b/internal/controller/logic/apptriggerrecurrence/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AppTriggerRecurrence // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AppTriggerRecurrenceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AppTriggerRecurrenceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AppTriggerRecurrence_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/appworkflow/zz_controller.go b/internal/controller/logic/appworkflow/zz_controller.go index e3517b835..cf5271981 100755 --- a/internal/controller/logic/appworkflow/zz_controller.go +++ b/internal/controller/logic/appworkflow/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AppWorkflow // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AppWorkflowList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AppWorkflowList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AppWorkflow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logic/integrationserviceenvironment/zz_controller.go b/internal/controller/logic/integrationserviceenvironment/zz_controller.go index 83fec06f3..d8402828a 100755 --- a/internal/controller/logic/integrationserviceenvironment/zz_controller.go +++ b/internal/controller/logic/integrationserviceenvironment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IntegrationServiceEnvironment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IntegrationServiceEnvironmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IntegrationServiceEnvironmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationServiceEnvironment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logz/monitor/zz_controller.go b/internal/controller/logz/monitor/zz_controller.go index 373183e2e..2d3ca7280 100755 --- a/internal/controller/logz/monitor/zz_controller.go +++ b/internal/controller/logz/monitor/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Monitor // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MonitorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MonitorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Monitor_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logz/subaccount/zz_controller.go b/internal/controller/logz/subaccount/zz_controller.go index 396a2862a..2a9b6f50d 100755 --- a/internal/controller/logz/subaccount/zz_controller.go +++ b/internal/controller/logz/subaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SubAccount // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SubAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logz/subaccounttagrule/zz_controller.go b/internal/controller/logz/subaccounttagrule/zz_controller.go index 5519bc049..c6ade117f 100755 --- a/internal/controller/logz/subaccounttagrule/zz_controller.go +++ b/internal/controller/logz/subaccounttagrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubAccountTagRule // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubAccountTagRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubAccountTagRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubAccountTagRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/logz/tagrule/zz_controller.go b/internal/controller/logz/tagrule/zz_controller.go index 9d9e4baad..1c3fda859 100755 --- a/internal/controller/logz/tagrule/zz_controller.go +++ b/internal/controller/logz/tagrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TagRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TagRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TagRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/machinelearningservices/computecluster/zz_controller.go b/internal/controller/machinelearningservices/computecluster/zz_controller.go index d4acb7f71..a32fa4063 100755 --- a/internal/controller/machinelearningservices/computecluster/zz_controller.go +++ b/internal/controller/machinelearningservices/computecluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ComputeCluster // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ComputeClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ComputeClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ComputeCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/machinelearningservices/computeinstance/zz_controller.go b/internal/controller/machinelearningservices/computeinstance/zz_controller.go index cb820b273..776aed5cd 100755 --- a/internal/controller/machinelearningservices/computeinstance/zz_controller.go +++ b/internal/controller/machinelearningservices/computeinstance/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ComputeInstance // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ComputeInstanceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ComputeInstanceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ComputeInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/machinelearningservices/synapsespark/zz_controller.go b/internal/controller/machinelearningservices/synapsespark/zz_controller.go index 7265d1e4d..44dbe71d0 100755 --- a/internal/controller/machinelearningservices/synapsespark/zz_controller.go +++ b/internal/controller/machinelearningservices/synapsespark/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SynapseSpark // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SynapseSparkList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SynapseSparkList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SynapseSpark_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/machinelearningservices/workspace/zz_controller.go b/internal/controller/machinelearningservices/workspace/zz_controller.go index 530c902d1..b14ca7c8d 100755 --- a/internal/controller/machinelearningservices/workspace/zz_controller.go +++ b/internal/controller/machinelearningservices/workspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Workspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/maintenance/maintenanceassignmentdedicatedhost/zz_controller.go b/internal/controller/maintenance/maintenanceassignmentdedicatedhost/zz_controller.go index f9e5359ab..2f0c075df 100755 --- a/internal/controller/maintenance/maintenanceassignmentdedicatedhost/zz_controller.go +++ b/internal/controller/maintenance/maintenanceassignmentdedicatedhost/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MaintenanceAssignmentDedicatedHost // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MaintenanceAssignmentDedicatedHostList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MaintenanceAssignmentDedicatedHostList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MaintenanceAssignmentDedicatedHost_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/maintenance/maintenanceassignmentvirtualmachine/zz_controller.go b/internal/controller/maintenance/maintenanceassignmentvirtualmachine/zz_controller.go index c53d8d9cc..a957cad1c 100755 --- a/internal/controller/maintenance/maintenanceassignmentvirtualmachine/zz_controller.go +++ b/internal/controller/maintenance/maintenanceassignmentvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MaintenanceAssignmentVirtualMachine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MaintenanceAssignmentVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MaintenanceAssignmentVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MaintenanceAssignmentVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/maintenance/maintenanceconfiguration/zz_controller.go b/internal/controller/maintenance/maintenanceconfiguration/zz_controller.go index a94fb0f0f..e945e662e 100755 --- a/internal/controller/maintenance/maintenanceconfiguration/zz_controller.go +++ b/internal/controller/maintenance/maintenanceconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MaintenanceConfiguration // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MaintenanceConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MaintenanceConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MaintenanceConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/managedidentity/federatedidentitycredential/zz_controller.go b/internal/controller/managedidentity/federatedidentitycredential/zz_controller.go index 45f7e441f..c6bfaab7a 100755 --- a/internal/controller/managedidentity/federatedidentitycredential/zz_controller.go +++ b/internal/controller/managedidentity/federatedidentitycredential/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FederatedIdentityCredential // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FederatedIdentityCredentialList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FederatedIdentityCredentialList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FederatedIdentityCredential_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/managedidentity/userassignedidentity/zz_controller.go b/internal/controller/managedidentity/userassignedidentity/zz_controller.go index 26cadbcd3..74a88539d 100755 --- a/internal/controller/managedidentity/userassignedidentity/zz_controller.go +++ b/internal/controller/managedidentity/userassignedidentity/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.UserAssignedIdentity // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.UserAssignedIdentityList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.UserAssignedIdentityList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserAssignedIdentity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/management/managementgroup/zz_controller.go b/internal/controller/management/managementgroup/zz_controller.go index 0e9d7a7e1..741fbc2c9 100755 --- a/internal/controller/management/managementgroup/zz_controller.go +++ b/internal/controller/management/managementgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagementGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagementGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagementGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagementGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/management/managementgroupsubscriptionassociation/zz_controller.go b/internal/controller/management/managementgroupsubscriptionassociation/zz_controller.go index 641940fb7..75a2fd088 100755 --- a/internal/controller/management/managementgroupsubscriptionassociation/zz_controller.go +++ b/internal/controller/management/managementgroupsubscriptionassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagementGroupSubscriptionAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagementGroupSubscriptionAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagementGroupSubscriptionAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagementGroupSubscriptionAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/maps/account/zz_controller.go b/internal/controller/maps/account/zz_controller.go index 6e44a9db8..189092383 100755 --- a/internal/controller/maps/account/zz_controller.go +++ b/internal/controller/maps/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/maps/creator/zz_controller.go b/internal/controller/maps/creator/zz_controller.go index e4a9b50d0..0325cc374 100755 --- a/internal/controller/maps/creator/zz_controller.go +++ b/internal/controller/maps/creator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Creator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CreatorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CreatorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Creator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/marketplaceordering/marketplaceagreement/zz_controller.go b/internal/controller/marketplaceordering/marketplaceagreement/zz_controller.go index 05cbde16f..ab25a6c98 100755 --- a/internal/controller/marketplaceordering/marketplaceagreement/zz_controller.go +++ b/internal/controller/marketplaceordering/marketplaceagreement/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MarketplaceAgreement // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MarketplaceAgreementList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MarketplaceAgreementList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MarketplaceAgreement_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/asset/zz_controller.go b/internal/controller/media/asset/zz_controller.go index be1b84277..5b0d925d5 100755 --- a/internal/controller/media/asset/zz_controller.go +++ b/internal/controller/media/asset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Asset // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AssetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AssetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Asset_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/assetfilter/zz_controller.go b/internal/controller/media/assetfilter/zz_controller.go index 0dc02ddc8..5fb62a7c2 100755 --- a/internal/controller/media/assetfilter/zz_controller.go +++ b/internal/controller/media/assetfilter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AssetFilter // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AssetFilterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AssetFilterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AssetFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/contentkeypolicy/zz_controller.go b/internal/controller/media/contentkeypolicy/zz_controller.go index 2871911c8..a619563e2 100755 --- a/internal/controller/media/contentkeypolicy/zz_controller.go +++ b/internal/controller/media/contentkeypolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ContentKeyPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ContentKeyPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ContentKeyPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ContentKeyPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/job/zz_controller.go b/internal/controller/media/job/zz_controller.go index e3c302818..78a9e34e6 100755 --- a/internal/controller/media/job/zz_controller.go +++ b/internal/controller/media/job/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Job // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.JobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.JobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Job_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/liveevent/zz_controller.go b/internal/controller/media/liveevent/zz_controller.go index 2f01fe5ec..e88fd7c2b 100755 --- a/internal/controller/media/liveevent/zz_controller.go +++ b/internal/controller/media/liveevent/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LiveEvent // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LiveEventList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LiveEventList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LiveEvent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/liveeventoutput/zz_controller.go b/internal/controller/media/liveeventoutput/zz_controller.go index d38ea7b0f..51ce8cf6b 100755 --- a/internal/controller/media/liveeventoutput/zz_controller.go +++ b/internal/controller/media/liveeventoutput/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LiveEventOutput // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LiveEventOutputList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LiveEventOutputList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LiveEventOutput_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/servicesaccount/zz_controller.go b/internal/controller/media/servicesaccount/zz_controller.go index 01e735d37..871c2ad3e 100755 --- a/internal/controller/media/servicesaccount/zz_controller.go +++ b/internal/controller/media/servicesaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ServicesAccount // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServicesAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServicesAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ServicesAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/servicesaccountfilter/zz_controller.go b/internal/controller/media/servicesaccountfilter/zz_controller.go index cedbb52a2..67b7425c2 100755 --- a/internal/controller/media/servicesaccountfilter/zz_controller.go +++ b/internal/controller/media/servicesaccountfilter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ServicesAccountFilter // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServicesAccountFilterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServicesAccountFilterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ServicesAccountFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/streamingendpoint/zz_controller.go b/internal/controller/media/streamingendpoint/zz_controller.go index 0adeaa18e..4bcc5ec93 100755 --- a/internal/controller/media/streamingendpoint/zz_controller.go +++ b/internal/controller/media/streamingendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StreamingEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StreamingEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StreamingEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StreamingEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/streaminglocator/zz_controller.go b/internal/controller/media/streaminglocator/zz_controller.go index 9a85b602b..edf7cfeae 100755 --- a/internal/controller/media/streaminglocator/zz_controller.go +++ b/internal/controller/media/streaminglocator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.StreamingLocator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.StreamingLocatorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.StreamingLocatorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StreamingLocator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/streamingpolicy/zz_controller.go b/internal/controller/media/streamingpolicy/zz_controller.go index a552c7e16..38790196f 100755 --- a/internal/controller/media/streamingpolicy/zz_controller.go +++ b/internal/controller/media/streamingpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StreamingPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StreamingPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StreamingPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StreamingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/media/transform/zz_controller.go b/internal/controller/media/transform/zz_controller.go index 4fda28c0c..108114343 100755 --- a/internal/controller/media/transform/zz_controller.go +++ b/internal/controller/media/transform/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Transform // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TransformList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TransformList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Transform_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mixedreality/spatialanchorsaccount/zz_controller.go b/internal/controller/mixedreality/spatialanchorsaccount/zz_controller.go index 2a2ffc34e..5aef7a355 100755 --- a/internal/controller/mixedreality/spatialanchorsaccount/zz_controller.go +++ b/internal/controller/mixedreality/spatialanchorsaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SpatialAnchorsAccount // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpatialAnchorsAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpatialAnchorsAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpatialAnchorsAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/netapp/account/zz_controller.go b/internal/controller/netapp/account/zz_controller.go index f3d302485..bb5b8eba6 100755 --- a/internal/controller/netapp/account/zz_controller.go +++ b/internal/controller/netapp/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/netapp/pool/zz_controller.go b/internal/controller/netapp/pool/zz_controller.go index 585928c64..99136f416 100755 --- a/internal/controller/netapp/pool/zz_controller.go +++ b/internal/controller/netapp/pool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Pool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Pool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/netapp/snapshot/zz_controller.go b/internal/controller/netapp/snapshot/zz_controller.go index 9cf998021..fec203925 100755 --- a/internal/controller/netapp/snapshot/zz_controller.go +++ b/internal/controller/netapp/snapshot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Snapshot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SnapshotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SnapshotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/netapp/snapshotpolicy/zz_controller.go b/internal/controller/netapp/snapshotpolicy/zz_controller.go index 39a822f1a..3163cbb94 100755 --- a/internal/controller/netapp/snapshotpolicy/zz_controller.go +++ b/internal/controller/netapp/snapshotpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SnapshotPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SnapshotPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SnapshotPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SnapshotPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/netapp/volume/zz_controller.go b/internal/controller/netapp/volume/zz_controller.go index 4fe30ce43..24d4a409e 100755 --- a/internal/controller/netapp/volume/zz_controller.go +++ b/internal/controller/netapp/volume/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Volume // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VolumeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VolumeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Volume_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/applicationgateway/zz_controller.go b/internal/controller/network/applicationgateway/zz_controller.go index 6419cad99..f98a28d51 100755 --- a/internal/controller/network/applicationgateway/zz_controller.go +++ b/internal/controller/network/applicationgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ApplicationGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ApplicationGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ApplicationGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ApplicationGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/applicationsecuritygroup/zz_controller.go b/internal/controller/network/applicationsecuritygroup/zz_controller.go index 80bc1769a..4065c248b 100755 --- a/internal/controller/network/applicationsecuritygroup/zz_controller.go +++ b/internal/controller/network/applicationsecuritygroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ApplicationSecurityGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ApplicationSecurityGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ApplicationSecurityGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationSecurityGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/connectionmonitor/zz_controller.go b/internal/controller/network/connectionmonitor/zz_controller.go index 25e5d62bc..06e58b2b0 100755 --- a/internal/controller/network/connectionmonitor/zz_controller.go +++ b/internal/controller/network/connectionmonitor/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ConnectionMonitor // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ConnectionMonitorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ConnectionMonitorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ConnectionMonitor_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/ddosprotectionplan/zz_controller.go b/internal/controller/network/ddosprotectionplan/zz_controller.go index c7e037040..59b8be24d 100755 --- a/internal/controller/network/ddosprotectionplan/zz_controller.go +++ b/internal/controller/network/ddosprotectionplan/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DDoSProtectionPlan // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DDoSProtectionPlanList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DDoSProtectionPlanList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DDoSProtectionPlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnsaaaarecord/zz_controller.go b/internal/controller/network/dnsaaaarecord/zz_controller.go index f2fefffcc..42b58db7e 100755 --- a/internal/controller/network/dnsaaaarecord/zz_controller.go +++ b/internal/controller/network/dnsaaaarecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSAAAARecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSAAAARecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSAAAARecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSAAAARecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnsarecord/zz_controller.go b/internal/controller/network/dnsarecord/zz_controller.go index 1b7843e4d..c29cf3683 100755 --- a/internal/controller/network/dnsarecord/zz_controller.go +++ b/internal/controller/network/dnsarecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSARecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSARecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSARecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSARecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnscaarecord/zz_controller.go b/internal/controller/network/dnscaarecord/zz_controller.go index 719e12b06..2a0951d22 100755 --- a/internal/controller/network/dnscaarecord/zz_controller.go +++ b/internal/controller/network/dnscaarecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSCAARecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSCAARecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSCAARecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSCAARecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnscnamerecord/zz_controller.go b/internal/controller/network/dnscnamerecord/zz_controller.go index 5c6105ee9..2c8f7b46d 100755 --- a/internal/controller/network/dnscnamerecord/zz_controller.go +++ b/internal/controller/network/dnscnamerecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSCNAMERecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSCNAMERecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSCNAMERecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSCNAMERecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnsmxrecord/zz_controller.go b/internal/controller/network/dnsmxrecord/zz_controller.go index 58be5c3e1..07701c227 100755 --- a/internal/controller/network/dnsmxrecord/zz_controller.go +++ b/internal/controller/network/dnsmxrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSMXRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSMXRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSMXRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSMXRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnsnsrecord/zz_controller.go b/internal/controller/network/dnsnsrecord/zz_controller.go index cc6b36d6c..7ec57e0b4 100755 --- a/internal/controller/network/dnsnsrecord/zz_controller.go +++ b/internal/controller/network/dnsnsrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSNSRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSNSRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSNSRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSNSRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnsptrrecord/zz_controller.go b/internal/controller/network/dnsptrrecord/zz_controller.go index e0eb90cc7..6458fcdcd 100755 --- a/internal/controller/network/dnsptrrecord/zz_controller.go +++ b/internal/controller/network/dnsptrrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSPTRRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSPTRRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSPTRRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSPTRRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnssrvrecord/zz_controller.go b/internal/controller/network/dnssrvrecord/zz_controller.go index d2f36a1ce..918ed2528 100755 --- a/internal/controller/network/dnssrvrecord/zz_controller.go +++ b/internal/controller/network/dnssrvrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSSRVRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSSRVRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSSRVRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSSRVRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnstxtrecord/zz_controller.go b/internal/controller/network/dnstxtrecord/zz_controller.go index d99859228..96be0f978 100755 --- a/internal/controller/network/dnstxtrecord/zz_controller.go +++ b/internal/controller/network/dnstxtrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DNSTXTRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DNSTXTRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DNSTXTRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DNSTXTRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/dnszone/zz_controller.go b/internal/controller/network/dnszone/zz_controller.go index fb5afd182..725bb2457 100755 --- a/internal/controller/network/dnszone/zz_controller.go +++ b/internal/controller/network/dnszone/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.DNSZone // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.DNSZoneList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.DNSZoneList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.DNSZone_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressroutecircuit/zz_controller.go b/internal/controller/network/expressroutecircuit/zz_controller.go index fd99e48f3..7934fd9f9 100755 --- a/internal/controller/network/expressroutecircuit/zz_controller.go +++ b/internal/controller/network/expressroutecircuit/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ExpressRouteCircuit // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ExpressRouteCircuitList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ExpressRouteCircuitList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ExpressRouteCircuit_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressroutecircuitauthorization/zz_controller.go b/internal/controller/network/expressroutecircuitauthorization/zz_controller.go index b41d239cf..e72af5e90 100755 --- a/internal/controller/network/expressroutecircuitauthorization/zz_controller.go +++ b/internal/controller/network/expressroutecircuitauthorization/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ExpressRouteCircuitAuthorization // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ExpressRouteCircuitAuthorizationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ExpressRouteCircuitAuthorizationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExpressRouteCircuitAuthorization_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressroutecircuitconnection/zz_controller.go b/internal/controller/network/expressroutecircuitconnection/zz_controller.go index 899cb67d2..9cbeea700 100755 --- a/internal/controller/network/expressroutecircuitconnection/zz_controller.go +++ b/internal/controller/network/expressroutecircuitconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ExpressRouteCircuitConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ExpressRouteCircuitConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ExpressRouteCircuitConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExpressRouteCircuitConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressroutecircuitpeering/zz_controller.go b/internal/controller/network/expressroutecircuitpeering/zz_controller.go index f8ee2e977..8bd168d55 100755 --- a/internal/controller/network/expressroutecircuitpeering/zz_controller.go +++ b/internal/controller/network/expressroutecircuitpeering/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ExpressRouteCircuitPeering // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ExpressRouteCircuitPeeringList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ExpressRouteCircuitPeeringList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ExpressRouteCircuitPeering_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressrouteconnection/zz_controller.go b/internal/controller/network/expressrouteconnection/zz_controller.go index 4258dcffb..963409895 100755 --- a/internal/controller/network/expressrouteconnection/zz_controller.go +++ b/internal/controller/network/expressrouteconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ExpressRouteConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ExpressRouteConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ExpressRouteConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ExpressRouteConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressroutegateway/zz_controller.go b/internal/controller/network/expressroutegateway/zz_controller.go index 012fb6a7f..916db9d89 100755 --- a/internal/controller/network/expressroutegateway/zz_controller.go +++ b/internal/controller/network/expressroutegateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ExpressRouteGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ExpressRouteGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ExpressRouteGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExpressRouteGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/expressrouteport/zz_controller.go b/internal/controller/network/expressrouteport/zz_controller.go index 3096e2177..5ee6d93c9 100755 --- a/internal/controller/network/expressrouteport/zz_controller.go +++ b/internal/controller/network/expressrouteport/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ExpressRoutePort // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ExpressRoutePortList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ExpressRoutePortList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ExpressRoutePort_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewall/zz_controller.go b/internal/controller/network/firewall/zz_controller.go index 98b9f424e..9dbbb314a 100755 --- a/internal/controller/network/firewall/zz_controller.go +++ b/internal/controller/network/firewall/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Firewall // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FirewallList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FirewallList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Firewall_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewallapplicationrulecollection/zz_controller.go b/internal/controller/network/firewallapplicationrulecollection/zz_controller.go index f24b0329e..ac7782000 100755 --- a/internal/controller/network/firewallapplicationrulecollection/zz_controller.go +++ b/internal/controller/network/firewallapplicationrulecollection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallApplicationRuleCollection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallApplicationRuleCollectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallApplicationRuleCollectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallApplicationRuleCollection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewallnatrulecollection/zz_controller.go b/internal/controller/network/firewallnatrulecollection/zz_controller.go index 6582eaed9..3427e2776 100755 --- a/internal/controller/network/firewallnatrulecollection/zz_controller.go +++ b/internal/controller/network/firewallnatrulecollection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallNATRuleCollection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallNATRuleCollectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallNATRuleCollectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallNATRuleCollection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewallnetworkrulecollection/zz_controller.go b/internal/controller/network/firewallnetworkrulecollection/zz_controller.go index 39e81d4f9..1b41e7477 100755 --- a/internal/controller/network/firewallnetworkrulecollection/zz_controller.go +++ b/internal/controller/network/firewallnetworkrulecollection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallNetworkRuleCollection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallNetworkRuleCollectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallNetworkRuleCollectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallNetworkRuleCollection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewallpolicy/zz_controller.go b/internal/controller/network/firewallpolicy/zz_controller.go index 07fa76688..f98e9b29d 100755 --- a/internal/controller/network/firewallpolicy/zz_controller.go +++ b/internal/controller/network/firewallpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FirewallPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FirewallPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FirewallPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FirewallPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/firewallpolicyrulecollectiongroup/zz_controller.go b/internal/controller/network/firewallpolicyrulecollectiongroup/zz_controller.go index 59e007704..477ac1025 100755 --- a/internal/controller/network/firewallpolicyrulecollectiongroup/zz_controller.go +++ b/internal/controller/network/firewallpolicyrulecollectiongroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallPolicyRuleCollectionGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallPolicyRuleCollectionGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallPolicyRuleCollectionGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicyRuleCollectionGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/frontdoor/zz_controller.go b/internal/controller/network/frontdoor/zz_controller.go index 1334efb69..f43ca4d52 100755 --- a/internal/controller/network/frontdoor/zz_controller.go +++ b/internal/controller/network/frontdoor/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontDoor // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontDoorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontDoorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontDoor_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/frontdoorcustomhttpsconfiguration/zz_controller.go b/internal/controller/network/frontdoorcustomhttpsconfiguration/zz_controller.go index fae5a0655..d970da13b 100755 --- a/internal/controller/network/frontdoorcustomhttpsconfiguration/zz_controller.go +++ b/internal/controller/network/frontdoorcustomhttpsconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorCustomHTTPSConfiguration // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorCustomHTTPSConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorCustomHTTPSConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorCustomHTTPSConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/frontdoorfirewallpolicy/zz_controller.go b/internal/controller/network/frontdoorfirewallpolicy/zz_controller.go index ecf2a6df7..cb1447ffb 100755 --- a/internal/controller/network/frontdoorfirewallpolicy/zz_controller.go +++ b/internal/controller/network/frontdoorfirewallpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FrontdoorFirewallPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FrontdoorFirewallPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FrontdoorFirewallPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FrontdoorFirewallPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/frontdoorrulesengine/zz_controller.go b/internal/controller/network/frontdoorrulesengine/zz_controller.go index 7aa1c3eed..7def1ef39 100755 --- a/internal/controller/network/frontdoorrulesengine/zz_controller.go +++ b/internal/controller/network/frontdoorrulesengine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FrontdoorRulesEngine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FrontdoorRulesEngineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FrontdoorRulesEngineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FrontdoorRulesEngine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/ipgroup/zz_controller.go b/internal/controller/network/ipgroup/zz_controller.go index 146235c4a..7b89e0d86 100755 --- a/internal/controller/network/ipgroup/zz_controller.go +++ b/internal/controller/network/ipgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IPGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IPGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IPGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IPGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancer/zz_controller.go b/internal/controller/network/loadbalancer/zz_controller.go index 4b3f832fa..9973bda96 100755 --- a/internal/controller/network/loadbalancer/zz_controller.go +++ b/internal/controller/network/loadbalancer/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancerbackendaddresspool/zz_controller.go b/internal/controller/network/loadbalancerbackendaddresspool/zz_controller.go index 5635cca8a..f13ab61dc 100755 --- a/internal/controller/network/loadbalancerbackendaddresspool/zz_controller.go +++ b/internal/controller/network/loadbalancerbackendaddresspool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerBackendAddressPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerBackendAddressPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerBackendAddressPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerBackendAddressPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancerbackendaddresspooladdress/zz_controller.go b/internal/controller/network/loadbalancerbackendaddresspooladdress/zz_controller.go index 166082d72..7a39489a5 100755 --- a/internal/controller/network/loadbalancerbackendaddresspooladdress/zz_controller.go +++ b/internal/controller/network/loadbalancerbackendaddresspooladdress/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerBackendAddressPoolAddress // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerBackendAddressPoolAddressList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerBackendAddressPoolAddressList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerBackendAddressPoolAddress_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancernatpool/zz_controller.go b/internal/controller/network/loadbalancernatpool/zz_controller.go index af24fca0f..3a4381f87 100755 --- a/internal/controller/network/loadbalancernatpool/zz_controller.go +++ b/internal/controller/network/loadbalancernatpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerNatPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerNatPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerNatPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerNatPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancernatrule/zz_controller.go b/internal/controller/network/loadbalancernatrule/zz_controller.go index 5ec8cb99d..19aadd7cf 100755 --- a/internal/controller/network/loadbalancernatrule/zz_controller.go +++ b/internal/controller/network/loadbalancernatrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerNatRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerNatRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerNatRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerNatRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalanceroutboundrule/zz_controller.go b/internal/controller/network/loadbalanceroutboundrule/zz_controller.go index 8144f5211..8fce8c5ed 100755 --- a/internal/controller/network/loadbalanceroutboundrule/zz_controller.go +++ b/internal/controller/network/loadbalanceroutboundrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerOutboundRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerOutboundRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerOutboundRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerOutboundRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancerprobe/zz_controller.go b/internal/controller/network/loadbalancerprobe/zz_controller.go index 2a21795eb..eb1dfe175 100755 --- a/internal/controller/network/loadbalancerprobe/zz_controller.go +++ b/internal/controller/network/loadbalancerprobe/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerProbe // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerProbeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerProbeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerProbe_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/loadbalancerrule/zz_controller.go b/internal/controller/network/loadbalancerrule/zz_controller.go index 96cd36d7c..5d632a051 100755 --- a/internal/controller/network/loadbalancerrule/zz_controller.go +++ b/internal/controller/network/loadbalancerrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LoadBalancerRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LoadBalancerRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LoadBalancerRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoadBalancerRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/localnetworkgateway/zz_controller.go b/internal/controller/network/localnetworkgateway/zz_controller.go index c6dca5fd9..05c3f8083 100755 --- a/internal/controller/network/localnetworkgateway/zz_controller.go +++ b/internal/controller/network/localnetworkgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LocalNetworkGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LocalNetworkGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LocalNetworkGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LocalNetworkGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/manager/zz_controller.go b/internal/controller/network/manager/zz_controller.go index 9a0707cbd..5119429d8 100755 --- a/internal/controller/network/manager/zz_controller.go +++ b/internal/controller/network/manager/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Manager // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Manager_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/managermanagementgroupconnection/zz_controller.go b/internal/controller/network/managermanagementgroupconnection/zz_controller.go index 3c83854d5..511322547 100755 --- a/internal/controller/network/managermanagementgroupconnection/zz_controller.go +++ b/internal/controller/network/managermanagementgroupconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagerManagementGroupConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagerManagementGroupConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagerManagementGroupConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagerManagementGroupConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/managernetworkgroup/zz_controller.go b/internal/controller/network/managernetworkgroup/zz_controller.go index 1debc82ad..b075351a5 100755 --- a/internal/controller/network/managernetworkgroup/zz_controller.go +++ b/internal/controller/network/managernetworkgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagerNetworkGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagerNetworkGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagerNetworkGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagerNetworkGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/managerstaticmember/zz_controller.go b/internal/controller/network/managerstaticmember/zz_controller.go index e3554617c..5ac00367e 100755 --- a/internal/controller/network/managerstaticmember/zz_controller.go +++ b/internal/controller/network/managerstaticmember/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagerStaticMember // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagerStaticMemberList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagerStaticMemberList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagerStaticMember_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/managersubscriptionconnection/zz_controller.go b/internal/controller/network/managersubscriptionconnection/zz_controller.go index a55fc5a7d..386b1159b 100755 --- a/internal/controller/network/managersubscriptionconnection/zz_controller.go +++ b/internal/controller/network/managersubscriptionconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagerSubscriptionConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagerSubscriptionConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagerSubscriptionConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagerSubscriptionConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/natgateway/zz_controller.go b/internal/controller/network/natgateway/zz_controller.go index ad6a61f94..d51efcbbd 100755 --- a/internal/controller/network/natgateway/zz_controller.go +++ b/internal/controller/network/natgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NATGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NATGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NATGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NATGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/natgatewaypublicipassociation/zz_controller.go b/internal/controller/network/natgatewaypublicipassociation/zz_controller.go index dbe87828b..af7e4ef70 100755 --- a/internal/controller/network/natgatewaypublicipassociation/zz_controller.go +++ b/internal/controller/network/natgatewaypublicipassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NATGatewayPublicIPAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NATGatewayPublicIPAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NATGatewayPublicIPAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NATGatewayPublicIPAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/natgatewaypublicipprefixassociation/zz_controller.go b/internal/controller/network/natgatewaypublicipprefixassociation/zz_controller.go index 449ab7fc0..210d67a91 100755 --- a/internal/controller/network/natgatewaypublicipprefixassociation/zz_controller.go +++ b/internal/controller/network/natgatewaypublicipprefixassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NATGatewayPublicIPPrefixAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NATGatewayPublicIPPrefixAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NATGatewayPublicIPPrefixAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NATGatewayPublicIPPrefixAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/networkinterface/zz_controller.go b/internal/controller/network/networkinterface/zz_controller.go index a4c41e58d..8ac08d0d5 100755 --- a/internal/controller/network/networkinterface/zz_controller.go +++ b/internal/controller/network/networkinterface/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NetworkInterface // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NetworkInterfaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NetworkInterfaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/networkinterfaceapplicationsecuritygroupassociation/zz_controller.go b/internal/controller/network/networkinterfaceapplicationsecuritygroupassociation/zz_controller.go index eb689e8ee..2b6955331 100755 --- a/internal/controller/network/networkinterfaceapplicationsecuritygroupassociation/zz_controller.go +++ b/internal/controller/network/networkinterfaceapplicationsecuritygroupassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NetworkInterfaceApplicationSecurityGroupAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NetworkInterfaceApplicationSecurityGroupAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NetworkInterfaceApplicationSecurityGroupAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceApplicationSecurityGroupAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/networkinterfacebackendaddresspoolassociation/zz_controller.go b/internal/controller/network/networkinterfacebackendaddresspoolassociation/zz_controller.go index 45aa8c1c2..773e873a5 100755 --- a/internal/controller/network/networkinterfacebackendaddresspoolassociation/zz_controller.go +++ b/internal/controller/network/networkinterfacebackendaddresspoolassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NetworkInterfaceBackendAddressPoolAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NetworkInterfaceBackendAddressPoolAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NetworkInterfaceBackendAddressPoolAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceBackendAddressPoolAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/networkinterfacenatruleassociation/zz_controller.go b/internal/controller/network/networkinterfacenatruleassociation/zz_controller.go index 51ec02085..f9298e656 100755 --- a/internal/controller/network/networkinterfacenatruleassociation/zz_controller.go +++ b/internal/controller/network/networkinterfacenatruleassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NetworkInterfaceNatRuleAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NetworkInterfaceNatRuleAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NetworkInterfaceNatRuleAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceNatRuleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/networkinterfacesecuritygroupassociation/zz_controller.go b/internal/controller/network/networkinterfacesecuritygroupassociation/zz_controller.go index b35ecbd0b..af13b87df 100755 --- a/internal/controller/network/networkinterfacesecuritygroupassociation/zz_controller.go +++ b/internal/controller/network/networkinterfacesecuritygroupassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NetworkInterfaceSecurityGroupAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NetworkInterfaceSecurityGroupAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NetworkInterfaceSecurityGroupAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceSecurityGroupAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/packetcapture/zz_controller.go b/internal/controller/network/packetcapture/zz_controller.go index 7327a6db3..513c6b76c 100755 --- a/internal/controller/network/packetcapture/zz_controller.go +++ b/internal/controller/network/packetcapture/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.PacketCapture // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.PacketCaptureList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.PacketCaptureList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.PacketCapture_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/pointtositevpngateway/zz_controller.go b/internal/controller/network/pointtositevpngateway/zz_controller.go index 0a55e4167..0daf54802 100755 --- a/internal/controller/network/pointtositevpngateway/zz_controller.go +++ b/internal/controller/network/pointtositevpngateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.PointToSiteVPNGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.PointToSiteVPNGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.PointToSiteVPNGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.PointToSiteVPNGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednsaaaarecord/zz_controller.go b/internal/controller/network/privatednsaaaarecord/zz_controller.go index 62eb09ebe..64e154fa4 100755 --- a/internal/controller/network/privatednsaaaarecord/zz_controller.go +++ b/internal/controller/network/privatednsaaaarecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSAAAARecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSAAAARecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSAAAARecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSAAAARecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednsarecord/zz_controller.go b/internal/controller/network/privatednsarecord/zz_controller.go index ae5ccaa61..d62b5b534 100755 --- a/internal/controller/network/privatednsarecord/zz_controller.go +++ b/internal/controller/network/privatednsarecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSARecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSARecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSARecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSARecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednscnamerecord/zz_controller.go b/internal/controller/network/privatednscnamerecord/zz_controller.go index d35643fc4..d6cda14a8 100755 --- a/internal/controller/network/privatednscnamerecord/zz_controller.go +++ b/internal/controller/network/privatednscnamerecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSCNAMERecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSCNAMERecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSCNAMERecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSCNAMERecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednsmxrecord/zz_controller.go b/internal/controller/network/privatednsmxrecord/zz_controller.go index e90a4137e..0761f52bc 100755 --- a/internal/controller/network/privatednsmxrecord/zz_controller.go +++ b/internal/controller/network/privatednsmxrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSMXRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSMXRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSMXRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSMXRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednsptrrecord/zz_controller.go b/internal/controller/network/privatednsptrrecord/zz_controller.go index f5fa32a85..8f5623b3a 100755 --- a/internal/controller/network/privatednsptrrecord/zz_controller.go +++ b/internal/controller/network/privatednsptrrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSPTRRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSPTRRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSPTRRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSPTRRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednsresolver/zz_controller.go b/internal/controller/network/privatednsresolver/zz_controller.go index 337104d4c..978d61538 100755 --- a/internal/controller/network/privatednsresolver/zz_controller.go +++ b/internal/controller/network/privatednsresolver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSResolver // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSResolverList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSResolverList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSResolver_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednssrvrecord/zz_controller.go b/internal/controller/network/privatednssrvrecord/zz_controller.go index 12f125bf4..e0377b144 100755 --- a/internal/controller/network/privatednssrvrecord/zz_controller.go +++ b/internal/controller/network/privatednssrvrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSSRVRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSSRVRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSSRVRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSSRVRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednstxtrecord/zz_controller.go b/internal/controller/network/privatednstxtrecord/zz_controller.go index 9d50d9ee4..d2e891c08 100755 --- a/internal/controller/network/privatednstxtrecord/zz_controller.go +++ b/internal/controller/network/privatednstxtrecord/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSTXTRecord // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSTXTRecordList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSTXTRecordList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSTXTRecord_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednszone/zz_controller.go b/internal/controller/network/privatednszone/zz_controller.go index dafef0a03..8f99267dc 100755 --- a/internal/controller/network/privatednszone/zz_controller.go +++ b/internal/controller/network/privatednszone/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.PrivateDNSZone // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.PrivateDNSZoneList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.PrivateDNSZoneList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.PrivateDNSZone_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatednszonevirtualnetworklink/zz_controller.go b/internal/controller/network/privatednszonevirtualnetworklink/zz_controller.go index c02e48185..8ec2114e0 100755 --- a/internal/controller/network/privatednszonevirtualnetworklink/zz_controller.go +++ b/internal/controller/network/privatednszonevirtualnetworklink/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateDNSZoneVirtualNetworkLink // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateDNSZoneVirtualNetworkLinkList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateDNSZoneVirtualNetworkLinkList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSZoneVirtualNetworkLink_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privateendpoint/zz_controller.go b/internal/controller/network/privateendpoint/zz_controller.go index 35eb1d256..150441274 100755 --- a/internal/controller/network/privateendpoint/zz_controller.go +++ b/internal/controller/network/privateendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.PrivateEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.PrivateEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.PrivateEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.PrivateEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privateendpointapplicationsecuritygroupassociation/zz_controller.go b/internal/controller/network/privateendpointapplicationsecuritygroupassociation/zz_controller.go index 31878e742..c84b24322 100755 --- a/internal/controller/network/privateendpointapplicationsecuritygroupassociation/zz_controller.go +++ b/internal/controller/network/privateendpointapplicationsecuritygroupassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateEndpointApplicationSecurityGroupAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateEndpointApplicationSecurityGroupAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateEndpointApplicationSecurityGroupAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateEndpointApplicationSecurityGroupAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/privatelinkservice/zz_controller.go b/internal/controller/network/privatelinkservice/zz_controller.go index 66bf99b96..3303abd84 100755 --- a/internal/controller/network/privatelinkservice/zz_controller.go +++ b/internal/controller/network/privatelinkservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateLinkService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateLinkServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateLinkServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateLinkService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/profile/zz_controller.go b/internal/controller/network/profile/zz_controller.go index 74f0a3f5b..cd748adf4 100755 --- a/internal/controller/network/profile/zz_controller.go +++ b/internal/controller/network/profile/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Profile // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ProfileList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ProfileList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Profile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/publicip/zz_controller.go b/internal/controller/network/publicip/zz_controller.go index 32c194fa7..87ae913ca 100755 --- a/internal/controller/network/publicip/zz_controller.go +++ b/internal/controller/network/publicip/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PublicIP // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PublicIPList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PublicIPList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PublicIP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/publicipprefix/zz_controller.go b/internal/controller/network/publicipprefix/zz_controller.go index f40672a5f..22588f20f 100755 --- a/internal/controller/network/publicipprefix/zz_controller.go +++ b/internal/controller/network/publicipprefix/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PublicIPPrefix // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PublicIPPrefixList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PublicIPPrefixList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PublicIPPrefix_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/route/zz_controller.go b/internal/controller/network/route/zz_controller.go index 571528b5f..b2f841f20 100755 --- a/internal/controller/network/route/zz_controller.go +++ b/internal/controller/network/route/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Route // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/routefilter/zz_controller.go b/internal/controller/network/routefilter/zz_controller.go index eadb92b0f..6fb7c656c 100755 --- a/internal/controller/network/routefilter/zz_controller.go +++ b/internal/controller/network/routefilter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RouteFilter // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteFilterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteFilterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/routemap/zz_controller.go b/internal/controller/network/routemap/zz_controller.go index 6c63a1209..0915232b7 100755 --- a/internal/controller/network/routemap/zz_controller.go +++ b/internal/controller/network/routemap/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RouteMap // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteMapList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteMapList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteMap_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/routeserver/zz_controller.go b/internal/controller/network/routeserver/zz_controller.go index e17534efc..f16abe646 100755 --- a/internal/controller/network/routeserver/zz_controller.go +++ b/internal/controller/network/routeserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RouteServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/routeserverbgpconnection/zz_controller.go b/internal/controller/network/routeserverbgpconnection/zz_controller.go index 8c95ca3cc..2fc3ba091 100755 --- a/internal/controller/network/routeserverbgpconnection/zz_controller.go +++ b/internal/controller/network/routeserverbgpconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RouteServerBGPConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteServerBGPConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteServerBGPConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteServerBGPConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/routetable/zz_controller.go b/internal/controller/network/routetable/zz_controller.go index 8580c2fa1..4f8f6052d 100755 --- a/internal/controller/network/routetable/zz_controller.go +++ b/internal/controller/network/routetable/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RouteTable // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RouteTableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RouteTableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/securitygroup/zz_controller.go b/internal/controller/network/securitygroup/zz_controller.go index 58ef42c5c..ae52b1a4b 100755 --- a/internal/controller/network/securitygroup/zz_controller.go +++ b/internal/controller/network/securitygroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/securityrule/zz_controller.go b/internal/controller/network/securityrule/zz_controller.go index a25b3c660..0ab2c2c1c 100755 --- a/internal/controller/network/securityrule/zz_controller.go +++ b/internal/controller/network/securityrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/subnet/zz_controller.go b/internal/controller/network/subnet/zz_controller.go index 40d3333e2..8da9031fe 100755 --- a/internal/controller/network/subnet/zz_controller.go +++ b/internal/controller/network/subnet/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Subnet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubnetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubnetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Subnet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/subnetnatgatewayassociation/zz_controller.go b/internal/controller/network/subnetnatgatewayassociation/zz_controller.go index 54163e54b..f81abf86c 100755 --- a/internal/controller/network/subnetnatgatewayassociation/zz_controller.go +++ b/internal/controller/network/subnetnatgatewayassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubnetNATGatewayAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubnetNATGatewayAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubnetNATGatewayAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetNATGatewayAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/subnetnetworksecuritygroupassociation/zz_controller.go b/internal/controller/network/subnetnetworksecuritygroupassociation/zz_controller.go index a40f392e0..9977b7d74 100755 --- a/internal/controller/network/subnetnetworksecuritygroupassociation/zz_controller.go +++ b/internal/controller/network/subnetnetworksecuritygroupassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubnetNetworkSecurityGroupAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubnetNetworkSecurityGroupAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubnetNetworkSecurityGroupAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetNetworkSecurityGroupAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/subnetroutetableassociation/zz_controller.go b/internal/controller/network/subnetroutetableassociation/zz_controller.go index ec2c6a3d0..b4ad1b4a8 100755 --- a/internal/controller/network/subnetroutetableassociation/zz_controller.go +++ b/internal/controller/network/subnetroutetableassociation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubnetRouteTableAssociation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubnetRouteTableAssociationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubnetRouteTableAssociationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetRouteTableAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/subnetserviceendpointstoragepolicy/zz_controller.go b/internal/controller/network/subnetserviceendpointstoragepolicy/zz_controller.go index b276ed312..e004b4b10 100755 --- a/internal/controller/network/subnetserviceendpointstoragepolicy/zz_controller.go +++ b/internal/controller/network/subnetserviceendpointstoragepolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubnetServiceEndpointStoragePolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubnetServiceEndpointStoragePolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubnetServiceEndpointStoragePolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetServiceEndpointStoragePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/trafficmanagerazureendpoint/zz_controller.go b/internal/controller/network/trafficmanagerazureendpoint/zz_controller.go index 5ebaf77c9..b04c90111 100755 --- a/internal/controller/network/trafficmanagerazureendpoint/zz_controller.go +++ b/internal/controller/network/trafficmanagerazureendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TrafficManagerAzureEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TrafficManagerAzureEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TrafficManagerAzureEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficManagerAzureEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/trafficmanagerexternalendpoint/zz_controller.go b/internal/controller/network/trafficmanagerexternalendpoint/zz_controller.go index c481fb1c1..886ba3ccb 100755 --- a/internal/controller/network/trafficmanagerexternalendpoint/zz_controller.go +++ b/internal/controller/network/trafficmanagerexternalendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TrafficManagerExternalEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TrafficManagerExternalEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TrafficManagerExternalEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficManagerExternalEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/trafficmanagernestedendpoint/zz_controller.go b/internal/controller/network/trafficmanagernestedendpoint/zz_controller.go index 1a3985635..8561580fd 100755 --- a/internal/controller/network/trafficmanagernestedendpoint/zz_controller.go +++ b/internal/controller/network/trafficmanagernestedendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TrafficManagerNestedEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TrafficManagerNestedEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TrafficManagerNestedEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficManagerNestedEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/trafficmanagerprofile/zz_controller.go b/internal/controller/network/trafficmanagerprofile/zz_controller.go index 26dc21c57..5ae8379b9 100755 --- a/internal/controller/network/trafficmanagerprofile/zz_controller.go +++ b/internal/controller/network/trafficmanagerprofile/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.TrafficManagerProfile // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.TrafficManagerProfileList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.TrafficManagerProfileList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.TrafficManagerProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhub/zz_controller.go b/internal/controller/network/virtualhub/zz_controller.go index c358d054a..366c060d5 100755 --- a/internal/controller/network/virtualhub/zz_controller.go +++ b/internal/controller/network/virtualhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhubconnection/zz_controller.go b/internal/controller/network/virtualhubconnection/zz_controller.go index 045cc3a50..36f7503fa 100755 --- a/internal/controller/network/virtualhubconnection/zz_controller.go +++ b/internal/controller/network/virtualhubconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualHubConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualHubConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualHubConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualHubConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhubip/zz_controller.go b/internal/controller/network/virtualhubip/zz_controller.go index ce3d5ef30..ee7cd5bbe 100755 --- a/internal/controller/network/virtualhubip/zz_controller.go +++ b/internal/controller/network/virtualhubip/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualHubIP // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualHubIPList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualHubIPList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualHubIP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhubroutetable/zz_controller.go b/internal/controller/network/virtualhubroutetable/zz_controller.go index a98f58bef..4f1defb7e 100755 --- a/internal/controller/network/virtualhubroutetable/zz_controller.go +++ b/internal/controller/network/virtualhubroutetable/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualHubRouteTable // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualHubRouteTableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualHubRouteTableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualHubRouteTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhubroutetableroute/zz_controller.go b/internal/controller/network/virtualhubroutetableroute/zz_controller.go index 4f157d834..700cce570 100755 --- a/internal/controller/network/virtualhubroutetableroute/zz_controller.go +++ b/internal/controller/network/virtualhubroutetableroute/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualHubRouteTableRoute // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualHubRouteTableRouteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualHubRouteTableRouteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualHubRouteTableRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualhubsecuritypartnerprovider/zz_controller.go b/internal/controller/network/virtualhubsecuritypartnerprovider/zz_controller.go index 60dea2687..e6b683004 100755 --- a/internal/controller/network/virtualhubsecuritypartnerprovider/zz_controller.go +++ b/internal/controller/network/virtualhubsecuritypartnerprovider/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualHubSecurityPartnerProvider // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualHubSecurityPartnerProviderList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualHubSecurityPartnerProviderList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualHubSecurityPartnerProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualnetwork/zz_controller.go b/internal/controller/network/virtualnetwork/zz_controller.go index 2f117654f..6fe6876bb 100755 --- a/internal/controller/network/virtualnetwork/zz_controller.go +++ b/internal/controller/network/virtualnetwork/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualNetwork // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualNetworkList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualNetworkList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualNetwork_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualnetworkgateway/zz_controller.go b/internal/controller/network/virtualnetworkgateway/zz_controller.go index d3b1c9426..276847970 100755 --- a/internal/controller/network/virtualnetworkgateway/zz_controller.go +++ b/internal/controller/network/virtualnetworkgateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualNetworkGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualNetworkGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualNetworkGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualNetworkGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualnetworkgatewayconnection/zz_controller.go b/internal/controller/network/virtualnetworkgatewayconnection/zz_controller.go index 33f99ffb0..3956113cc 100755 --- a/internal/controller/network/virtualnetworkgatewayconnection/zz_controller.go +++ b/internal/controller/network/virtualnetworkgatewayconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VirtualNetworkGatewayConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VirtualNetworkGatewayConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VirtualNetworkGatewayConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VirtualNetworkGatewayConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualnetworkpeering/zz_controller.go b/internal/controller/network/virtualnetworkpeering/zz_controller.go index 688f6b06d..c7f62af6e 100755 --- a/internal/controller/network/virtualnetworkpeering/zz_controller.go +++ b/internal/controller/network/virtualnetworkpeering/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualNetworkPeering // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualNetworkPeeringList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualNetworkPeeringList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualNetworkPeering_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/virtualwan/zz_controller.go b/internal/controller/network/virtualwan/zz_controller.go index d359821df..d0961e085 100755 --- a/internal/controller/network/virtualwan/zz_controller.go +++ b/internal/controller/network/virtualwan/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VirtualWAN // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VirtualWANList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VirtualWANList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualWAN_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/vpngateway/zz_controller.go b/internal/controller/network/vpngateway/zz_controller.go index 20d73c9ea..8e72bc784 100755 --- a/internal/controller/network/vpngateway/zz_controller.go +++ b/internal/controller/network/vpngateway/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VPNGateway // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VPNGatewayList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VPNGatewayList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VPNGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/vpngatewayconnection/zz_controller.go b/internal/controller/network/vpngatewayconnection/zz_controller.go index 27b5b53ed..2890a40fa 100755 --- a/internal/controller/network/vpngatewayconnection/zz_controller.go +++ b/internal/controller/network/vpngatewayconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VPNGatewayConnection // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VPNGatewayConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VPNGatewayConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VPNGatewayConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/vpnserverconfiguration/zz_controller.go b/internal/controller/network/vpnserverconfiguration/zz_controller.go index b0dcff4fb..1f4750f8f 100755 --- a/internal/controller/network/vpnserverconfiguration/zz_controller.go +++ b/internal/controller/network/vpnserverconfiguration/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VPNServerConfiguration // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VPNServerConfigurationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VPNServerConfigurationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VPNServerConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/vpnserverconfigurationpolicygroup/zz_controller.go b/internal/controller/network/vpnserverconfigurationpolicygroup/zz_controller.go index aeaa6143c..650e64cb8 100755 --- a/internal/controller/network/vpnserverconfigurationpolicygroup/zz_controller.go +++ b/internal/controller/network/vpnserverconfigurationpolicygroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.VPNServerConfigurationPolicyGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.VPNServerConfigurationPolicyGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.VPNServerConfigurationPolicyGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNServerConfigurationPolicyGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/vpnsite/zz_controller.go b/internal/controller/network/vpnsite/zz_controller.go index 11b00f9d2..2eb118e31 100755 --- a/internal/controller/network/vpnsite/zz_controller.go +++ b/internal/controller/network/vpnsite/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.VPNSite // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VPNSiteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VPNSiteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.VPNSite_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/watcher/zz_controller.go b/internal/controller/network/watcher/zz_controller.go index 57dafb1b2..66a80c429 100755 --- a/internal/controller/network/watcher/zz_controller.go +++ b/internal/controller/network/watcher/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Watcher // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WatcherList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WatcherList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Watcher_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/watcherflowlog/zz_controller.go b/internal/controller/network/watcherflowlog/zz_controller.go index 63a3358b3..30c191030 100755 --- a/internal/controller/network/watcherflowlog/zz_controller.go +++ b/internal/controller/network/watcherflowlog/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WatcherFlowLog // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WatcherFlowLogList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WatcherFlowLogList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WatcherFlowLog_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/network/webapplicationfirewallpolicy/zz_controller.go b/internal/controller/network/webapplicationfirewallpolicy/zz_controller.go index b7cd887a4..6b4fd4180 100755 --- a/internal/controller/network/webapplicationfirewallpolicy/zz_controller.go +++ b/internal/controller/network/webapplicationfirewallpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WebApplicationFirewallPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WebApplicationFirewallPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WebApplicationFirewallPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WebApplicationFirewallPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/notificationhubs/authorizationrule/zz_controller.go b/internal/controller/notificationhubs/authorizationrule/zz_controller.go index 6636d29f3..e5ab75f2c 100755 --- a/internal/controller/notificationhubs/authorizationrule/zz_controller.go +++ b/internal/controller/notificationhubs/authorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/notificationhubs/notificationhub/zz_controller.go b/internal/controller/notificationhubs/notificationhub/zz_controller.go index 41534687d..59f655e0b 100755 --- a/internal/controller/notificationhubs/notificationhub/zz_controller.go +++ b/internal/controller/notificationhubs/notificationhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.NotificationHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.NotificationHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.NotificationHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.NotificationHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/notificationhubs/notificationhubnamespace/zz_controller.go b/internal/controller/notificationhubs/notificationhubnamespace/zz_controller.go index 011ab661d..c0e454927 100755 --- a/internal/controller/notificationhubs/notificationhubnamespace/zz_controller.go +++ b/internal/controller/notificationhubs/notificationhubnamespace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NotificationHubNamespace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NotificationHubNamespaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NotificationHubNamespaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotificationHubNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticsdataexportrule/zz_controller.go b/internal/controller/operationalinsights/loganalyticsdataexportrule/zz_controller.go index 4ee1b8887..7f28b0ca3 100755 --- a/internal/controller/operationalinsights/loganalyticsdataexportrule/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticsdataexportrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsDataExportRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsDataExportRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsDataExportRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsDataExportRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticsdatasourcewindowsevent/zz_controller.go b/internal/controller/operationalinsights/loganalyticsdatasourcewindowsevent/zz_controller.go index 87e6f6f1b..f86538e07 100755 --- a/internal/controller/operationalinsights/loganalyticsdatasourcewindowsevent/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticsdatasourcewindowsevent/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsDataSourceWindowsEvent // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsDataSourceWindowsEventList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsDataSourceWindowsEventList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsDataSourceWindowsEvent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticsdatasourcewindowsperformancecounter/zz_controller.go b/internal/controller/operationalinsights/loganalyticsdatasourcewindowsperformancecounter/zz_controller.go index ca8dd3ebd..a5e1c4de8 100755 --- a/internal/controller/operationalinsights/loganalyticsdatasourcewindowsperformancecounter/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticsdatasourcewindowsperformancecounter/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsDataSourceWindowsPerformanceCounter // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsDataSourceWindowsPerformanceCounterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsDataSourceWindowsPerformanceCounterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsDataSourceWindowsPerformanceCounter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticslinkedservice/zz_controller.go b/internal/controller/operationalinsights/loganalyticslinkedservice/zz_controller.go index 8822ef71f..1c861701b 100755 --- a/internal/controller/operationalinsights/loganalyticslinkedservice/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticslinkedservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsLinkedService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsLinkedServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsLinkedServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsLinkedService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticslinkedstorageaccount/zz_controller.go b/internal/controller/operationalinsights/loganalyticslinkedstorageaccount/zz_controller.go index 4e90d6ac8..cca50e171 100755 --- a/internal/controller/operationalinsights/loganalyticslinkedstorageaccount/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticslinkedstorageaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsLinkedStorageAccount // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsLinkedStorageAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsLinkedStorageAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsLinkedStorageAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticsquerypack/zz_controller.go b/internal/controller/operationalinsights/loganalyticsquerypack/zz_controller.go index 5b2a6262c..b463d0063 100755 --- a/internal/controller/operationalinsights/loganalyticsquerypack/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticsquerypack/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsQueryPack // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsQueryPackList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsQueryPackList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsQueryPack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticsquerypackquery/zz_controller.go b/internal/controller/operationalinsights/loganalyticsquerypackquery/zz_controller.go index b9e93eef9..70e3fe55e 100755 --- a/internal/controller/operationalinsights/loganalyticsquerypackquery/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticsquerypackquery/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsQueryPackQuery // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsQueryPackQueryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsQueryPackQueryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsQueryPackQuery_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/loganalyticssavedsearch/zz_controller.go b/internal/controller/operationalinsights/loganalyticssavedsearch/zz_controller.go index d851ce6e1..14de2239d 100755 --- a/internal/controller/operationalinsights/loganalyticssavedsearch/zz_controller.go +++ b/internal/controller/operationalinsights/loganalyticssavedsearch/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.LogAnalyticsSavedSearch // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.LogAnalyticsSavedSearchList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.LogAnalyticsSavedSearchList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LogAnalyticsSavedSearch_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationalinsights/workspace/zz_controller.go b/internal/controller/operationalinsights/workspace/zz_controller.go index 4ccb8b3e3..00dc93433 100755 --- a/internal/controller/operationalinsights/workspace/zz_controller.go +++ b/internal/controller/operationalinsights/workspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Workspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/operationsmanagement/loganalyticssolution/zz_controller.go b/internal/controller/operationsmanagement/loganalyticssolution/zz_controller.go index 21d50a620..22a1a651e 100755 --- a/internal/controller/operationsmanagement/loganalyticssolution/zz_controller.go +++ b/internal/controller/operationsmanagement/loganalyticssolution/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LogAnalyticsSolution // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LogAnalyticsSolutionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LogAnalyticsSolutionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LogAnalyticsSolution_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/orbital/contactprofile/zz_controller.go b/internal/controller/orbital/contactprofile/zz_controller.go index 91256e55b..6e6315714 100755 --- a/internal/controller/orbital/contactprofile/zz_controller.go +++ b/internal/controller/orbital/contactprofile/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ContactProfile // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ContactProfileList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ContactProfileList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContactProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/orbital/spacecraft/zz_controller.go b/internal/controller/orbital/spacecraft/zz_controller.go index e1bf6b80e..8166f5a10 100755 --- a/internal/controller/orbital/spacecraft/zz_controller.go +++ b/internal/controller/orbital/spacecraft/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Spacecraft // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SpacecraftList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SpacecraftList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Spacecraft_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/policyinsights/resourcepolicyremediation/zz_controller.go b/internal/controller/policyinsights/resourcepolicyremediation/zz_controller.go index fd67983b6..3a94bf849 100755 --- a/internal/controller/policyinsights/resourcepolicyremediation/zz_controller.go +++ b/internal/controller/policyinsights/resourcepolicyremediation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourcePolicyRemediation // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourcePolicyRemediationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourcePolicyRemediationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicyRemediation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/policyinsights/subscriptionpolicyremediation/zz_controller.go b/internal/controller/policyinsights/subscriptionpolicyremediation/zz_controller.go index 035906f80..569e9f442 100755 --- a/internal/controller/policyinsights/subscriptionpolicyremediation/zz_controller.go +++ b/internal/controller/policyinsights/subscriptionpolicyremediation/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubscriptionPolicyRemediation // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubscriptionPolicyRemediationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubscriptionPolicyRemediationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubscriptionPolicyRemediation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/portal/dashboard/zz_controller.go b/internal/controller/portal/dashboard/zz_controller.go index 550f1ad6b..9db1f42d6 100755 --- a/internal/controller/portal/dashboard/zz_controller.go +++ b/internal/controller/portal/dashboard/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Dashboard // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DashboardList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DashboardList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Dashboard_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/powerbidedicated/powerbiembedded/zz_controller.go b/internal/controller/powerbidedicated/powerbiembedded/zz_controller.go index 71e583e49..3c70b61d1 100755 --- a/internal/controller/powerbidedicated/powerbiembedded/zz_controller.go +++ b/internal/controller/powerbidedicated/powerbiembedded/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PowerBIEmbedded // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PowerBIEmbeddedList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PowerBIEmbeddedList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PowerBIEmbedded_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/purview/account/zz_controller.go b/internal/controller/purview/account/zz_controller.go index 4517e1672..b0ebe7e98 100755 --- a/internal/controller/purview/account/zz_controller.go +++ b/internal/controller/purview/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backupcontainerstorageaccount/zz_controller.go b/internal/controller/recoveryservices/backupcontainerstorageaccount/zz_controller.go index c9528d80c..9dcf8dbfd 100755 --- a/internal/controller/recoveryservices/backupcontainerstorageaccount/zz_controller.go +++ b/internal/controller/recoveryservices/backupcontainerstorageaccount/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupContainerStorageAccount // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupContainerStorageAccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupContainerStorageAccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupContainerStorageAccount_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backuppolicyfileshare/zz_controller.go b/internal/controller/recoveryservices/backuppolicyfileshare/zz_controller.go index 75ef3f2a6..70b65835b 100755 --- a/internal/controller/recoveryservices/backuppolicyfileshare/zz_controller.go +++ b/internal/controller/recoveryservices/backuppolicyfileshare/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupPolicyFileShare // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupPolicyFileShareList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupPolicyFileShareList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupPolicyFileShare_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backuppolicyvm/zz_controller.go b/internal/controller/recoveryservices/backuppolicyvm/zz_controller.go index 23a6c99ac..f6656762d 100755 --- a/internal/controller/recoveryservices/backuppolicyvm/zz_controller.go +++ b/internal/controller/recoveryservices/backuppolicyvm/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupPolicyVM // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupPolicyVMList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupPolicyVMList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupPolicyVM_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backuppolicyvmworkload/zz_controller.go b/internal/controller/recoveryservices/backuppolicyvmworkload/zz_controller.go index 9c34a4c19..a3f29c270 100755 --- a/internal/controller/recoveryservices/backuppolicyvmworkload/zz_controller.go +++ b/internal/controller/recoveryservices/backuppolicyvmworkload/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BackupPolicyVMWorkload // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BackupPolicyVMWorkloadList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BackupPolicyVMWorkloadList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BackupPolicyVMWorkload_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backupprotectedfileshare/zz_controller.go b/internal/controller/recoveryservices/backupprotectedfileshare/zz_controller.go index edec607d8..68a1ee98e 100755 --- a/internal/controller/recoveryservices/backupprotectedfileshare/zz_controller.go +++ b/internal/controller/recoveryservices/backupprotectedfileshare/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupProtectedFileShare // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupProtectedFileShareList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupProtectedFileShareList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupProtectedFileShare_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/backupprotectedvm/zz_controller.go b/internal/controller/recoveryservices/backupprotectedvm/zz_controller.go index 701d8d210..f1709548e 100755 --- a/internal/controller/recoveryservices/backupprotectedvm/zz_controller.go +++ b/internal/controller/recoveryservices/backupprotectedvm/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.BackupProtectedVM // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BackupProtectedVMList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BackupProtectedVMList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupProtectedVM_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/siterecoveryfabric/zz_controller.go b/internal/controller/recoveryservices/siterecoveryfabric/zz_controller.go index 5e63d7907..aa36fc181 100755 --- a/internal/controller/recoveryservices/siterecoveryfabric/zz_controller.go +++ b/internal/controller/recoveryservices/siterecoveryfabric/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SiteRecoveryFabric // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SiteRecoveryFabricList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SiteRecoveryFabricList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SiteRecoveryFabric_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/siterecoverynetworkmapping/zz_controller.go b/internal/controller/recoveryservices/siterecoverynetworkmapping/zz_controller.go index d4a975bff..4aeb4b7e2 100755 --- a/internal/controller/recoveryservices/siterecoverynetworkmapping/zz_controller.go +++ b/internal/controller/recoveryservices/siterecoverynetworkmapping/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SiteRecoveryNetworkMapping // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SiteRecoveryNetworkMappingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SiteRecoveryNetworkMappingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SiteRecoveryNetworkMapping_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/siterecoveryprotectioncontainer/zz_controller.go b/internal/controller/recoveryservices/siterecoveryprotectioncontainer/zz_controller.go index e604e73d5..aa590feb2 100755 --- a/internal/controller/recoveryservices/siterecoveryprotectioncontainer/zz_controller.go +++ b/internal/controller/recoveryservices/siterecoveryprotectioncontainer/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SiteRecoveryProtectionContainer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SiteRecoveryProtectionContainerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SiteRecoveryProtectionContainerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SiteRecoveryProtectionContainer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/siterecoveryprotectioncontainermapping/zz_controller.go b/internal/controller/recoveryservices/siterecoveryprotectioncontainermapping/zz_controller.go index a7eb1b055..ce21c539f 100755 --- a/internal/controller/recoveryservices/siterecoveryprotectioncontainermapping/zz_controller.go +++ b/internal/controller/recoveryservices/siterecoveryprotectioncontainermapping/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SiteRecoveryProtectionContainerMapping // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SiteRecoveryProtectionContainerMappingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SiteRecoveryProtectionContainerMappingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SiteRecoveryProtectionContainerMapping_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/siterecoveryreplicationpolicy/zz_controller.go b/internal/controller/recoveryservices/siterecoveryreplicationpolicy/zz_controller.go index 5ed0a5231..8eb539393 100755 --- a/internal/controller/recoveryservices/siterecoveryreplicationpolicy/zz_controller.go +++ b/internal/controller/recoveryservices/siterecoveryreplicationpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SiteRecoveryReplicationPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SiteRecoveryReplicationPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SiteRecoveryReplicationPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SiteRecoveryReplicationPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/recoveryservices/vault/zz_controller.go b/internal/controller/recoveryservices/vault/zz_controller.go index 05a08bcc2..2127d9f03 100755 --- a/internal/controller/recoveryservices/vault/zz_controller.go +++ b/internal/controller/recoveryservices/vault/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Vault // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.VaultList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.VaultList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Vault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/relay/eventrelaynamespace/zz_controller.go b/internal/controller/relay/eventrelaynamespace/zz_controller.go index 3aeead353..5e2013d20 100755 --- a/internal/controller/relay/eventrelaynamespace/zz_controller.go +++ b/internal/controller/relay/eventrelaynamespace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EventRelayNamespace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EventRelayNamespaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EventRelayNamespaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventRelayNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/relay/hybridconnection/zz_controller.go b/internal/controller/relay/hybridconnection/zz_controller.go index 3b109cacb..c55b076e4 100755 --- a/internal/controller/relay/hybridconnection/zz_controller.go +++ b/internal/controller/relay/hybridconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HybridConnection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HybridConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HybridConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HybridConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/relay/hybridconnectionauthorizationrule/zz_controller.go b/internal/controller/relay/hybridconnectionauthorizationrule/zz_controller.go index 8779af767..492b54689 100755 --- a/internal/controller/relay/hybridconnectionauthorizationrule/zz_controller.go +++ b/internal/controller/relay/hybridconnectionauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HybridConnectionAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HybridConnectionAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HybridConnectionAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HybridConnectionAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/relay/namespaceauthorizationrule/zz_controller.go b/internal/controller/relay/namespaceauthorizationrule/zz_controller.go index 7b170b86a..ce15b5a13 100755 --- a/internal/controller/relay/namespaceauthorizationrule/zz_controller.go +++ b/internal/controller/relay/namespaceauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/resources/resourcedeploymentscriptazurecli/zz_controller.go b/internal/controller/resources/resourcedeploymentscriptazurecli/zz_controller.go index 06978c7cc..ad3f00f5a 100755 --- a/internal/controller/resources/resourcedeploymentscriptazurecli/zz_controller.go +++ b/internal/controller/resources/resourcedeploymentscriptazurecli/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ResourceDeploymentScriptAzureCli // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ResourceDeploymentScriptAzureCliList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ResourceDeploymentScriptAzureCliList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ResourceDeploymentScriptAzureCli_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/resources/resourcedeploymentscriptazurepowershell/zz_controller.go b/internal/controller/resources/resourcedeploymentscriptazurepowershell/zz_controller.go index 1db747d83..0faf53870 100755 --- a/internal/controller/resources/resourcedeploymentscriptazurepowershell/zz_controller.go +++ b/internal/controller/resources/resourcedeploymentscriptazurepowershell/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ResourceDeploymentScriptAzurePowerShell // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ResourceDeploymentScriptAzurePowerShellList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ResourceDeploymentScriptAzurePowerShellList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ResourceDeploymentScriptAzurePowerShell_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/resources/resourcegrouptemplatedeployment/zz_controller.go b/internal/controller/resources/resourcegrouptemplatedeployment/zz_controller.go index 2b2190d72..39f4e6442 100755 --- a/internal/controller/resources/resourcegrouptemplatedeployment/zz_controller.go +++ b/internal/controller/resources/resourcegrouptemplatedeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ResourceGroupTemplateDeployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ResourceGroupTemplateDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ResourceGroupTemplateDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceGroupTemplateDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/resources/subscriptiontemplatedeployment/zz_controller.go b/internal/controller/resources/subscriptiontemplatedeployment/zz_controller.go index f450e0c8f..5a37419e2 100755 --- a/internal/controller/resources/subscriptiontemplatedeployment/zz_controller.go +++ b/internal/controller/resources/subscriptiontemplatedeployment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SubscriptionTemplateDeployment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SubscriptionTemplateDeploymentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SubscriptionTemplateDeploymentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubscriptionTemplateDeployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/search/service/zz_controller.go b/internal/controller/search/service/zz_controller.go index 3232abbc8..597ba0930 100755 --- a/internal/controller/search/service/zz_controller.go +++ b/internal/controller/search/service/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Service // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/search/sharedprivatelinkservice/zz_controller.go b/internal/controller/search/sharedprivatelinkservice/zz_controller.go index 3a08a2063..4b357c7ed 100755 --- a/internal/controller/search/sharedprivatelinkservice/zz_controller.go +++ b/internal/controller/search/sharedprivatelinkservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SharedPrivateLinkService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SharedPrivateLinkServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SharedPrivateLinkServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SharedPrivateLinkService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/advancedthreatprotection/zz_controller.go b/internal/controller/security/advancedthreatprotection/zz_controller.go index 9a70fa617..6066a6b38 100755 --- a/internal/controller/security/advancedthreatprotection/zz_controller.go +++ b/internal/controller/security/advancedthreatprotection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AdvancedThreatProtection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AdvancedThreatProtectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AdvancedThreatProtectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AdvancedThreatProtection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/iotsecuritydevicegroup/zz_controller.go b/internal/controller/security/iotsecuritydevicegroup/zz_controller.go index dd65ff6ae..7d3abf7c5 100755 --- a/internal/controller/security/iotsecuritydevicegroup/zz_controller.go +++ b/internal/controller/security/iotsecuritydevicegroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTSecurityDeviceGroup // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTSecurityDeviceGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTSecurityDeviceGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTSecurityDeviceGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/iotsecuritysolution/zz_controller.go b/internal/controller/security/iotsecuritysolution/zz_controller.go index 31fbbcc95..46d3784a6 100755 --- a/internal/controller/security/iotsecuritysolution/zz_controller.go +++ b/internal/controller/security/iotsecuritysolution/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.IOTSecuritySolution // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.IOTSecuritySolutionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.IOTSecuritySolutionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.IOTSecuritySolution_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterassessment/zz_controller.go b/internal/controller/security/securitycenterassessment/zz_controller.go index bab16fcc9..c36ae2543 100755 --- a/internal/controller/security/securitycenterassessment/zz_controller.go +++ b/internal/controller/security/securitycenterassessment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SecurityCenterAssessment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SecurityCenterAssessmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SecurityCenterAssessmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SecurityCenterAssessment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterassessmentpolicy/zz_controller.go b/internal/controller/security/securitycenterassessmentpolicy/zz_controller.go index 55524ec18..9f4049ed9 100755 --- a/internal/controller/security/securitycenterassessmentpolicy/zz_controller.go +++ b/internal/controller/security/securitycenterassessmentpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterAssessmentPolicy // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterAssessmentPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterAssessmentPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterAssessmentPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterautoprovisioning/zz_controller.go b/internal/controller/security/securitycenterautoprovisioning/zz_controller.go index 9e5648fe6..836909f8f 100755 --- a/internal/controller/security/securitycenterautoprovisioning/zz_controller.go +++ b/internal/controller/security/securitycenterautoprovisioning/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterAutoProvisioning // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterAutoProvisioningList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterAutoProvisioningList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterAutoProvisioning_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycentercontact/zz_controller.go b/internal/controller/security/securitycentercontact/zz_controller.go index 4da06e4ef..a07cf0bfc 100755 --- a/internal/controller/security/securitycentercontact/zz_controller.go +++ b/internal/controller/security/securitycentercontact/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterContact // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterContactList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterContactList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterContact_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterservervulnerabilityassessment/zz_controller.go b/internal/controller/security/securitycenterservervulnerabilityassessment/zz_controller.go index df86eaca4..8f84a4862 100755 --- a/internal/controller/security/securitycenterservervulnerabilityassessment/zz_controller.go +++ b/internal/controller/security/securitycenterservervulnerabilityassessment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterServerVulnerabilityAssessment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterServerVulnerabilityAssessmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterServerVulnerabilityAssessmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterServerVulnerabilityAssessment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterservervulnerabilityassessmentvirtualmachine/zz_controller.go b/internal/controller/security/securitycenterservervulnerabilityassessmentvirtualmachine/zz_controller.go index fc86f0ad4..72ae154bb 100755 --- a/internal/controller/security/securitycenterservervulnerabilityassessmentvirtualmachine/zz_controller.go +++ b/internal/controller/security/securitycenterservervulnerabilityassessmentvirtualmachine/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterServerVulnerabilityAssessmentVirtualMachine // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterServerVulnerabilityAssessmentVirtualMachineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterServerVulnerabilityAssessmentVirtualMachineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterServerVulnerabilityAssessmentVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycentersetting/zz_controller.go b/internal/controller/security/securitycentersetting/zz_controller.go index 61178d30b..3dfccae1d 100755 --- a/internal/controller/security/securitycentersetting/zz_controller.go +++ b/internal/controller/security/securitycentersetting/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterSetting // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterSettingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterSettingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterSetting_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycentersubscriptionpricing/zz_controller.go b/internal/controller/security/securitycentersubscriptionpricing/zz_controller.go index f7d58b757..8725429b7 100755 --- a/internal/controller/security/securitycentersubscriptionpricing/zz_controller.go +++ b/internal/controller/security/securitycentersubscriptionpricing/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterSubscriptionPricing // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterSubscriptionPricingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterSubscriptionPricingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterSubscriptionPricing_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/security/securitycenterworkspace/zz_controller.go b/internal/controller/security/securitycenterworkspace/zz_controller.go index c391be373..5c077e2e5 100755 --- a/internal/controller/security/securitycenterworkspace/zz_controller.go +++ b/internal/controller/security/securitycenterworkspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SecurityCenterWorkspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SecurityCenterWorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SecurityCenterWorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityCenterWorkspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelalertrulefusion/zz_controller.go b/internal/controller/securityinsights/sentinelalertrulefusion/zz_controller.go index 6a59e2428..0710eafd6 100755 --- a/internal/controller/securityinsights/sentinelalertrulefusion/zz_controller.go +++ b/internal/controller/securityinsights/sentinelalertrulefusion/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelAlertRuleFusion // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelAlertRuleFusionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelAlertRuleFusionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelAlertRuleFusion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelalertrulemachinelearningbehavioranalytics/zz_controller.go b/internal/controller/securityinsights/sentinelalertrulemachinelearningbehavioranalytics/zz_controller.go index 6e98187e1..4760ce6db 100755 --- a/internal/controller/securityinsights/sentinelalertrulemachinelearningbehavioranalytics/zz_controller.go +++ b/internal/controller/securityinsights/sentinelalertrulemachinelearningbehavioranalytics/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelAlertRuleMachineLearningBehaviorAnalytics // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelAlertRuleMachineLearningBehaviorAnalyticsList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelAlertRuleMachineLearningBehaviorAnalyticsList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelAlertRuleMachineLearningBehaviorAnalytics_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelalertrulemssecurityincident/zz_controller.go b/internal/controller/securityinsights/sentinelalertrulemssecurityincident/zz_controller.go index 172c79090..cd81ead76 100755 --- a/internal/controller/securityinsights/sentinelalertrulemssecurityincident/zz_controller.go +++ b/internal/controller/securityinsights/sentinelalertrulemssecurityincident/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelAlertRuleMSSecurityIncident // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelAlertRuleMSSecurityIncidentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelAlertRuleMSSecurityIncidentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelAlertRuleMSSecurityIncident_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelautomationrule/zz_controller.go b/internal/controller/securityinsights/sentinelautomationrule/zz_controller.go index 40ea604dd..1cab4520c 100755 --- a/internal/controller/securityinsights/sentinelautomationrule/zz_controller.go +++ b/internal/controller/securityinsights/sentinelautomationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelAutomationRule // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelAutomationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelAutomationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelAutomationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentineldataconnectoriot/zz_controller.go b/internal/controller/securityinsights/sentineldataconnectoriot/zz_controller.go index 68f791ac3..b6c14940b 100755 --- a/internal/controller/securityinsights/sentineldataconnectoriot/zz_controller.go +++ b/internal/controller/securityinsights/sentineldataconnectoriot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelDataConnectorIOT // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelDataConnectorIOTList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelDataConnectorIOTList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelDataConnectorIOT_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelloganalyticsworkspaceonboarding/zz_controller.go b/internal/controller/securityinsights/sentinelloganalyticsworkspaceonboarding/zz_controller.go index 38ed56214..3316acf35 100755 --- a/internal/controller/securityinsights/sentinelloganalyticsworkspaceonboarding/zz_controller.go +++ b/internal/controller/securityinsights/sentinelloganalyticsworkspaceonboarding/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelLogAnalyticsWorkspaceOnboarding // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelLogAnalyticsWorkspaceOnboardingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelLogAnalyticsWorkspaceOnboardingList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelLogAnalyticsWorkspaceOnboarding_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityinsights/sentinelwatchlist/zz_controller.go b/internal/controller/securityinsights/sentinelwatchlist/zz_controller.go index 5c4c94183..60104af23 100755 --- a/internal/controller/securityinsights/sentinelwatchlist/zz_controller.go +++ b/internal/controller/securityinsights/sentinelwatchlist/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SentinelWatchlist // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SentinelWatchlistList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SentinelWatchlistList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SentinelWatchlist_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/namespaceauthorizationrule/zz_controller.go b/internal/controller/servicebus/namespaceauthorizationrule/zz_controller.go index 9cf471f9a..7e8606177 100755 --- a/internal/controller/servicebus/namespaceauthorizationrule/zz_controller.go +++ b/internal/controller/servicebus/namespaceauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/namespacedisasterrecoveryconfig/zz_controller.go b/internal/controller/servicebus/namespacedisasterrecoveryconfig/zz_controller.go index f3d65129c..815148ea7 100755 --- a/internal/controller/servicebus/namespacedisasterrecoveryconfig/zz_controller.go +++ b/internal/controller/servicebus/namespacedisasterrecoveryconfig/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceDisasterRecoveryConfig // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceDisasterRecoveryConfigList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceDisasterRecoveryConfigList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceDisasterRecoveryConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/namespacenetworkruleset/zz_controller.go b/internal/controller/servicebus/namespacenetworkruleset/zz_controller.go index f345e3d67..ba24a0e3a 100755 --- a/internal/controller/servicebus/namespacenetworkruleset/zz_controller.go +++ b/internal/controller/servicebus/namespacenetworkruleset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.NamespaceNetworkRuleSet // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.NamespaceNetworkRuleSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.NamespaceNetworkRuleSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamespaceNetworkRuleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/queue/zz_controller.go b/internal/controller/servicebus/queue/zz_controller.go index 43b5804ec..a041580de 100755 --- a/internal/controller/servicebus/queue/zz_controller.go +++ b/internal/controller/servicebus/queue/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Queue // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.QueueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.QueueList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/queueauthorizationrule/zz_controller.go b/internal/controller/servicebus/queueauthorizationrule/zz_controller.go index 7b7bc72da..498e3b474 100755 --- a/internal/controller/servicebus/queueauthorizationrule/zz_controller.go +++ b/internal/controller/servicebus/queueauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.QueueAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.QueueAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.QueueAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QueueAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/servicebusnamespace/zz_controller.go b/internal/controller/servicebus/servicebusnamespace/zz_controller.go index a375e3807..03d33704b 100755 --- a/internal/controller/servicebus/servicebusnamespace/zz_controller.go +++ b/internal/controller/servicebus/servicebusnamespace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ServiceBusNamespace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServiceBusNamespaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServiceBusNamespaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ServiceBusNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/subscription/zz_controller.go b/internal/controller/servicebus/subscription/zz_controller.go index 324f44bb8..36e0e1e45 100755 --- a/internal/controller/servicebus/subscription/zz_controller.go +++ b/internal/controller/servicebus/subscription/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Subscription // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubscriptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubscriptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Subscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/subscriptionrule/zz_controller.go b/internal/controller/servicebus/subscriptionrule/zz_controller.go index 39f4b6aa1..06bd588ff 100755 --- a/internal/controller/servicebus/subscriptionrule/zz_controller.go +++ b/internal/controller/servicebus/subscriptionrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SubscriptionRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SubscriptionRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SubscriptionRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SubscriptionRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/topic/zz_controller.go b/internal/controller/servicebus/topic/zz_controller.go index 480d65c04..959931564 100755 --- a/internal/controller/servicebus/topic/zz_controller.go +++ b/internal/controller/servicebus/topic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Topic // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Topic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicebus/topicauthorizationrule/zz_controller.go b/internal/controller/servicebus/topicauthorizationrule/zz_controller.go index 6b25edabd..734f5b9f6 100755 --- a/internal/controller/servicebus/topicauthorizationrule/zz_controller.go +++ b/internal/controller/servicebus/topicauthorizationrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TopicAuthorizationRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TopicAuthorizationRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TopicAuthorizationRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TopicAuthorizationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicefabric/cluster/zz_controller.go b/internal/controller/servicefabric/cluster/zz_controller.go index 772eb6b32..dcfd416b2 100755 --- a/internal/controller/servicefabric/cluster/zz_controller.go +++ b/internal/controller/servicefabric/cluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Cluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicefabric/managedcluster/zz_controller.go b/internal/controller/servicefabric/managedcluster/zz_controller.go index 19d4bd5a5..fecbbd1f4 100755 --- a/internal/controller/servicefabric/managedcluster/zz_controller.go +++ b/internal/controller/servicefabric/managedcluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ManagedCluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagedClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagedClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ManagedCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicelinker/springcloudconnection/zz_controller.go b/internal/controller/servicelinker/springcloudconnection/zz_controller.go index a3a5ac366..7d51b0c33 100755 --- a/internal/controller/servicelinker/springcloudconnection/zz_controller.go +++ b/internal/controller/servicelinker/springcloudconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SpringCloudConnection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SpringCloudConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SpringCloudConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SpringCloudConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/networkacl/zz_controller.go b/internal/controller/signalrservice/networkacl/zz_controller.go index a33f4ff96..63da3791d 100755 --- a/internal/controller/signalrservice/networkacl/zz_controller.go +++ b/internal/controller/signalrservice/networkacl/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.NetworkACL // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.NetworkACLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.NetworkACLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.NetworkACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/service/zz_controller.go b/internal/controller/signalrservice/service/zz_controller.go index 4e7931680..0c1f3280e 100755 --- a/internal/controller/signalrservice/service/zz_controller.go +++ b/internal/controller/signalrservice/service/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Service // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/signalrsharedprivatelinkresource/zz_controller.go b/internal/controller/signalrservice/signalrsharedprivatelinkresource/zz_controller.go index 50ef716fe..532bdd801 100755 --- a/internal/controller/signalrservice/signalrsharedprivatelinkresource/zz_controller.go +++ b/internal/controller/signalrservice/signalrsharedprivatelinkresource/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SignalrSharedPrivateLinkResource // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SignalrSharedPrivateLinkResourceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SignalrSharedPrivateLinkResourceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SignalrSharedPrivateLinkResource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/webpubsub/zz_controller.go b/internal/controller/signalrservice/webpubsub/zz_controller.go index dc05ab871..561bb7804 100755 --- a/internal/controller/signalrservice/webpubsub/zz_controller.go +++ b/internal/controller/signalrservice/webpubsub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WebPubsub // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WebPubsubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WebPubsubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WebPubsub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/webpubsubhub/zz_controller.go b/internal/controller/signalrservice/webpubsubhub/zz_controller.go index 9b464ed82..2c3c8c589 100755 --- a/internal/controller/signalrservice/webpubsubhub/zz_controller.go +++ b/internal/controller/signalrservice/webpubsubhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WebPubsubHub // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WebPubsubHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WebPubsubHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WebPubsubHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signalrservice/webpubsubnetworkacl/zz_controller.go b/internal/controller/signalrservice/webpubsubnetworkacl/zz_controller.go index 6b7e5001a..b8123fc04 100755 --- a/internal/controller/signalrservice/webpubsubnetworkacl/zz_controller.go +++ b/internal/controller/signalrservice/webpubsubnetworkacl/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WebPubsubNetworkACL // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WebPubsubNetworkACLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WebPubsubNetworkACLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WebPubsubNetworkACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/solutions/managedapplicationdefinition/zz_controller.go b/internal/controller/solutions/managedapplicationdefinition/zz_controller.go index db9d95c67..96f69867f 100755 --- a/internal/controller/solutions/managedapplicationdefinition/zz_controller.go +++ b/internal/controller/solutions/managedapplicationdefinition/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedApplicationDefinition // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedApplicationDefinitionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedApplicationDefinitionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedApplicationDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/spring/cloudapplicationliveview/zz_controller.go b/internal/controller/spring/cloudapplicationliveview/zz_controller.go index 9087c11e2..7ee91380f 100755 --- a/internal/controller/spring/cloudapplicationliveview/zz_controller.go +++ b/internal/controller/spring/cloudapplicationliveview/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.CloudApplicationLiveView // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.CloudApplicationLiveViewList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.CloudApplicationLiveViewList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CloudApplicationLiveView_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqldatabase/zz_controller.go b/internal/controller/sql/mssqldatabase/zz_controller.go index c879aa115..2a9e6f4f9 100755 --- a/internal/controller/sql/mssqldatabase/zz_controller.go +++ b/internal/controller/sql/mssqldatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqldatabaseextendedauditingpolicy/zz_controller.go b/internal/controller/sql/mssqldatabaseextendedauditingpolicy/zz_controller.go index 55b34b87b..f91945edf 100755 --- a/internal/controller/sql/mssqldatabaseextendedauditingpolicy/zz_controller.go +++ b/internal/controller/sql/mssqldatabaseextendedauditingpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLDatabaseExtendedAuditingPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLDatabaseExtendedAuditingPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLDatabaseExtendedAuditingPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLDatabaseExtendedAuditingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqldatabasevulnerabilityassessmentrulebaseline/zz_controller.go b/internal/controller/sql/mssqldatabasevulnerabilityassessmentrulebaseline/zz_controller.go index eeb2708c6..6fe45ede0 100755 --- a/internal/controller/sql/mssqldatabasevulnerabilityassessmentrulebaseline/zz_controller.go +++ b/internal/controller/sql/mssqldatabasevulnerabilityassessmentrulebaseline/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLDatabaseVulnerabilityAssessmentRuleBaseline // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLDatabaseVulnerabilityAssessmentRuleBaselineList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLDatabaseVulnerabilityAssessmentRuleBaselineList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLDatabaseVulnerabilityAssessmentRuleBaseline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlelasticpool/zz_controller.go b/internal/controller/sql/mssqlelasticpool/zz_controller.go index 1080d041e..d3d1bd629 100755 --- a/internal/controller/sql/mssqlelasticpool/zz_controller.go +++ b/internal/controller/sql/mssqlelasticpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLElasticPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLElasticPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLElasticPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLElasticPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlfailovergroup/zz_controller.go b/internal/controller/sql/mssqlfailovergroup/zz_controller.go index 38d00141f..964f4e0c8 100755 --- a/internal/controller/sql/mssqlfailovergroup/zz_controller.go +++ b/internal/controller/sql/mssqlfailovergroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLFailoverGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLFailoverGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLFailoverGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLFailoverGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlfirewallrule/zz_controller.go b/internal/controller/sql/mssqlfirewallrule/zz_controller.go index ac6383431..5e5aa98dd 100755 --- a/internal/controller/sql/mssqlfirewallrule/zz_controller.go +++ b/internal/controller/sql/mssqlfirewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLFirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLFirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLFirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLFirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqljobagent/zz_controller.go b/internal/controller/sql/mssqljobagent/zz_controller.go index 7edf9094f..4c3b80977 100755 --- a/internal/controller/sql/mssqljobagent/zz_controller.go +++ b/internal/controller/sql/mssqljobagent/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLJobAgent // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLJobAgentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLJobAgentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLJobAgent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqljobcredential/zz_controller.go b/internal/controller/sql/mssqljobcredential/zz_controller.go index d15a5010c..95e804717 100755 --- a/internal/controller/sql/mssqljobcredential/zz_controller.go +++ b/internal/controller/sql/mssqljobcredential/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLJobCredential // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLJobCredentialList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLJobCredentialList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLJobCredential_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlmanageddatabase/zz_controller.go b/internal/controller/sql/mssqlmanageddatabase/zz_controller.go index 4a6ec1b67..8c3a11381 100755 --- a/internal/controller/sql/mssqlmanageddatabase/zz_controller.go +++ b/internal/controller/sql/mssqlmanageddatabase/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLManagedDatabase // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLManagedDatabaseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLManagedDatabaseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLManagedDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlmanagedinstance/zz_controller.go b/internal/controller/sql/mssqlmanagedinstance/zz_controller.go index 41742e6bd..6b84bfcc6 100755 --- a/internal/controller/sql/mssqlmanagedinstance/zz_controller.go +++ b/internal/controller/sql/mssqlmanagedinstance/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLManagedInstance // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLManagedInstanceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLManagedInstanceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLManagedInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlmanagedinstanceactivedirectoryadministrator/zz_controller.go b/internal/controller/sql/mssqlmanagedinstanceactivedirectoryadministrator/zz_controller.go index 2601ee256..b27b53448 100755 --- a/internal/controller/sql/mssqlmanagedinstanceactivedirectoryadministrator/zz_controller.go +++ b/internal/controller/sql/mssqlmanagedinstanceactivedirectoryadministrator/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLManagedInstanceActiveDirectoryAdministrator // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLManagedInstanceActiveDirectoryAdministratorList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLManagedInstanceActiveDirectoryAdministratorList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLManagedInstanceActiveDirectoryAdministrator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlmanagedinstancefailovergroup/zz_controller.go b/internal/controller/sql/mssqlmanagedinstancefailovergroup/zz_controller.go index debc22fc6..8e4dda3d5 100755 --- a/internal/controller/sql/mssqlmanagedinstancefailovergroup/zz_controller.go +++ b/internal/controller/sql/mssqlmanagedinstancefailovergroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLManagedInstanceFailoverGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLManagedInstanceFailoverGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLManagedInstanceFailoverGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLManagedInstanceFailoverGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlmanagedinstancevulnerabilityassessment/zz_controller.go b/internal/controller/sql/mssqlmanagedinstancevulnerabilityassessment/zz_controller.go index 67932538b..5dfb1f3db 100755 --- a/internal/controller/sql/mssqlmanagedinstancevulnerabilityassessment/zz_controller.go +++ b/internal/controller/sql/mssqlmanagedinstancevulnerabilityassessment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLManagedInstanceVulnerabilityAssessment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLManagedInstanceVulnerabilityAssessmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLManagedInstanceVulnerabilityAssessmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLManagedInstanceVulnerabilityAssessment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqloutboundfirewallrule/zz_controller.go b/internal/controller/sql/mssqloutboundfirewallrule/zz_controller.go index d83ba5380..f74da25e9 100755 --- a/internal/controller/sql/mssqloutboundfirewallrule/zz_controller.go +++ b/internal/controller/sql/mssqloutboundfirewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLOutboundFirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLOutboundFirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLOutboundFirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLOutboundFirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlserver/zz_controller.go b/internal/controller/sql/mssqlserver/zz_controller.go index 686cfb62b..25d1c2357 100755 --- a/internal/controller/sql/mssqlserver/zz_controller.go +++ b/internal/controller/sql/mssqlserver/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLServer // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLServerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLServerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlserverdnsalias/zz_controller.go b/internal/controller/sql/mssqlserverdnsalias/zz_controller.go index 532807e3d..f9b9583ff 100755 --- a/internal/controller/sql/mssqlserverdnsalias/zz_controller.go +++ b/internal/controller/sql/mssqlserverdnsalias/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLServerDNSAlias // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLServerDNSAliasList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLServerDNSAliasList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLServerDNSAlias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlservermicrosoftsupportauditingpolicy/zz_controller.go b/internal/controller/sql/mssqlservermicrosoftsupportauditingpolicy/zz_controller.go index 3da473925..c875f09f8 100755 --- a/internal/controller/sql/mssqlservermicrosoftsupportauditingpolicy/zz_controller.go +++ b/internal/controller/sql/mssqlservermicrosoftsupportauditingpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLServerMicrosoftSupportAuditingPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLServerMicrosoftSupportAuditingPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLServerMicrosoftSupportAuditingPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLServerMicrosoftSupportAuditingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlserversecurityalertpolicy/zz_controller.go b/internal/controller/sql/mssqlserversecurityalertpolicy/zz_controller.go index 9c462a767..4d56f8384 100755 --- a/internal/controller/sql/mssqlserversecurityalertpolicy/zz_controller.go +++ b/internal/controller/sql/mssqlserversecurityalertpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLServerSecurityAlertPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLServerSecurityAlertPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLServerSecurityAlertPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLServerSecurityAlertPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlservertransparentdataencryption/zz_controller.go b/internal/controller/sql/mssqlservertransparentdataencryption/zz_controller.go index 29ef4555a..5ddb32754 100755 --- a/internal/controller/sql/mssqlservertransparentdataencryption/zz_controller.go +++ b/internal/controller/sql/mssqlservertransparentdataencryption/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLServerTransparentDataEncryption // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLServerTransparentDataEncryptionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLServerTransparentDataEncryptionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLServerTransparentDataEncryption_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlservervulnerabilityassessment/zz_controller.go b/internal/controller/sql/mssqlservervulnerabilityassessment/zz_controller.go index d31ccdd3f..5fffa2579 100755 --- a/internal/controller/sql/mssqlservervulnerabilityassessment/zz_controller.go +++ b/internal/controller/sql/mssqlservervulnerabilityassessment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.MSSQLServerVulnerabilityAssessment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.MSSQLServerVulnerabilityAssessmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.MSSQLServerVulnerabilityAssessmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.MSSQLServerVulnerabilityAssessment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sql/mssqlvirtualnetworkrule/zz_controller.go b/internal/controller/sql/mssqlvirtualnetworkrule/zz_controller.go index b8a84ded3..f25004bf3 100755 --- a/internal/controller/sql/mssqlvirtualnetworkrule/zz_controller.go +++ b/internal/controller/sql/mssqlvirtualnetworkrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.MSSQLVirtualNetworkRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.MSSQLVirtualNetworkRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.MSSQLVirtualNetworkRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MSSQLVirtualNetworkRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/account/zz_controller.go b/internal/controller/storage/account/zz_controller.go index ab15d8e93..069d3fedc 100755 --- a/internal/controller/storage/account/zz_controller.go +++ b/internal/controller/storage/account/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Account // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/accountlocaluser/zz_controller.go b/internal/controller/storage/accountlocaluser/zz_controller.go index 8c57b51d7..fac1d619c 100755 --- a/internal/controller/storage/accountlocaluser/zz_controller.go +++ b/internal/controller/storage/accountlocaluser/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AccountLocalUser // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AccountLocalUserList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AccountLocalUserList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AccountLocalUser_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/accountnetworkrules/zz_controller.go b/internal/controller/storage/accountnetworkrules/zz_controller.go index 1de1059e7..883a90787 100755 --- a/internal/controller/storage/accountnetworkrules/zz_controller.go +++ b/internal/controller/storage/accountnetworkrules/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AccountNetworkRules // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AccountNetworkRulesList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AccountNetworkRulesList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountNetworkRules_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/blob/zz_controller.go b/internal/controller/storage/blob/zz_controller.go index 741996b66..3b3fc0d11 100755 --- a/internal/controller/storage/blob/zz_controller.go +++ b/internal/controller/storage/blob/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Blob // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.BlobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.BlobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Blob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/blobinventorypolicy/zz_controller.go b/internal/controller/storage/blobinventorypolicy/zz_controller.go index 3e9e2209e..cae747991 100755 --- a/internal/controller/storage/blobinventorypolicy/zz_controller.go +++ b/internal/controller/storage/blobinventorypolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.BlobInventoryPolicy // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.BlobInventoryPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.BlobInventoryPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.BlobInventoryPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/container/zz_controller.go b/internal/controller/storage/container/zz_controller.go index eefbe0d96..ff6021ad4 100755 --- a/internal/controller/storage/container/zz_controller.go +++ b/internal/controller/storage/container/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Container // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ContainerList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ContainerList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Container_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/datalakegen2filesystem/zz_controller.go b/internal/controller/storage/datalakegen2filesystem/zz_controller.go index 10f89d13a..1e59ea22e 100755 --- a/internal/controller/storage/datalakegen2filesystem/zz_controller.go +++ b/internal/controller/storage/datalakegen2filesystem/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataLakeGen2FileSystem // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataLakeGen2FileSystemList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataLakeGen2FileSystemList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataLakeGen2FileSystem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/datalakegen2path/zz_controller.go b/internal/controller/storage/datalakegen2path/zz_controller.go index 882a445d2..0b004c043 100755 --- a/internal/controller/storage/datalakegen2path/zz_controller.go +++ b/internal/controller/storage/datalakegen2path/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DataLakeGen2Path // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DataLakeGen2PathList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DataLakeGen2PathList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataLakeGen2Path_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/encryptionscope/zz_controller.go b/internal/controller/storage/encryptionscope/zz_controller.go index 9c9d5d284..7f2d81497 100755 --- a/internal/controller/storage/encryptionscope/zz_controller.go +++ b/internal/controller/storage/encryptionscope/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EncryptionScope // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EncryptionScopeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EncryptionScopeList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EncryptionScope_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/managementpolicy/zz_controller.go b/internal/controller/storage/managementpolicy/zz_controller.go index 0167f3005..bf368f3f5 100755 --- a/internal/controller/storage/managementpolicy/zz_controller.go +++ b/internal/controller/storage/managementpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ManagementPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ManagementPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ManagementPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ManagementPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/objectreplication/zz_controller.go b/internal/controller/storage/objectreplication/zz_controller.go index 3cb1b8eb3..4c5820096 100755 --- a/internal/controller/storage/objectreplication/zz_controller.go +++ b/internal/controller/storage/objectreplication/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ObjectReplication // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ObjectReplicationList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ObjectReplicationList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ObjectReplication_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/queue/zz_controller.go b/internal/controller/storage/queue/zz_controller.go index 1bbc43202..7f81d46fa 100755 --- a/internal/controller/storage/queue/zz_controller.go +++ b/internal/controller/storage/queue/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Queue // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.QueueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.QueueList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/share/zz_controller.go b/internal/controller/storage/share/zz_controller.go index 395c7e967..ab12c266a 100755 --- a/internal/controller/storage/share/zz_controller.go +++ b/internal/controller/storage/share/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Share // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ShareList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ShareList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Share_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/sharedirectory/zz_controller.go b/internal/controller/storage/sharedirectory/zz_controller.go index 108db1296..6f140c868 100755 --- a/internal/controller/storage/sharedirectory/zz_controller.go +++ b/internal/controller/storage/sharedirectory/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ShareDirectory // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ShareDirectoryList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ShareDirectoryList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ShareDirectory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/table/zz_controller.go b/internal/controller/storage/table/zz_controller.go index 3a21ecb86..7c5104e94 100755 --- a/internal/controller/storage/table/zz_controller.go +++ b/internal/controller/storage/table/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Table // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storage/tableentity/zz_controller.go b/internal/controller/storage/tableentity/zz_controller.go index a93541f5d..add3ac5e7 100755 --- a/internal/controller/storage/tableentity/zz_controller.go +++ b/internal/controller/storage/tableentity/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.TableEntity // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TableEntityList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TableEntityList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TableEntity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagecache/hpccache/zz_controller.go b/internal/controller/storagecache/hpccache/zz_controller.go index 9c4d77e05..422c11d1f 100755 --- a/internal/controller/storagecache/hpccache/zz_controller.go +++ b/internal/controller/storagecache/hpccache/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.HPCCache // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.HPCCacheList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.HPCCacheList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.HPCCache_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagecache/hpccacheaccesspolicy/zz_controller.go b/internal/controller/storagecache/hpccacheaccesspolicy/zz_controller.go index acccaae9c..51d4565c5 100755 --- a/internal/controller/storagecache/hpccacheaccesspolicy/zz_controller.go +++ b/internal/controller/storagecache/hpccacheaccesspolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HPCCacheAccessPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HPCCacheAccessPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HPCCacheAccessPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HPCCacheAccessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagecache/hpccacheblobnfstarget/zz_controller.go b/internal/controller/storagecache/hpccacheblobnfstarget/zz_controller.go index b38e829c9..0e5002c56 100755 --- a/internal/controller/storagecache/hpccacheblobnfstarget/zz_controller.go +++ b/internal/controller/storagecache/hpccacheblobnfstarget/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HPCCacheBlobNFSTarget // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HPCCacheBlobNFSTargetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HPCCacheBlobNFSTargetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HPCCacheBlobNFSTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagecache/hpccacheblobtarget/zz_controller.go b/internal/controller/storagecache/hpccacheblobtarget/zz_controller.go index 60d1fa766..47f4dcc3e 100755 --- a/internal/controller/storagecache/hpccacheblobtarget/zz_controller.go +++ b/internal/controller/storagecache/hpccacheblobtarget/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HPCCacheBlobTarget // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HPCCacheBlobTargetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HPCCacheBlobTargetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HPCCacheBlobTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagecache/hpccachenfstarget/zz_controller.go b/internal/controller/storagecache/hpccachenfstarget/zz_controller.go index d9361316c..3e7698738 100755 --- a/internal/controller/storagecache/hpccachenfstarget/zz_controller.go +++ b/internal/controller/storagecache/hpccachenfstarget/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.HPCCacheNFSTarget // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.HPCCacheNFSTargetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.HPCCacheNFSTargetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HPCCacheNFSTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagepool/diskpool/zz_controller.go b/internal/controller/storagepool/diskpool/zz_controller.go index ef06d3160..ea3195bc8 100755 --- a/internal/controller/storagepool/diskpool/zz_controller.go +++ b/internal/controller/storagepool/diskpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.DiskPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.DiskPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.DiskPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DiskPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/storagesync/storagesync/zz_controller.go b/internal/controller/storagesync/storagesync/zz_controller.go index eddf9a6fd..f9c65c250 100755 --- a/internal/controller/storagesync/storagesync/zz_controller.go +++ b/internal/controller/storagesync/storagesync/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.StorageSync // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.StorageSyncList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.StorageSyncList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StorageSync_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/cluster/zz_controller.go b/internal/controller/streamanalytics/cluster/zz_controller.go index 87e4c6ebf..3d0989706 100755 --- a/internal/controller/streamanalytics/cluster/zz_controller.go +++ b/internal/controller/streamanalytics/cluster/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.Cluster // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ClusterList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ClusterList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/functionjavascriptuda/zz_controller.go b/internal/controller/streamanalytics/functionjavascriptuda/zz_controller.go index e7f3e8190..fa27de347 100755 --- a/internal/controller/streamanalytics/functionjavascriptuda/zz_controller.go +++ b/internal/controller/streamanalytics/functionjavascriptuda/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FunctionJavascriptUda // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FunctionJavascriptUdaList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FunctionJavascriptUdaList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FunctionJavascriptUda_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/job/zz_controller.go b/internal/controller/streamanalytics/job/zz_controller.go index 4bd3b96bf..9ba7d337d 100755 --- a/internal/controller/streamanalytics/job/zz_controller.go +++ b/internal/controller/streamanalytics/job/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Job // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.JobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.JobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Job_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/managedprivateendpoint/zz_controller.go b/internal/controller/streamanalytics/managedprivateendpoint/zz_controller.go index 527a349ea..f21822460 100755 --- a/internal/controller/streamanalytics/managedprivateendpoint/zz_controller.go +++ b/internal/controller/streamanalytics/managedprivateendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedPrivateEndpoint // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedPrivateEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedPrivateEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPrivateEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputblob/zz_controller.go b/internal/controller/streamanalytics/outputblob/zz_controller.go index 731b628e5..704e7d9de 100755 --- a/internal/controller/streamanalytics/outputblob/zz_controller.go +++ b/internal/controller/streamanalytics/outputblob/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.OutputBlob // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.OutputBlobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.OutputBlobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.OutputBlob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputeventhub/zz_controller.go b/internal/controller/streamanalytics/outputeventhub/zz_controller.go index 3118d7760..7479c7209 100755 --- a/internal/controller/streamanalytics/outputeventhub/zz_controller.go +++ b/internal/controller/streamanalytics/outputeventhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.OutputEventHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.OutputEventHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.OutputEventHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.OutputEventHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputfunction/zz_controller.go b/internal/controller/streamanalytics/outputfunction/zz_controller.go index 4a833db02..84c7d1156 100755 --- a/internal/controller/streamanalytics/outputfunction/zz_controller.go +++ b/internal/controller/streamanalytics/outputfunction/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OutputFunction // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OutputFunctionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OutputFunctionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OutputFunction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputmssql/zz_controller.go b/internal/controller/streamanalytics/outputmssql/zz_controller.go index db10c00bc..fc75cd13f 100755 --- a/internal/controller/streamanalytics/outputmssql/zz_controller.go +++ b/internal/controller/streamanalytics/outputmssql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OutputMSSQL // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OutputMSSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OutputMSSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OutputMSSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputpowerbi/zz_controller.go b/internal/controller/streamanalytics/outputpowerbi/zz_controller.go index a525edfe5..0a4ff0ba1 100755 --- a/internal/controller/streamanalytics/outputpowerbi/zz_controller.go +++ b/internal/controller/streamanalytics/outputpowerbi/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OutputPowerBI // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OutputPowerBIList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OutputPowerBIList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OutputPowerBI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputservicebusqueue/zz_controller.go b/internal/controller/streamanalytics/outputservicebusqueue/zz_controller.go index 2b0a8fce6..2d170e213 100755 --- a/internal/controller/streamanalytics/outputservicebusqueue/zz_controller.go +++ b/internal/controller/streamanalytics/outputservicebusqueue/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.OutputServiceBusQueue // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.OutputServiceBusQueueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.OutputServiceBusQueueList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.OutputServiceBusQueue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputservicebustopic/zz_controller.go b/internal/controller/streamanalytics/outputservicebustopic/zz_controller.go index 82ffd069a..7ef774934 100755 --- a/internal/controller/streamanalytics/outputservicebustopic/zz_controller.go +++ b/internal/controller/streamanalytics/outputservicebustopic/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.OutputServiceBusTopic // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.OutputServiceBusTopicList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.OutputServiceBusTopicList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.OutputServiceBusTopic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputsynapse/zz_controller.go b/internal/controller/streamanalytics/outputsynapse/zz_controller.go index c5826bc7b..a06e8fde5 100755 --- a/internal/controller/streamanalytics/outputsynapse/zz_controller.go +++ b/internal/controller/streamanalytics/outputsynapse/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OutputSynapse // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OutputSynapseList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OutputSynapseList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OutputSynapse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/outputtable/zz_controller.go b/internal/controller/streamanalytics/outputtable/zz_controller.go index 789a9c0af..8185f2a6e 100755 --- a/internal/controller/streamanalytics/outputtable/zz_controller.go +++ b/internal/controller/streamanalytics/outputtable/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.OutputTable // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.OutputTableList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.OutputTableList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OutputTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/referenceinputblob/zz_controller.go b/internal/controller/streamanalytics/referenceinputblob/zz_controller.go index 12ccab100..83df6d237 100755 --- a/internal/controller/streamanalytics/referenceinputblob/zz_controller.go +++ b/internal/controller/streamanalytics/referenceinputblob/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.ReferenceInputBlob // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.ReferenceInputBlobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.ReferenceInputBlobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.ReferenceInputBlob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/referenceinputmssql/zz_controller.go b/internal/controller/streamanalytics/referenceinputmssql/zz_controller.go index 784266895..df8c39c42 100755 --- a/internal/controller/streamanalytics/referenceinputmssql/zz_controller.go +++ b/internal/controller/streamanalytics/referenceinputmssql/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ReferenceInputMSSQL // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ReferenceInputMSSQLList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ReferenceInputMSSQLList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReferenceInputMSSQL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/streaminputblob/zz_controller.go b/internal/controller/streamanalytics/streaminputblob/zz_controller.go index 7a169a412..b5e16ec51 100755 --- a/internal/controller/streamanalytics/streaminputblob/zz_controller.go +++ b/internal/controller/streamanalytics/streaminputblob/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StreamInputBlob // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StreamInputBlobList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StreamInputBlobList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StreamInputBlob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/streaminputeventhub/zz_controller.go b/internal/controller/streamanalytics/streaminputeventhub/zz_controller.go index 30692ff6a..872a13ef7 100755 --- a/internal/controller/streamanalytics/streaminputeventhub/zz_controller.go +++ b/internal/controller/streamanalytics/streaminputeventhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StreamInputEventHub // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StreamInputEventHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StreamInputEventHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StreamInputEventHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/streamanalytics/streaminputiothub/zz_controller.go b/internal/controller/streamanalytics/streaminputiothub/zz_controller.go index 073343c86..2b60214de 100755 --- a/internal/controller/streamanalytics/streaminputiothub/zz_controller.go +++ b/internal/controller/streamanalytics/streaminputiothub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StreamInputIOTHub // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StreamInputIOTHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StreamInputIOTHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StreamInputIOTHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/firewallrule/zz_controller.go b/internal/controller/synapse/firewallrule/zz_controller.go index 6c022b610..0edbb41dd 100755 --- a/internal/controller/synapse/firewallrule/zz_controller.go +++ b/internal/controller/synapse/firewallrule/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FirewallRule // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FirewallRuleList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FirewallRuleList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/integrationruntimeazure/zz_controller.go b/internal/controller/synapse/integrationruntimeazure/zz_controller.go index 4b242644e..f6dfb38fe 100755 --- a/internal/controller/synapse/integrationruntimeazure/zz_controller.go +++ b/internal/controller/synapse/integrationruntimeazure/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IntegrationRuntimeAzure // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IntegrationRuntimeAzureList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IntegrationRuntimeAzureList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationRuntimeAzure_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/integrationruntimeselfhosted/zz_controller.go b/internal/controller/synapse/integrationruntimeselfhosted/zz_controller.go index 50de98b3d..4cdf99ce0 100755 --- a/internal/controller/synapse/integrationruntimeselfhosted/zz_controller.go +++ b/internal/controller/synapse/integrationruntimeselfhosted/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.IntegrationRuntimeSelfHosted // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.IntegrationRuntimeSelfHostedList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.IntegrationRuntimeSelfHostedList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationRuntimeSelfHosted_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/linkedservice/zz_controller.go b/internal/controller/synapse/linkedservice/zz_controller.go index 95113bd53..f05a97da6 100755 --- a/internal/controller/synapse/linkedservice/zz_controller.go +++ b/internal/controller/synapse/linkedservice/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinkedService // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinkedServiceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinkedServiceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinkedService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/managedprivateendpoint/zz_controller.go b/internal/controller/synapse/managedprivateendpoint/zz_controller.go index a5a87d6ac..05244466b 100755 --- a/internal/controller/synapse/managedprivateendpoint/zz_controller.go +++ b/internal/controller/synapse/managedprivateendpoint/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ManagedPrivateEndpoint // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ManagedPrivateEndpointList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ManagedPrivateEndpointList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPrivateEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/privatelinkhub/zz_controller.go b/internal/controller/synapse/privatelinkhub/zz_controller.go index 2b602b846..056e92341 100755 --- a/internal/controller/synapse/privatelinkhub/zz_controller.go +++ b/internal/controller/synapse/privatelinkhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.PrivateLinkHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.PrivateLinkHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.PrivateLinkHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateLinkHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/roleassignment/zz_controller.go b/internal/controller/synapse/roleassignment/zz_controller.go index 7569b325f..39a3e837f 100755 --- a/internal/controller/synapse/roleassignment/zz_controller.go +++ b/internal/controller/synapse/roleassignment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.RoleAssignment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.RoleAssignmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.RoleAssignmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoleAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sparkpool/zz_controller.go b/internal/controller/synapse/sparkpool/zz_controller.go index 5ddaefc67..bd30a9fe4 100755 --- a/internal/controller/synapse/sparkpool/zz_controller.go +++ b/internal/controller/synapse/sparkpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SparkPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SparkPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SparkPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SparkPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sqlpool/zz_controller.go b/internal/controller/synapse/sqlpool/zz_controller.go index 3491665c8..0db2bba73 100755 --- a/internal/controller/synapse/sqlpool/zz_controller.go +++ b/internal/controller/synapse/sqlpool/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.SQLPool // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.SQLPoolList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.SQLPoolList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.SQLPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sqlpoolextendedauditingpolicy/zz_controller.go b/internal/controller/synapse/sqlpoolextendedauditingpolicy/zz_controller.go index bdf922ce9..f13cce349 100755 --- a/internal/controller/synapse/sqlpoolextendedauditingpolicy/zz_controller.go +++ b/internal/controller/synapse/sqlpoolextendedauditingpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLPoolExtendedAuditingPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLPoolExtendedAuditingPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLPoolExtendedAuditingPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLPoolExtendedAuditingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sqlpoolsecurityalertpolicy/zz_controller.go b/internal/controller/synapse/sqlpoolsecurityalertpolicy/zz_controller.go index 5a7eb2e64..8e8f20985 100755 --- a/internal/controller/synapse/sqlpoolsecurityalertpolicy/zz_controller.go +++ b/internal/controller/synapse/sqlpoolsecurityalertpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLPoolSecurityAlertPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLPoolSecurityAlertPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLPoolSecurityAlertPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLPoolSecurityAlertPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sqlpoolworkloadclassifier/zz_controller.go b/internal/controller/synapse/sqlpoolworkloadclassifier/zz_controller.go index 683b1576f..003611012 100755 --- a/internal/controller/synapse/sqlpoolworkloadclassifier/zz_controller.go +++ b/internal/controller/synapse/sqlpoolworkloadclassifier/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLPoolWorkloadClassifier // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLPoolWorkloadClassifierList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLPoolWorkloadClassifierList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLPoolWorkloadClassifier_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/sqlpoolworkloadgroup/zz_controller.go b/internal/controller/synapse/sqlpoolworkloadgroup/zz_controller.go index 3d4b0d9ab..0aeecf829 100755 --- a/internal/controller/synapse/sqlpoolworkloadgroup/zz_controller.go +++ b/internal/controller/synapse/sqlpoolworkloadgroup/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SQLPoolWorkloadGroup // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SQLPoolWorkloadGroupList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SQLPoolWorkloadGroupList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLPoolWorkloadGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspace/zz_controller.go b/internal/controller/synapse/workspace/zz_controller.go index 05b862eff..007ae8cf3 100755 --- a/internal/controller/synapse/workspace/zz_controller.go +++ b/internal/controller/synapse/workspace/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Workspace // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WorkspaceList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WorkspaceList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspaceaadadmin/zz_controller.go b/internal/controller/synapse/workspaceaadadmin/zz_controller.go index 1fb5f3c85..0c917fe89 100755 --- a/internal/controller/synapse/workspaceaadadmin/zz_controller.go +++ b/internal/controller/synapse/workspaceaadadmin/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceAADAdmin // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceAADAdminList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceAADAdminList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceAADAdmin_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspaceextendedauditingpolicy/zz_controller.go b/internal/controller/synapse/workspaceextendedauditingpolicy/zz_controller.go index ff50e7189..243f65dab 100755 --- a/internal/controller/synapse/workspaceextendedauditingpolicy/zz_controller.go +++ b/internal/controller/synapse/workspaceextendedauditingpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceExtendedAuditingPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceExtendedAuditingPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceExtendedAuditingPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceExtendedAuditingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspacesecurityalertpolicy/zz_controller.go b/internal/controller/synapse/workspacesecurityalertpolicy/zz_controller.go index 4bb031b42..5908c3c9b 100755 --- a/internal/controller/synapse/workspacesecurityalertpolicy/zz_controller.go +++ b/internal/controller/synapse/workspacesecurityalertpolicy/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceSecurityAlertPolicy // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceSecurityAlertPolicyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceSecurityAlertPolicyList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceSecurityAlertPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspacesqlaadadmin/zz_controller.go b/internal/controller/synapse/workspacesqlaadadmin/zz_controller.go index 8d4fde2c9..6a89a7748 100755 --- a/internal/controller/synapse/workspacesqlaadadmin/zz_controller.go +++ b/internal/controller/synapse/workspacesqlaadadmin/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.WorkspaceSQLAADAdmin // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.WorkspaceSQLAADAdminList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.WorkspaceSQLAADAdminList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceSQLAADAdmin_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/synapse/workspacevulnerabilityassessment/zz_controller.go b/internal/controller/synapse/workspacevulnerabilityassessment/zz_controller.go index d2d4dac61..d9e191738 100755 --- a/internal/controller/synapse/workspacevulnerabilityassessment/zz_controller.go +++ b/internal/controller/synapse/workspacevulnerabilityassessment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WorkspaceVulnerabilityAssessment // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WorkspaceVulnerabilityAssessmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WorkspaceVulnerabilityAssessmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WorkspaceVulnerabilityAssessment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timeseriesinsights/eventsourceeventhub/zz_controller.go b/internal/controller/timeseriesinsights/eventsourceeventhub/zz_controller.go index bf5b891c7..09ed8de45 100755 --- a/internal/controller/timeseriesinsights/eventsourceeventhub/zz_controller.go +++ b/internal/controller/timeseriesinsights/eventsourceeventhub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EventSourceEventHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EventSourceEventHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EventSourceEventHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSourceEventHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timeseriesinsights/eventsourceiothub/zz_controller.go b/internal/controller/timeseriesinsights/eventsourceiothub/zz_controller.go index 6e490fb4e..c841e69cd 100755 --- a/internal/controller/timeseriesinsights/eventsourceiothub/zz_controller.go +++ b/internal/controller/timeseriesinsights/eventsourceiothub/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.EventSourceIOTHub // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.EventSourceIOTHubList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.EventSourceIOTHubList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSourceIOTHub_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timeseriesinsights/gen2environment/zz_controller.go b/internal/controller/timeseriesinsights/gen2environment/zz_controller.go index 78b325284..399949fd1 100755 --- a/internal/controller/timeseriesinsights/gen2environment/zz_controller.go +++ b/internal/controller/timeseriesinsights/gen2environment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.Gen2Environment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.Gen2EnvironmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.Gen2EnvironmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.Gen2Environment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timeseriesinsights/referencedataset/zz_controller.go b/internal/controller/timeseriesinsights/referencedataset/zz_controller.go index 884383aec..45975882f 100755 --- a/internal/controller/timeseriesinsights/referencedataset/zz_controller.go +++ b/internal/controller/timeseriesinsights/referencedataset/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ReferenceDataSet // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ReferenceDataSetList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ReferenceDataSetList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReferenceDataSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timeseriesinsights/standardenvironment/zz_controller.go b/internal/controller/timeseriesinsights/standardenvironment/zz_controller.go index 6d7192a29..5cf194a87 100755 --- a/internal/controller/timeseriesinsights/standardenvironment/zz_controller.go +++ b/internal/controller/timeseriesinsights/standardenvironment/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.StandardEnvironment // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.StandardEnvironmentList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.StandardEnvironmentList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StandardEnvironment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/appactiveslot/zz_controller.go b/internal/controller/web/appactiveslot/zz_controller.go index c51c1dc06..8baa5566c 100755 --- a/internal/controller/web/appactiveslot/zz_controller.go +++ b/internal/controller/web/appactiveslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppActiveSlot // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppActiveSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppActiveSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppActiveSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/apphybridconnection/zz_controller.go b/internal/controller/web/apphybridconnection/zz_controller.go index 7ca84c426..f3ffa998f 100755 --- a/internal/controller/web/apphybridconnection/zz_controller.go +++ b/internal/controller/web/apphybridconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.AppHybridConnection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.AppHybridConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.AppHybridConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppHybridConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/appserviceplan/zz_controller.go b/internal/controller/web/appserviceplan/zz_controller.go index b444ebbcf..9b9e3ec29 100755 --- a/internal/controller/web/appserviceplan/zz_controller.go +++ b/internal/controller/web/appserviceplan/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.AppServicePlan // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.AppServicePlanList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.AppServicePlanList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.AppServicePlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/functionapp/zz_controller.go b/internal/controller/web/functionapp/zz_controller.go index 54785787b..f268a9045 100755 --- a/internal/controller/web/functionapp/zz_controller.go +++ b/internal/controller/web/functionapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FunctionApp // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FunctionAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FunctionAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FunctionApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/functionappactiveslot/zz_controller.go b/internal/controller/web/functionappactiveslot/zz_controller.go index db0548860..053330d1c 100755 --- a/internal/controller/web/functionappactiveslot/zz_controller.go +++ b/internal/controller/web/functionappactiveslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FunctionAppActiveSlot // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FunctionAppActiveSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FunctionAppActiveSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FunctionAppActiveSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/functionappfunction/zz_controller.go b/internal/controller/web/functionappfunction/zz_controller.go index 43bad003f..a2a8cceb1 100755 --- a/internal/controller/web/functionappfunction/zz_controller.go +++ b/internal/controller/web/functionappfunction/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FunctionAppFunction // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FunctionAppFunctionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FunctionAppFunctionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FunctionAppFunction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/functionapphybridconnection/zz_controller.go b/internal/controller/web/functionapphybridconnection/zz_controller.go index affe08bde..8dac5da49 100755 --- a/internal/controller/web/functionapphybridconnection/zz_controller.go +++ b/internal/controller/web/functionapphybridconnection/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.FunctionAppHybridConnection // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.FunctionAppHybridConnectionList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.FunctionAppHybridConnectionList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FunctionAppHybridConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/functionappslot/zz_controller.go b/internal/controller/web/functionappslot/zz_controller.go index 5b456c69b..d43ab36b0 100755 --- a/internal/controller/web/functionappslot/zz_controller.go +++ b/internal/controller/web/functionappslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.FunctionAppSlot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.FunctionAppSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.FunctionAppSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.FunctionAppSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/linuxfunctionapp/zz_controller.go b/internal/controller/web/linuxfunctionapp/zz_controller.go index 567b63a0a..56f6069eb 100755 --- a/internal/controller/web/linuxfunctionapp/zz_controller.go +++ b/internal/controller/web/linuxfunctionapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxFunctionApp // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxFunctionAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxFunctionAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxFunctionApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/linuxfunctionappslot/zz_controller.go b/internal/controller/web/linuxfunctionappslot/zz_controller.go index 97c6be182..ff91063f9 100755 --- a/internal/controller/web/linuxfunctionappslot/zz_controller.go +++ b/internal/controller/web/linuxfunctionappslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxFunctionAppSlot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxFunctionAppSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxFunctionAppSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxFunctionAppSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/linuxwebapp/zz_controller.go b/internal/controller/web/linuxwebapp/zz_controller.go index 334f7c85f..f865e64f9 100755 --- a/internal/controller/web/linuxwebapp/zz_controller.go +++ b/internal/controller/web/linuxwebapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxWebApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxWebAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxWebAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxWebApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/linuxwebappslot/zz_controller.go b/internal/controller/web/linuxwebappslot/zz_controller.go index 8f60d031a..7b69bfb75 100755 --- a/internal/controller/web/linuxwebappslot/zz_controller.go +++ b/internal/controller/web/linuxwebappslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.LinuxWebAppSlot // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.LinuxWebAppSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.LinuxWebAppSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.LinuxWebAppSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/serviceplan/zz_controller.go b/internal/controller/web/serviceplan/zz_controller.go index 5b44ac6cd..c32fef297 100755 --- a/internal/controller/web/serviceplan/zz_controller.go +++ b/internal/controller/web/serviceplan/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.ServicePlan // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServicePlanList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServicePlanList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServicePlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/sourcecontroltoken/zz_controller.go b/internal/controller/web/sourcecontroltoken/zz_controller.go index a62de3e7b..c5fe83be9 100755 --- a/internal/controller/web/sourcecontroltoken/zz_controller.go +++ b/internal/controller/web/sourcecontroltoken/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -56,6 +57,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta1.SourceControlToken // if they're enabled. @@ -67,6 +71,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.SourceControlTokenList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.SourceControlTokenList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SourceControlToken_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/staticsite/zz_controller.go b/internal/controller/web/staticsite/zz_controller.go index 8943c994a..6be057d89 100755 --- a/internal/controller/web/staticsite/zz_controller.go +++ b/internal/controller/web/staticsite/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.StaticSite // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.StaticSiteList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.StaticSiteList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.StaticSite_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/windowsfunctionapp/zz_controller.go b/internal/controller/web/windowsfunctionapp/zz_controller.go index bdb0af871..77fd3cc9d 100755 --- a/internal/controller/web/windowsfunctionapp/zz_controller.go +++ b/internal/controller/web/windowsfunctionapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsFunctionApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsFunctionAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsFunctionAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsFunctionApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/windowsfunctionappslot/zz_controller.go b/internal/controller/web/windowsfunctionappslot/zz_controller.go index a7adf4697..9ebd105b3 100755 --- a/internal/controller/web/windowsfunctionappslot/zz_controller.go +++ b/internal/controller/web/windowsfunctionappslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsFunctionAppSlot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsFunctionAppSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsFunctionAppSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsFunctionAppSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/windowswebapp/zz_controller.go b/internal/controller/web/windowswebapp/zz_controller.go index 7617f745f..3b3c7a6d7 100755 --- a/internal/controller/web/windowswebapp/zz_controller.go +++ b/internal/controller/web/windowswebapp/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsWebApp // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsWebAppList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsWebAppList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsWebApp_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/web/windowswebappslot/zz_controller.go b/internal/controller/web/windowswebappslot/zz_controller.go index b70f1b51d..b273a2423 100755 --- a/internal/controller/web/windowswebappslot/zz_controller.go +++ b/internal/controller/web/windowswebappslot/zz_controller.go @@ -14,6 +14,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" @@ -57,6 +58,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } // register webhooks for the kind v1beta2.WindowsWebAppSlot // if they're enabled. @@ -68,6 +72,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { } } + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta2.WindowsWebAppSlotList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta2.WindowsWebAppSlotList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta2.WindowsWebAppSlot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr).