diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index eb68533bb..0306a78c7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,7 +12,6 @@ on: - 'config/' env: DOCKER_FILE_PATH: Dockerfile - GOLANG_VERSION: 1.21 HELM_VERSION: v3.8.2 REGISTRY: ghcr.io @@ -30,12 +29,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GOLANG_VERSION }} + go-version-file: go.mod - name: Lint uses: golangci/golangci-lint-action@v6 with: - version: v1.54 + version: v1.64 only-new-issues: false args: --timeout 10m diff --git a/.github/workflows/pull_request_test.yaml b/.github/workflows/pull_request_test.yaml index ce142aec1..60d44e6ce 100644 --- a/.github/workflows/pull_request_test.yaml +++ b/.github/workflows/pull_request_test.yaml @@ -14,7 +14,6 @@ on: env: KIND_VERSION: "v0.25.0" - GOLANG_VERSION: 1.21 jobs: @@ -37,7 +36,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GOLANG_VERSION }} + go-version-file: go.mod - name: Install kind uses: engineerd/setup-kind@v0.5.0 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9ee249008..a30d39e19 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,7 +14,6 @@ on: env: DOCKER_FILE_PATH: Dockerfile BUNDLE_DOCKER_FILE_PATH: bundle.Dockerfile - GOLANG_VERSION: 1.22 OPERATOR_SDK_VERSION: "1.39.2" KUSTOMIZE_VERSION: "5.4.3" KUBERNETES_VERSION: "1.23.5" @@ -39,12 +38,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GOLANG_VERSION }} + go-version-file: go.mod - name: Lint uses: golangci/golangci-lint-action@v6 with: - version: v1.54 + version: v1.64 only-new-issues: false args: --timeout 10m diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5154b60b..c4883bd57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,9 +5,6 @@ on: tags: - "v*" -env: - GOLANG_VERSION: 1.21 - jobs: build: name: GoReleaser build @@ -22,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GOLANG_VERSION }} + go-version-file: go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@master diff --git a/Dockerfile b/Dockerfile index 6dfef494a..2fc5cc68b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.22 AS builder +FROM golang:1.24 AS builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/Makefile b/Makefile index 187791df7..18a52d0cb 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ IMG ?= stakater/ingressmonitorcontroller:v2.2.4 # GOLANGCI_LINT env GOLANGCI_LINT = _output/tools/golangci-lint GOLANGCI_LINT_CACHE = $(PWD)/_output/golangci-lint-cache -GOLANGCI_LINT_VERSION = v1.39.0 +GOLANGCI_LINT_VERSION = v1.64.0 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -216,7 +216,7 @@ rm -f $(1) || true ;\ GOBIN=$(LOCALBIN) go install $${package} ;\ mv $(1) $(1)-$(3) ;\ } ;\ -ln -sf $(1)-$(3) $(1) +ln -sf $(1)-$(3) $(1) endef .PHONY: bundle diff --git a/charts/ingressmonitorcontroller/README.md b/charts/ingressmonitorcontroller/README.md index eaf7e972c..e668ee17e 100644 --- a/charts/ingressmonitorcontroller/README.md +++ b/charts/ingressmonitorcontroller/README.md @@ -23,7 +23,7 @@ helm install stakater/ingressmonitorcontroller ## Chart Values | Key | Default | Description | -| ---------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------- | +|------------------------------|---------------------------------------|------------------------------------------------------------------------------------------------| | global.labels | `` | Labels to be added to all components | | replicaCount | `1` | Replicas for operator | | image.name | `"stakater/ingressmonitorcontroller"` | Image repository | @@ -44,6 +44,7 @@ helm install stakater/ingressmonitorcontroller | serviceAccount.annotations | `{}` | Additional annotations on ServiceAccount | | serviceMonitor.enabled | `false` | Create ServiceMonitor for metrics | | podAnnotations | `""` | Additional annotations on deployment | +| podLabels | `{}` | Additional labels for the Pod template | | resources | `{}` | Requests/Limits for operator | | securityContext | `{}` | Override for SecurityContext | | podSecurityContext | `{}` | Override for deployment.Spec.securityContext | diff --git a/charts/ingressmonitorcontroller/templates/deployment.yaml b/charts/ingressmonitorcontroller/templates/deployment.yaml index d9ce991db..e2cbe146b 100644 --- a/charts/ingressmonitorcontroller/templates/deployment.yaml +++ b/charts/ingressmonitorcontroller/templates/deployment.yaml @@ -22,6 +22,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8}} + {{- end }} {{- include "ingress-monitor-controller.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} @@ -69,7 +72,7 @@ spec: resources: {{- toYaml .Values.resources | nindent 10 }} securityContext: - {{- toYaml .Values.securityContext | nindent 10 }} + {{- toYaml .Values.securityContext | nindent 10 }} terminationGracePeriodSeconds: 10 {{- with .Values.nodeSelector }} nodeSelector: @@ -83,4 +86,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} ---- \ No newline at end of file +--- diff --git a/charts/ingressmonitorcontroller/values.yaml b/charts/ingressmonitorcontroller/values.yaml index 7dfab37d6..a0eadcaf2 100644 --- a/charts/ingressmonitorcontroller/values.yaml +++ b/charts/ingressmonitorcontroller/values.yaml @@ -60,6 +60,8 @@ resources: deploymentAnnotations: {} +podLabels: {} + podAnnotations: {} podSecurityContext: diff --git a/docs/appinsights-configuration.md b/docs/appinsights-configuration.md index ebe3fc2a3..4a1c1876c 100644 --- a/docs/appinsights-configuration.md +++ b/docs/appinsights-configuration.md @@ -7,11 +7,30 @@ You can configure Application Insights as a Ingress Monitor by using below confi | name | Name of the provider (e.g. AppInsights) | | appInsightsConfig | `appInsightsConfig` is the configuration specific to Appinsights Instance as mentioned below: | +## Authentication + +The AppInsights monitor uses [azure-sdk-for-go](https://github.com/Azure/azure-sdk-for-go) to authenticate and communicate to the Azure API. + +> The [DefaultAzureCredential](https://learn.microsoft.com/en-us/azure/developer/go/sdk/authentication/credential-chains#defaultazurecredential-overview) is an opinionated, preconfigured chain of credentials. +> It's designed to support many environments, along with the most common authentication flows and developer tools. In graphical form, the underlying chain looks like this: + +It will automatically configure authentication in the following order, stopping when it finds a hit: + +* Environment Variables +* Workload Identity +* Managed Identity +* Azure CLI +* Azure Developer CLI + +Refer to the [DefaultAzureCredential documentation](https://learn.microsoft.com/en-us/azure/developer/go/sdk/authentication/credential-chains#defaultazurecredential-overview) for more details. + + ## Appinsights Configuration: | Key | Description | -| ------------------------ | -------------------------------------------------------------------------------------------------------------- | +|--------------------------|----------------------------------------------------------------------------------------------------------------| | name | Name of the Appinsights Instance | +| subscriptionId | The Azure Subscription ID | | resourceGroup | Resource group of Appinsights | | location | The location of the resource group. | | geoLocation | Location ID for the webtest to run from. For example: `["us-tx-sn1-azr", "us-il-ch1-azr"]` | @@ -33,8 +52,9 @@ You can configure Application Insights as a Ingress Monitor by using below confi providers: - name: AppInsights appInsightsConfig: - name: demo-appinsights - resourceGroup: demoRG + name: "demo-appinsighs" + subscriptionId: "12345678-1234-1234-1234-123456789012" + resourceGroup: "demoRG" location: "westeurope" geoLocation: [ @@ -47,7 +67,7 @@ providers: send_to_service_owners: false custom_emails: ["mail@cizer.dev"] webhookAction: - service_uri: http://myalert-webhook.io + service_uri: "http://myalert-webhook.io" enableMonitorDeletion: true ``` diff --git a/go.mod b/go.mod index 92bc7306c..865468407 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,25 @@ module github.com/stakater/IngressMonitorController/v2 -go 1.22.0 +go 1.24.0 require ( cloud.google.com/go/monitoring v1.16.3 - github.com/Azure/azure-sdk-for-go v44.0.0+incompatible - github.com/Azure/go-autorest/autorest/azure/auth v0.5.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0 github.com/StatusCakeDev/statuscake-go v1.3.0 github.com/antoineaugusti/updown v0.0.0-20190412074625-d590ab97f115 github.com/go-logr/logr v1.4.2 + github.com/google/go-cmp v0.6.0 github.com/grafana/synthetic-monitoring-agent v0.19.4 github.com/grafana/synthetic-monitoring-api-go-client v0.8.0 github.com/karlderkaefer/pingdom-golang-client v1.0.4 - github.com/kelseyhightower/envconfig v1.4.0 github.com/openshift/api v0.0.0-20200526144822-34f54f12813a github.com/patrickmn/go-cache v2.1.0+incompatible github.com/russellcardullo/go-pingdom v1.3.0 github.com/stakater/operator-utils v0.1.13 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 golang.org/x/time v0.3.0 google.golang.org/api v0.149.0 google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 @@ -31,15 +33,8 @@ require ( require ( cloud.google.com/go/compute/metadata v0.5.0 // indirect - github.com/Azure/go-autorest v14.2.0+incompatible // indirect - github.com/Azure/go-autorest/autorest v0.11.18 // indirect - github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect - github.com/Azure/go-autorest/autorest/azure/cli v0.4.0 // indirect - github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect - github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect - github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect - github.com/Azure/go-autorest/logger v0.2.1 // indirect - github.com/Azure/go-autorest/tracing v0.6.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -47,7 +42,6 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dimchansky/utfbom v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect @@ -60,12 +54,11 @@ require ( github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/cel-go v0.20.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect @@ -76,11 +69,12 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect @@ -102,14 +96,14 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.31.0 // indirect + golang.org/x/crypto v0.38.0 // indirect golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect - golang.org/x/net v0.33.0 // indirect + golang.org/x/net v0.40.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/term v0.32.0 // indirect + golang.org/x/text v0.25.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect diff --git a/go.sum b/go.sum index 96f80d860..cd6b0eae5 100644 --- a/go.sum +++ b/go.sum @@ -26,38 +26,36 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v44.0.0+incompatible h1:e82Yv2HNpS0kuyeCrV29OPKvEiqfs2/uJHic3/3iKdg= -github.com/Azure/azure-sdk-for-go v44.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 h1:Gt0j3wceWMwPmiazCa8MzMA0MfhmPIz0Qp0FJ6qcM0U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0/go.mod h1:Ot/6aikWnKWi4l9QB7qVSwa8iMphQNqkWALMoNT3rzM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 h1:B+blDbyVIG3WaikNxPnhPiJ1MThR03b3vKGtER95TP4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 h1:FPKJS1T+clwv+OLGt13a8UjqeRuh0O4SJ3lUriThc+4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1/go.mod h1:j2chePtV91HrC22tGoRX3sGY42uF13WzmmV80/OdVAA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.2.0 h1:7FX6sHNPamIAyukt6w9Gw5Qa5bu+gVN2Iy70yHc0xns= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.2.0/go.mod h1:S7Ss6Rm0nlKDRHKrO9eL2Be5EnX29Z09CNPWgK7o4+I= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0 h1:Ds0KRF8ggpEGg4Vo42oX1cIt/IfOhHWJBikksZbVxeg= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0/go.mod h1:jj6P8ybImR+5topJ+eH6fgcemSFBmU6/6bFF8KkwuDI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.0/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest v0.11.18 h1:90Y4srNYrwOtAgVo3ndrQkTYn6kf1Eg/AjTFJ8Is2aM= -github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= -github.com/Azure/go-autorest/autorest/adal v0.9.24 h1:BHZfgGsGwdkHDyZdtQRQk1WeUdW0m2WPAwuHZwUi5i4= -github.com/Azure/go-autorest/autorest/adal v0.9.24/go.mod h1:7T1+g0PYFmACYW5LlG2fcoPiPlFHjClyRGL7dRlP5c8= -github.com/Azure/go-autorest/autorest/azure/auth v0.5.0 h1:nSMjYIe24eBYasAIxt859TxyXef/IqoH+8/g4+LmcVs= -github.com/Azure/go-autorest/autorest/azure/auth v0.5.0/go.mod h1:QRTvSZQpxqm8mSErhnbI+tANIBAKP7B+UIE2z4ypUO0= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.0 h1:Ml+UCrnlKD+cJmSzrZ/RDcDw86NjkRUpnFh7V5JUhzU= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.0/go.mod h1:JljT387FplPzBA31vUcvsetLKF3pec5bdAxjVU4kI2s= -github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk= -github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= -github.com/Azure/go-autorest/autorest/validation v0.3.0 h1:3I9AAI63HfcLtphd9g39ruUwRI+Ca+z/f36KHPFRUss= -github.com/Azure/go-autorest/autorest/validation v0.3.0/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= -github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= +github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -121,9 +119,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -200,9 +198,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= -github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= +github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -339,8 +336,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/karlderkaefer/pingdom-golang-client v1.0.4 h1:tBLJ5Id3thyEor9D5zl7VZen5P8EI13/6izrjhvniH4= github.com/karlderkaefer/pingdom-golang-client v1.0.4/go.mod h1:Q01dHklWfM8O8V8ln80ix4nqlxburepAsdmoIHJt7hg= -github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= -github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= +github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU= +github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -358,6 +355,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -374,7 +373,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -420,6 +418,8 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -455,6 +455,8 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/redis/go-redis/v9 v9.8.0 h1:q3nRvjrlge/6UD7eTu/DSg2uYiU2mCL0G/uzBWqhicI= +github.com/redis/go-redis/v9 v9.8.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= @@ -504,9 +506,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -516,7 +517,6 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -568,10 +568,8 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -604,8 +602,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -637,12 +633,8 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -657,10 +649,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -699,22 +689,11 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -722,12 +701,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -781,8 +756,6 @@ golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/config/config.go b/pkg/config/config.go index e2da6ca48..46a8b4e79 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -5,8 +5,8 @@ import ( "strconv" "time" - util "github.com/stakater/operator-utils/util" - yaml "gopkg.in/yaml.v2" + "github.com/stakater/operator-utils/util" + "gopkg.in/yaml.v2" logf "sigs.k8s.io/controller-runtime/pkg/log" "github.com/stakater/IngressMonitorController/v2/pkg/secret" @@ -74,13 +74,14 @@ type Provider struct { } type AppInsights struct { - Name string `yaml:"name"` - Location string `yaml:"location"` - ResourceGroup string `yaml:"resourceGroup"` - Frequency int32 `yaml:"frequency"` - GeoLocation []interface{} `yaml:"geoLocation"` - EmailAction EmailAction `yaml:"emailAction"` - WebhookAction WebhookAction `yaml:"webhookAction"` + Name string `yaml:"name"` + SubscriptionId string `yaml:"subscriptionId"` + Location string `yaml:"location"` + ResourceGroup string `yaml:"resourceGroup"` + Frequency int32 `yaml:"frequency"` + GeoLocation []interface{} `yaml:"geoLocation"` + EmailAction EmailAction `yaml:"emailAction"` + WebhookAction WebhookAction `yaml:"webhookAction"` } type Gcloud struct { @@ -92,8 +93,8 @@ type Grafana struct { } type EmailAction struct { - SendToServiceOwners bool `yaml:"send_to_service_owners"` - CustomEmails []string `yaml:"custom_emails"` + SendToServiceOwners bool `yaml:"send_to_service_owners"` + CustomEmails []*string `yaml:"custom_emails"` } type WebhookAction struct { diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 9bf9f3958..eb6dad4c5 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -1,6 +1,7 @@ package config import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "reflect" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -113,7 +114,7 @@ func TestConfigWithAppinsights(t *testing.T) { ResourceGroup: "demoRG", EmailAction: EmailAction{ SendToServiceOwners: false, - CustomEmails: []string{"mail@cizer.dev"}, + CustomEmails: []*string{to.Ptr("mail@cizer.dev")}, }, WebhookAction: WebhookAction{ ServiceURI: "https://webhook.io", diff --git a/pkg/kube/wrappers/ingress-wrapper.go b/pkg/kube/wrappers/ingress-wrapper.go index 9a5f37e6e..153b3c7ad 100644 --- a/pkg/kube/wrappers/ingress-wrapper.go +++ b/pkg/kube/wrappers/ingress-wrapper.go @@ -27,7 +27,7 @@ func NewIngressWrapper(ingress *v1.Ingress, client client.Client) *IngressWrappe } func (iw *IngressWrapper) supportsTLS() bool { - if iw.Ingress.Spec.TLS != nil && len(iw.Ingress.Spec.TLS) > 0 && iw.Ingress.Spec.TLS[0].Hosts != nil && len(iw.Ingress.Spec.TLS[0].Hosts) > 0 && len(iw.Ingress.Spec.TLS[0].Hosts[0]) > 0 { + if len(iw.Ingress.Spec.TLS) > 0 && len(iw.Ingress.Spec.TLS[0].Hosts) > 0 && len(iw.Ingress.Spec.TLS[0].Hosts[0]) > 0 { return true } return false @@ -50,16 +50,13 @@ func (iw *IngressWrapper) getHost() string { } func (iw *IngressWrapper) rulesExist() bool { - if iw.Ingress.Spec.Rules != nil && len(iw.Ingress.Spec.Rules) > 0 { - return true - } - return false + return len(iw.Ingress.Spec.Rules) > 0 } func (iw *IngressWrapper) getIngressSubPath() string { rule := iw.Ingress.Spec.Rules[0] if rule.HTTP != nil { - if rule.HTTP.Paths != nil && len(rule.HTTP.Paths) > 0 { + if len(rule.HTTP.Paths) > 0 { path := rule.HTTP.Paths[0].Path // Remove * from path if exists diff --git a/pkg/monitors/appinsights/appinsights-monitor.go b/pkg/monitors/appinsights/appinsights-monitor.go index fdc66df22..32a253ce5 100644 --- a/pkg/monitors/appinsights/appinsights-monitor.go +++ b/pkg/monitors/appinsights/appinsights-monitor.go @@ -4,14 +4,19 @@ package appinsights import ( "context" "encoding/xml" + "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" "net/http" "os" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" - insightsAlert "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" - "github.com/Azure/go-autorest/autorest/azure/auth" - "github.com/kelseyhightower/envconfig" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/stakater/IngressMonitorController/v2/pkg/config" "github.com/stakater/IngressMonitorController/v2/pkg/models" logf "sigs.k8s.io/controller-runtime/pkg/log" @@ -35,27 +40,19 @@ type Configuration struct { // AppinsightsMonitorService struct contains parameters required by appinsights go client type AppinsightsMonitorService struct { - insightsClient insights.WebTestsClient - alertrulesClient insightsAlert.AlertRulesClient + insightsClient *armapplicationinsights.WebTestsClient + alertrulesClient *armmonitor.AlertRulesClient name string location string resourceGroup string geoLocation []interface{} - emailAction []string + emailAction []*string webhookAction string emailToOwners bool subscriptionID string ctx context.Context } -// AzureConfig holds service principle credentials required of auth -type AzureConfig struct { - Subscription_ID string - Client_ID string - Client_Secret string - Tenant_ID string -} - type WebTest struct { XMLName xml.Name `xml:"WebTest"` Xmlns string `xml:"xmlns,attr"` @@ -106,13 +103,6 @@ func (aiService *AppinsightsMonitorService) Setup(provider config.Provider) { log.Info("AppInsights Monitor's Setup has been called. Initializing AppInsights Client..") - var azConfig AzureConfig - err := envconfig.Process("AZURE", &azConfig) - if err != nil { - log.Error(err, "Error fetching environment variable") - os.Exit(1) - } - aiService.ctx = context.Background() aiService.name = provider.AppInsightsConfig.Name aiService.location = provider.AppInsightsConfig.Location @@ -121,25 +111,34 @@ func (aiService *AppinsightsMonitorService) Setup(provider config.Provider) { aiService.emailAction = provider.AppInsightsConfig.EmailAction.CustomEmails aiService.emailToOwners = provider.AppInsightsConfig.EmailAction.SendToServiceOwners aiService.webhookAction = provider.AppInsightsConfig.WebhookAction.ServiceURI - aiService.subscriptionID = azConfig.Subscription_ID - - // Generate clientConfig based on Azure Credentials (Service Principle) - clientConfig := auth.NewClientCredentialsConfig(azConfig.Client_ID, azConfig.Client_Secret, azConfig.Tenant_ID) - - // initialize appinsights client - err = aiService.insightsClient.AddToUserAgent("appInsightsMonitor") - if err != nil { - log.Error(err, "Error adding UserAgent in AppInsights Client") - os.Exit(1) + aiService.subscriptionID = provider.AppInsightsConfig.SubscriptionId + + // For backward compatibility when subscriptionID was supplied via environment variable + if aiService.subscriptionID == "" { + if sid := os.Getenv("AZURE_SUBSCRIPTION_ID"); sid != "" { + aiService.subscriptionID = sid + } else { + log.Error(nil, "Error fetching environment variable") + os.Exit(1) + } } - aiService.insightsClient = insights.NewWebTestsClient(azConfig.Subscription_ID) + creds, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Error(err, "Error initializing AppInsights Client") os.Exit(1) } - aiService.insightsClient.Authorizer, err = clientConfig.Authorizer() + clientOptions := &arm.ClientOptions{ + ClientOptions: policy.ClientOptions{ + Telemetry: policy.TelemetryOptions{ + ApplicationID: "appInsightsMonitor", + }, + }, + } + + aiService.insightsClient, err = armapplicationinsights.NewWebTestsClient(aiService.subscriptionID, creds, clientOptions) + if err != nil { log.Error(err, "Error initializing AppInsights Client") os.Exit(1) @@ -149,8 +148,7 @@ func (aiService *AppinsightsMonitorService) Setup(provider config.Provider) { // initialize monitoring alertrule client only if Email Action or Webhook Action is specified. if aiService.isAlertEnabled() { - aiService.alertrulesClient = insightsAlert.NewAlertRulesClient(azConfig.Subscription_ID) - aiService.alertrulesClient.Authorizer, err = clientConfig.Authorizer() + aiService.alertrulesClient, err = armmonitor.NewAlertRulesClient(aiService.subscriptionID, creds, clientOptions) if err != nil { log.Error(err, "Error initializing AppInsights Alertrules Client") os.Exit(1) @@ -169,23 +167,22 @@ func (aiService *AppinsightsMonitorService) GetAll() []models.Monitor { var monitors []models.Monitor - webtests, err := aiService.insightsClient.ListByComponent(aiService.ctx, aiService.name, aiService.resourceGroup) - if err != nil { - if webtests.Response().StatusCode == http.StatusNotFound { + pager := aiService.insightsClient.NewListByComponentPager(aiService.name, aiService.resourceGroup, nil) + for pager.More() { + page, err := pager.NextPage(aiService.ctx) + if err != nil { return monitors } - return monitors - } - for _, webtest := range webtests.Values() { - newMonitor := models.Monitor{ - Name: *webtest.Name, - URL: getURL(*webtest.Configuration.WebTest), - ID: *webtest.ID, + for _, wt := range page.Value { + m := models.Monitor{ + Name: *wt.Name, + ID: *wt.ID, + URL: getURL(*wt.Properties.Configuration.WebTest), + } + monitors = append(monitors, m) } - monitors = append(monitors, newMonitor) } - return monitors } @@ -195,16 +192,18 @@ func (aiService *AppinsightsMonitorService) GetAll() []models.Monitor { func (aiService *AppinsightsMonitorService) GetByName(monitorName string) (*models.Monitor, error) { log.Info("AppInsights Monitor's GetByName method has been called") - webtest, err := aiService.insightsClient.Get(aiService.ctx, aiService.resourceGroup, monitorName) + webtest, err := aiService.insightsClient.Get(aiService.ctx, aiService.resourceGroup, monitorName, nil) if err != nil { - if webtest.Response.StatusCode == http.StatusNotFound { - return nil, fmt.Errorf("Application Insights WebTest %s was not found in Resource Group %s", monitorName, aiService.resourceGroup) + if re, ok := err.(*azcore.ResponseError); ok { + if re.StatusCode == http.StatusNotFound { + return nil, fmt.Errorf("Application Insights WebTest %s was not found in Resource Group %s", monitorName, aiService.resourceGroup) + } } return nil, fmt.Errorf("Error retrieving Application Insights WebTests %s (Resource Group %s): %v", monitorName, aiService.resourceGroup, err) } return &models.Monitor{ Name: *webtest.Name, - URL: getURL(*webtest.Configuration.WebTest), + URL: getURL(*webtest.Properties.Configuration.WebTest), ID: *webtest.ID, }, nil @@ -216,7 +215,7 @@ func (aiService *AppinsightsMonitorService) Add(monitor models.Monitor) { log.Info("AppInsights Monitor's Add method has been called") log.Info(fmt.Sprintf("Adding Application Insights WebTest '%s' from '%s'", monitor.Name, aiService.name)) webtest := aiService.createWebTest(monitor) - _, err := aiService.insightsClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, monitor.Name, webtest) + _, err := aiService.insightsClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, monitor.Name, webtest, nil) if err != nil { log.Error(err, fmt.Sprintf("Error adding Application Insights WebTests %s (Resource Group %s): %v", monitor.Name, aiService.resourceGroup, err)) } else { @@ -225,7 +224,7 @@ func (aiService *AppinsightsMonitorService) Add(monitor models.Monitor) { log.Info(fmt.Sprintf("Adding alert rule for WebTest '%s' from '%s'", monitor.Name, aiService.name)) alertName := fmt.Sprintf("%s-alert", monitor.Name) webtestAlert := aiService.createAlertRuleResource(monitor) - _, err := aiService.alertrulesClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, alertName, webtestAlert) + _, err := aiService.alertrulesClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, alertName, webtestAlert, nil) if err != nil { log.Error(err, fmt.Sprintf("Error adding alert rule for WebTests %s (Resource Group %s): %v", monitor.Name, aiService.resourceGroup, err)) } @@ -242,7 +241,7 @@ func (aiService *AppinsightsMonitorService) Update(monitor models.Monitor) { log.Info(fmt.Sprintf("Updating Application Insights WebTest '%s' from '%s'", monitor.Name, aiService.name)) webtest := aiService.createWebTest(monitor) - _, err := aiService.insightsClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, monitor.Name, webtest) + _, err := aiService.insightsClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, monitor.Name, webtest, nil) if err != nil { log.Error(err, fmt.Sprintf("Error updating Application Insights WebTests %s (Resource Group %s): %v", monitor.Name, aiService.resourceGroup, err)) } else { @@ -251,7 +250,7 @@ func (aiService *AppinsightsMonitorService) Update(monitor models.Monitor) { log.Info(fmt.Sprintf("Updating alert rule for WebTest '%s' from '%s'", monitor.Name, aiService.name)) alertName := fmt.Sprintf("%s-alert", monitor.Name) webtestAlert := aiService.createAlertRuleResource(monitor) - _, err := aiService.alertrulesClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, alertName, webtestAlert) + _, err := aiService.alertrulesClient.CreateOrUpdate(aiService.ctx, aiService.resourceGroup, alertName, webtestAlert, nil) if err != nil { log.Error(err, fmt.Sprintf("Error updating alert rule for WebTests %s (Resource Group %s): %v", monitor.Name, aiService.resourceGroup, err)) } @@ -265,10 +264,13 @@ func (aiService *AppinsightsMonitorService) Remove(monitor models.Monitor) { log.Info("AppInsights Monitor's Remove method has been called") log.Info(fmt.Sprintf("Deleting Application Insights WebTest '%s' from '%s'", monitor.Name, aiService.name)) - r, err := aiService.insightsClient.Delete(aiService.ctx, aiService.resourceGroup, monitor.Name) + _, err := aiService.insightsClient.Delete(aiService.ctx, aiService.resourceGroup, monitor.Name, nil) if err != nil { - if r.Response.StatusCode == http.StatusNotFound { - log.Error(err, fmt.Sprintf("Application Insights WebTest %s was not found in Resource Group %s", monitor.Name, aiService.resourceGroup)) + var re *azcore.ResponseError + if errors.As(err, &re) { + if re.StatusCode == http.StatusNotFound { + log.Error(err, fmt.Sprintf("Application Insights WebTest %s was not found in Resource Group %s", monitor.Name, aiService.resourceGroup)) + } } log.Error(err, fmt.Sprintf("Error deleting Application Insights WebTests %s (Resource Group %s): %v", monitor.Name, aiService.resourceGroup, err)) } else { @@ -276,10 +278,13 @@ func (aiService *AppinsightsMonitorService) Remove(monitor models.Monitor) { if aiService.isAlertEnabled() { log.Info(fmt.Sprintf("Deleting alert rule for WebTest '%s' from '%s'", monitor.Name, aiService.name)) alertName := fmt.Sprintf("%s-alert", monitor.Name) - r, err := aiService.alertrulesClient.Delete(aiService.ctx, aiService.resourceGroup, alertName) + _, err := aiService.alertrulesClient.Delete(aiService.ctx, aiService.resourceGroup, alertName, nil) if err != nil { - if r.Response.StatusCode == http.StatusNotFound { - log.Error(err, fmt.Sprintf("WebTest Alert rule %s was not found in Resource Group %s", alertName, aiService.resourceGroup)) + var re *azcore.ResponseError + if errors.As(err, &re) { + if re.StatusCode == http.StatusNotFound { + log.Error(err, fmt.Sprintf("WebTest Alert rule %s was not found in Resource Group %s", alertName, aiService.resourceGroup)) + } } log.Error(err, fmt.Sprintf("Error deleting alert rule for WebTests %s (Resource Group %s): %v", alertName, aiService.resourceGroup, err)) } @@ -289,7 +294,7 @@ func (aiService *AppinsightsMonitorService) Remove(monitor models.Monitor) { } // createWebTest forms xml configuration for Appinsights WebTest -func (aiService *AppinsightsMonitorService) createWebTest(monitor models.Monitor) insights.WebTest { +func (aiService *AppinsightsMonitorService) createWebTest(monitor models.Monitor) armapplicationinsights.WebTest { isEnabled := true webtest := NewWebTest() @@ -304,19 +309,20 @@ func (aiService *AppinsightsMonitorService) createWebTest(monitor models.Monitor log.Error(err, "Error encoding XML WebTest Configuration") } webtestConfig := string(xmlByte) - return insights.WebTest{ + pingKind := armapplicationinsights.WebTestKindPing + return armapplicationinsights.WebTest{ Name: &monitor.Name, Location: &aiService.location, - Kind: insights.Ping, // forcing type of webtest to 'ping',this could be as replace with provider configuration - WebTestProperties: &insights.WebTestProperties{ + Kind: &pingKind, // forcing type of webtest to 'ping',this could be as replace with provider configuration + Properties: &armapplicationinsights.WebTestProperties{ SyntheticMonitorID: &monitor.Name, WebTestName: &monitor.Name, - WebTestKind: insights.Ping, + WebTestKind: &pingKind, RetryEnabled: &configs.isRetryEnabled, Enabled: &isEnabled, Frequency: &configs.frequency, Locations: getGeoLocation(aiService.geoLocation), - Configuration: &insights.WebTestPropertiesConfiguration{ + Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ WebTest: &webtestConfig, }, }, @@ -326,7 +332,7 @@ func (aiService *AppinsightsMonitorService) createWebTest(monitor models.Monitor } // createWebTestAlert forms xml configuration for Appinsights WebTest -func (aiService *AppinsightsMonitorService) createAlertRuleResource(monitor models.Monitor) insightsAlert.AlertRuleResource { +func (aiService *AppinsightsMonitorService) createAlertRuleResource(monitor models.Monitor) armmonitor.AlertRuleResource { isEnabled := aiService.isAlertEnabled() failedLocationCount := int32(1) @@ -335,43 +341,44 @@ func (aiService *AppinsightsMonitorService) createAlertRuleResource(monitor mode description := fmt.Sprintf("%s alert is created using Ingress Monitor Controller", alertName) resourceUri := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/microsoft.insights/webtests/%s", aiService.subscriptionID, aiService.resourceGroup, monitor.Name) - actions := make([]insightsAlert.BasicRuleAction, 0, 2) + actions := make([]armmonitor.RuleActionClassification, 0, 2) if len(aiService.emailAction) > 0 { - actions = append(actions, insightsAlert.RuleEmailAction{ + actions = append(actions, &armmonitor.RuleEmailAction{ SendToServiceOwners: &aiService.emailToOwners, - CustomEmails: &(aiService.emailAction), + CustomEmails: aiService.emailAction, }) } if aiService.webhookAction != "" { - actions = append(actions, insightsAlert.RuleWebhookAction{ + actions = append(actions, &armmonitor.RuleWebhookAction{ ServiceURI: &aiService.webhookAction, }) } - alertRule := insightsAlert.AlertRule{ + alertRule := armmonitor.AlertRule{ Name: &alertName, IsEnabled: &isEnabled, Description: &description, - Condition: &insightsAlert.LocationThresholdRuleCondition{ - DataSource: insightsAlert.RuleMetricDataSource{ + Condition: &armmonitor.LocationThresholdRuleCondition{ + DataSource: &armmonitor.RuleMetricDataSource{ ResourceURI: &resourceUri, - OdataType: insightsAlert.OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, + ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), MetricName: &alertName, }, FailedLocationCount: &failedLocationCount, WindowSize: &period, - OdataType: insightsAlert.OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, + ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition"), }, - Actions: &actions, + Actions: actions, } - return insightsAlert.AlertRuleResource{ - Name: &monitor.Name, - Location: &aiService.location, - AlertRule: &alertRule, - ID: &resourceUri, - Tags: aiService.getTags("alert", monitor.Name), + return armmonitor.AlertRuleResource{ + Location: &aiService.location, + Properties: &alertRule, + Tags: aiService.getTags("alert", monitor.Name), + ID: &resourceUri, + Name: &monitor.Name, } + } diff --git a/pkg/monitors/appinsights/appinsights-monitor_test.go b/pkg/monitors/appinsights/appinsights-monitor_test.go index e6078e6d5..17a22d4f4 100644 --- a/pkg/monitors/appinsights/appinsights-monitor_test.go +++ b/pkg/monitors/appinsights/appinsights-monitor_test.go @@ -4,11 +4,12 @@ package appinsights import ( "context" "fmt" - "reflect" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "github.com/google/go-cmp/cmp" "testing" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" - insightsAlert "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1" "github.com/stakater/IngressMonitorController/v2/pkg/models" ctrl "sigs.k8s.io/controller-runtime" @@ -37,13 +38,13 @@ func TestAppinsightsMonitorService_createWebTest(t *testing.T) { webTestConfig := "" type fields struct { - insightsClient insights.WebTestsClient - alertrulesClient insightsAlert.AlertRulesClient + insightsClient *armapplicationinsights.WebTestsClient + alertrulesClient *armmonitor.AlertRulesClient name string location string resourceGroup string geoLocation []interface{} - emailAction []string + emailAction []*string webhookAction string emailToOwners bool subscriptionID string @@ -56,7 +57,7 @@ func TestAppinsightsMonitorService_createWebTest(t *testing.T) { name string fields fields args args - want insights.WebTest + want armapplicationinsights.WebTest }{ { name: webtestName, @@ -67,7 +68,7 @@ func TestAppinsightsMonitorService_createWebTest(t *testing.T) { subscriptionID: "99cb99da-9cf9-9999-9999-9eacc5d36a65", resourceGroup: resourceGroup, geoLocation: []interface{}{geoLocation}, - emailAction: []string{"mail@cizer.dev"}, + emailAction: []*string{to.Ptr("mail@cizer.dev")}, webhookAction: "https://webhook.io", ctx: context.Background(), }, @@ -83,21 +84,21 @@ func TestAppinsightsMonitorService_createWebTest(t *testing.T) { ID: "", }, }, - want: insights.WebTest{ + want: armapplicationinsights.WebTest{ Name: &webtestName, Location: &location, - Kind: insights.Ping, // forcing type of webtest to 'ping',this could be as replace with provider configuration - WebTestProperties: &insights.WebTestProperties{ + Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // forcing type of webtest to 'ping',this could be as replace with provider configuration + Properties: &armapplicationinsights.WebTestProperties{ SyntheticMonitorID: &webtestName, WebTestName: &webtestName, - WebTestKind: insights.Ping, + WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), RetryEnabled: &isRetryEnabled, Enabled: &isEnabled, Frequency: &frequency, - Locations: &[]insights.WebTestGeolocation{ + Locations: []*armapplicationinsights.WebTestGeolocation{ {Location: &geoLocation}, }, - Configuration: &insights.WebTestPropertiesConfiguration{ + Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ WebTest: &webTestConfig, }, }, @@ -120,8 +121,8 @@ func TestAppinsightsMonitorService_createWebTest(t *testing.T) { subscriptionID: tt.fields.subscriptionID, ctx: tt.fields.ctx, } - if got := aiService.createWebTest(tt.args.monitor); !reflect.DeepEqual(got, tt.want) { - t.Errorf("AppinsightsMonitorService.createWebTest() = %v, want %v", got, tt.want) + if got := aiService.createWebTest(tt.args.monitor); !cmp.Equal(got, tt.want) { + t.Errorf("AppinsightsMonitorService.createWebTest() = %v", cmp.Diff(got, tt.want)) } }) } @@ -139,7 +140,7 @@ func TestAppinsightsMonitorService_createAlertRuleResource(t *testing.T) { geoLocation := []interface{}{"us-tx-sn1-azr"} isEnabled := true subID := "99cb99da-9cf9-9999-9999-9eacc5d36a65" - emailAction := []string{"mail@cizer.dev"} + emailAction := []*string{to.Ptr("mail@cizer.dev")} webhookAction := "https://webhook.io" emailToOwners := false description := fmt.Sprintf("%s-alert alert is created using Ingress Monitor Controller", webtestName) @@ -149,24 +150,24 @@ func TestAppinsightsMonitorService_createAlertRuleResource(t *testing.T) { tag["hidden-link:/subscriptions/99cb99da-9cf9-9999-9999-9eacc5d36a65/resourceGroups/demoRG/providers/microsoft.insights/components/foo-appinsights"] = &tagValue tag["hidden-link:/subscriptions/99cb99da-9cf9-9999-9999-9eacc5d36a65/resourceGroups/demoRG/providers/microsoft.insights/webtests/foo"] = &tagValue - actions := []insightsAlert.BasicRuleAction{ - insightsAlert.RuleEmailAction{ + actions := []armmonitor.RuleActionClassification{ + &armmonitor.RuleEmailAction{ SendToServiceOwners: &emailToOwners, - CustomEmails: &(emailAction), + CustomEmails: emailAction, }, - insightsAlert.RuleWebhookAction{ + &armmonitor.RuleWebhookAction{ ServiceURI: &webhookAction, }, } type fields struct { - insightsClient insights.WebTestsClient - alertrulesClient insightsAlert.AlertRulesClient + insightsClient *armapplicationinsights.WebTestsClient + alertrulesClient *armmonitor.AlertRulesClient name string location string resourceGroup string geoLocation []interface{} - emailAction []string + emailAction []*string webhookAction string emailToOwners bool subscriptionID string @@ -179,7 +180,7 @@ func TestAppinsightsMonitorService_createAlertRuleResource(t *testing.T) { name string fields fields args args - want insightsAlert.AlertRuleResource + want armmonitor.AlertRuleResource }{ { name: webtestName, @@ -206,25 +207,25 @@ func TestAppinsightsMonitorService_createAlertRuleResource(t *testing.T) { ID: "", }, }, - want: insightsAlert.AlertRuleResource{ + want: armmonitor.AlertRuleResource{ Name: &webtestName, Location: &location, ID: &resourceUri, - AlertRule: &insightsAlert.AlertRule{ + Properties: &armmonitor.AlertRule{ Name: &alertName, IsEnabled: &isEnabled, Description: &description, - Condition: &insightsAlert.LocationThresholdRuleCondition{ - DataSource: insightsAlert.RuleMetricDataSource{ + Condition: &armmonitor.LocationThresholdRuleCondition{ + DataSource: &armmonitor.RuleMetricDataSource{ ResourceURI: &resourceUri, - OdataType: insightsAlert.OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, + ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), MetricName: &alertName, }, FailedLocationCount: &failedLocationCount, WindowSize: &period, - OdataType: insightsAlert.OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, + ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition"), }, - Actions: &actions, + Actions: actions, }, Tags: tag, }, @@ -245,10 +246,8 @@ func TestAppinsightsMonitorService_createAlertRuleResource(t *testing.T) { subscriptionID: tt.fields.subscriptionID, ctx: tt.fields.ctx, } - if got := aiService.createAlertRuleResource(tt.args.monitor); !reflect.DeepEqual(got, tt.want) { - t.Errorf("%+v", got) - t.Errorf("%+v", tt.want) - t.Errorf("AppinsightsMonitorService.createAlertRuleResource() = %v, want %v", got, tt.want) + if got := aiService.createAlertRuleResource(tt.args.monitor); !cmp.Equal(got, tt.want) { + t.Errorf("AppinsightsMonitorService.createAlertRuleResource() = %s", cmp.Diff(got, tt.want)) } }) } diff --git a/pkg/monitors/appinsights/util.go b/pkg/monitors/appinsights/util.go index e8021cd0e..de1540d61 100644 --- a/pkg/monitors/appinsights/util.go +++ b/pkg/monitors/appinsights/util.go @@ -3,8 +3,8 @@ package appinsights import ( "encoding/xml" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1" "github.com/stakater/IngressMonitorController/v2/pkg/models" ) @@ -49,15 +49,15 @@ func getURL(rawXmlData string) string { } // getGeolocation converts slice of locations into slice of location struct -func getGeoLocation(locations []interface{}) *[]insights.WebTestGeolocation { - var geoLocations []insights.WebTestGeolocation +func getGeoLocation(locations []interface{}) []*armapplicationinsights.WebTestGeolocation { + var geoLocations []*armapplicationinsights.WebTestGeolocation for _, v := range locations { l := v.(string) - geoLocations = append(geoLocations, insights.WebTestGeolocation{ + geoLocations = append(geoLocations, &armapplicationinsights.WebTestGeolocation{ Location: &l, }) } - return &geoLocations + return geoLocations } // getConfiguration fetch values from config and return object of Configuration diff --git a/pkg/monitors/uptimerobot/uptime-status-page.go b/pkg/monitors/uptimerobot/uptime-status-page.go index 7c7b6a99e..7542b981f 100644 --- a/pkg/monitors/uptimerobot/uptime-status-page.go +++ b/pkg/monitors/uptimerobot/uptime-status-page.go @@ -163,7 +163,7 @@ func (statusPageService *UpTimeStatusPageService) RemoveMonitorFromStatusPage(st body := "api_key=" + statusPageService.apiKey + "&format=json&id=" + statusPage.ID - if existingStatusPage.Monitors != nil && len(existingStatusPage.Monitors) > 0 { + if len(existingStatusPage.Monitors) > 0 { monitors := strings.Join(existingStatusPage.Monitors, "-") body += "&monitors=" + monitors } else {