Skip to content

Commit 93120d6

Browse files
authored
Merge pull request #543 from stakater/thunef/grafana-cloud
Add support for Grafana Cloud
2 parents c6bdb8d + 705923a commit 93120d6

File tree

15 files changed

+636
-165
lines changed

15 files changed

+636
-165
lines changed

Makefile

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,37 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
141141
$(KUSTOMIZE) build config/default | kubectl delete -f - --ignore-not-found=$(ignore-not-found)
142142

143143

144-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
145-
controller-gen: ## Download controller-gen locally if necessary.
146-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
147-
148-
KUSTOMIZE = $(shell pwd)/bin/kustomize
149-
kustomize: ## Download kustomize locally if necessary.
150-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
151-
152-
# go-get-tool will 'go get' any package $2 and install it to $1.
153-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
154-
define go-get-tool
155-
@[ -f $(1) ] || { \
156-
set -e ;\
157-
TMP_DIR=$$(mktemp -d) ;\
158-
cd $$TMP_DIR ;\
159-
go mod init tmp ;\
160-
echo "Downloading $(2)" ;\
161-
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
162-
rm -rf $$TMP_DIR ;\
163-
}
164-
endef
144+
##@ Build Dependencies
145+
146+
## Location to install dependencies to
147+
LOCALBIN ?= $(shell pwd)/bin
148+
$(LOCALBIN):
149+
mkdir -p $(LOCALBIN)
150+
151+
## Tool Binaries
152+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
153+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
154+
ENVTEST ?= $(LOCALBIN)/setup-envtest
155+
156+
## Tool Versions
157+
KUSTOMIZE_VERSION ?= v3.8.7
158+
CONTROLLER_TOOLS_VERSION ?= v0.9.0
159+
160+
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
161+
.PHONY: kustomize
162+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
163+
$(KUSTOMIZE): $(LOCALBIN)
164+
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
165+
166+
.PHONY: controller-gen
167+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
168+
$(CONTROLLER_GEN): $(LOCALBIN)
169+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
170+
171+
.PHONY: envtest
172+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
173+
$(ENVTEST): $(LOCALBIN)
174+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
165175

166176
.PHONY: bundle
167177
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
@@ -187,7 +197,7 @@ ifeq (,$(shell which opm 2>/dev/null))
187197
set -e ;\
188198
mkdir -p $(dir $(OPM)) ;\
189199
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
190-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\
200+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.1/$${OS}-$${ARCH}-opm ;\
191201
chmod +x $(OPM) ;\
192202
}
193203
else

api/v1alpha1/endpointmonitor_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ type EndpointMonitorSpec struct {
6767
// Configuration for Google Cloud Monitor Provider
6868
// +optional
6969
GCloudConfig *GCloudConfig `json:"gcloudConfig,omitempty"`
70+
71+
// Configuration for Grafana Cloud Monitor Provider
72+
// +optional
73+
GrafanaConfig *GrafanaConfig `json:"grafanaConfig,omitempty"`
7074
}
7175

7276
// UptimeRobotConfig defines the configuration for UptimeRobot Monitor Provider
@@ -300,6 +304,11 @@ type GCloudConfig struct {
300304
ProjectId string `json:"projectId,omitempty"`
301305
}
302306

307+
// GrafnaConfiguration defines the configuration for Grafana Cloud Monitor Provider
308+
type GrafanaConfig struct {
309+
TenantId int64 `json:"tenantId,omitempty"`
310+
}
311+
303312
// URLSource represents the set of resources to fetch the URL from
304313
type URLSource struct {
305314
// +optional

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/endpointmonitor.stakater.com_endpointmonitors.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.8.0
6+
controller-gen.kubebuilder.io/version: v0.9.0
77
creationTimestamp: null
88
name: endpointmonitors.endpointmonitor.stakater.com
99
spec:
@@ -60,6 +60,13 @@ spec:
6060
description: Google Cloud Project ID
6161
type: string
6262
type: object
63+
grafanaConfig:
64+
description: Configuration for Grafana Cloud Monitor Provider
65+
properties:
66+
TenantId:
67+
format: int64
68+
type: integer
69+
type: object
6370
healthEndpoint:
6471
type: string
6572
pingdomConfig:
@@ -286,9 +293,3 @@ spec:
286293
storage: true
287294
subresources:
288295
status: {}
289-
status:
290-
acceptedNames:
291-
kind: ""
292-
plural: ""
293-
conditions: []
294-
storedVersions: []
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
providers:
2+
- name: Grafana
3+
apiKey: <ACCESS TOKEN>
4+
apiURL: https://synthetic-monitoring-api-eu-north-0.grafana.net
5+
grafanaConfig:
6+
frequency: 5000
7+
enableMonitorDeletion: true

go.mod

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
module github.com/stakater/IngressMonitorController/v2
22

3-
go 1.18
3+
go 1.21
4+
5+
toolchain go1.21.2
46

57
require (
6-
cloud.google.com/go v0.81.0
8+
cloud.google.com/go/monitoring v1.15.1
79
github.com/Azure/azure-sdk-for-go v44.0.0+incompatible
810
github.com/Azure/go-autorest/autorest/azure/auth v0.5.0
911
github.com/StatusCakeDev/statuscake-go v1.3.0
1012
github.com/antoineaugusti/updown v0.0.0-20190412074625-d590ab97f115
1113
github.com/go-logr/logr v1.2.0
14+
github.com/grafana/synthetic-monitoring-agent v0.18.2
15+
github.com/grafana/synthetic-monitoring-api-go-client v0.7.0
1216
github.com/kelseyhightower/envconfig v1.4.0
1317
github.com/openshift/api v0.0.0-20200526144822-34f54f12813a
1418
github.com/patrickmn/go-cache v2.1.0+incompatible
1519
github.com/russellcardullo/go-pingdom v1.3.0
1620
github.com/stakater/operator-utils v0.1.13
17-
github.com/stretchr/testify v1.7.0
18-
google.golang.org/api v0.44.0
19-
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2
21+
github.com/stretchr/testify v1.8.4
22+
google.golang.org/api v0.126.0
23+
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98
2024
gopkg.in/yaml.v2 v2.4.0
2125
gotest.tools v2.2.0+incompatible
22-
k8s.io/api v0.23.5
23-
k8s.io/apimachinery v0.23.5
24-
k8s.io/client-go v0.23.5
25-
sigs.k8s.io/controller-runtime v0.11.2
26+
k8s.io/api v0.24.0
27+
k8s.io/apimachinery v0.24.0
28+
k8s.io/client-go v0.24.0
29+
sigs.k8s.io/controller-runtime v0.12.1
2630
)
2731

2832
require (
33+
cloud.google.com/go/compute v1.21.0 // indirect
34+
cloud.google.com/go/compute/metadata v0.2.3 // indirect
2935
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
3036
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
3137
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
@@ -35,58 +41,72 @@ require (
3541
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
3642
github.com/Azure/go-autorest/logger v0.2.1 // indirect
3743
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
44+
github.com/PuerkitoBio/purell v1.1.1 // indirect
45+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
3846
github.com/beorn7/perks v1.0.1 // indirect
39-
github.com/cespare/xxhash/v2 v2.1.1 // indirect
47+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4048
github.com/davecgh/go-spew v1.1.1 // indirect
4149
github.com/dimchansky/utfbom v1.1.0 // indirect
50+
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
4251
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
4352
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
4453
github.com/fsnotify/fsnotify v1.5.1 // indirect
4554
github.com/go-logr/zapr v1.2.0 // indirect
55+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
56+
github.com/go-openapi/jsonreference v0.19.5 // indirect
57+
github.com/go-openapi/swag v0.19.14 // indirect
4658
github.com/gogo/protobuf v1.3.2 // indirect
4759
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
48-
github.com/golang/protobuf v1.5.2 // indirect
49-
github.com/google/go-cmp v0.5.5 // indirect
60+
github.com/golang/protobuf v1.5.3 // indirect
61+
github.com/google/gnostic v0.5.7-v3refs // indirect
62+
github.com/google/go-cmp v0.5.9 // indirect
5063
github.com/google/gofuzz v1.1.0 // indirect
51-
github.com/google/uuid v1.1.2 // indirect
52-
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
53-
github.com/googleapis/gnostic v0.5.5 // indirect
64+
github.com/google/s2a-go v0.1.4 // indirect
65+
github.com/google/uuid v1.3.1 // indirect
66+
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
67+
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
5468
github.com/imdario/mergo v0.3.12 // indirect
69+
github.com/josharian/intern v1.0.0 // indirect
5570
github.com/json-iterator/go v1.1.12 // indirect
56-
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
71+
github.com/mailru/easyjson v0.7.6 // indirect
72+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
5773
github.com/mitchellh/go-homedir v1.1.0 // indirect
5874
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5975
github.com/modern-go/reflect2 v1.0.2 // indirect
76+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6077
github.com/pkg/errors v0.9.1 // indirect
6178
github.com/pmezard/go-difflib v1.0.0 // indirect
62-
github.com/prometheus/client_golang v1.11.1 // indirect
63-
github.com/prometheus/client_model v0.2.0 // indirect
64-
github.com/prometheus/common v0.28.0 // indirect
65-
github.com/prometheus/procfs v0.6.0 // indirect
79+
github.com/prometheus/client_golang v1.16.0 // indirect
80+
github.com/prometheus/client_model v0.4.0 // indirect
81+
github.com/prometheus/common v0.44.0 // indirect
82+
github.com/prometheus/procfs v0.10.1 // indirect
6683
github.com/spf13/pflag v1.0.5 // indirect
67-
go.opencensus.io v0.23.0 // indirect
68-
go.uber.org/atomic v1.7.0 // indirect
84+
go.opencensus.io v0.24.0 // indirect
85+
go.uber.org/atomic v1.10.0 // indirect
6986
go.uber.org/multierr v1.6.0 // indirect
7087
go.uber.org/zap v1.19.1 // indirect
71-
golang.org/x/crypto v0.13.0 // indirect
72-
golang.org/x/net v0.10.0 // indirect
73-
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
74-
golang.org/x/sys v0.12.0 // indirect
75-
golang.org/x/term v0.12.0 // indirect
88+
golang.org/x/crypto v0.14.0 // indirect
89+
golang.org/x/net v0.16.0 // indirect
90+
golang.org/x/oauth2 v0.10.0 // indirect
91+
golang.org/x/sync v0.4.0 // indirect
92+
golang.org/x/sys v0.13.0 // indirect
93+
golang.org/x/term v0.13.0 // indirect
7694
golang.org/x/text v0.13.0 // indirect
77-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
95+
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
7896
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
7997
google.golang.org/appengine v1.6.7 // indirect
80-
google.golang.org/grpc v1.40.0 // indirect
81-
google.golang.org/protobuf v1.27.1 // indirect
98+
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
99+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
100+
google.golang.org/grpc v1.58.2 // indirect
101+
google.golang.org/protobuf v1.31.0 // indirect
82102
gopkg.in/inf.v0 v0.9.1 // indirect
83103
gopkg.in/yaml.v3 v3.0.1 // indirect
84-
k8s.io/apiextensions-apiserver v0.23.5 // indirect
85-
k8s.io/component-base v0.23.5 // indirect
86-
k8s.io/klog/v2 v2.30.0 // indirect
87-
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
88-
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
89-
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
104+
k8s.io/apiextensions-apiserver v0.24.0 // indirect
105+
k8s.io/component-base v0.24.0 // indirect
106+
k8s.io/klog/v2 v2.60.1 // indirect
107+
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
108+
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
109+
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
90110
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
91111
sigs.k8s.io/yaml v1.3.0 // indirect
92112
)

0 commit comments

Comments
 (0)