File tree Expand file tree Collapse file tree 10 files changed +271
-0
lines changed Expand file tree Collapse file tree 10 files changed +271
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ cue_export(
2828 "//k8s/amour/cilium:cue_cilium_library" ,
2929 "//k8s/amour/dcgm_exporter:cue_dcgm_exporter_library" ,
3030 "//k8s/amour/emqx:cue_emqx_library" ,
31+ "//k8s/amour/emqx_exporter:cue_emqx_exporter_library" ,
3132 "//k8s/amour/external_secrets:cue_external_secrets_library" ,
3233 "//k8s/amour/frigate:cue_frigate_library" ,
3334 "//k8s/amour/grafana:cue_grafana_library" ,
Original file line number Diff line number Diff line change 1+ load ("@com_github_tnarg_rules_cue//cue:cue.bzl" , "cue_library" )
2+
3+ cue_library (
4+ name = "cue_emqx_exporter_library" ,
5+ srcs = [
6+ "deployment_list.cue" ,
7+ "external_secret_list.cue" ,
8+ "list.cue" ,
9+ "namespace_list.cue" ,
10+ "service_list.cue" ,
11+ "vm_service_scrape_list.cue" ,
12+ ],
13+ importpath = "github.com/uhthomas/automata/k8s/amour/emqx_exporter" ,
14+ visibility = ["//visibility:public" ],
15+ deps = [
16+ "//cue.mod/gen/github.com/VictoriaMetrics/operator/api/victoriametrics/v1beta1:cue_v1beta1_library" ,
17+ "//cue.mod/gen/github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1:cue_v1beta1_library" ,
18+ "//cue.mod/gen/k8s.io/api/apps/v1:cue_v1_library" ,
19+ "//cue.mod/gen/k8s.io/api/core/v1:cue_v1_library" ,
20+ ],
21+ )
Original file line number Diff line number Diff line change 1+ # EMQX Exporter
2+
3+ [ https://github.com/emqx/emqx-exporter ] ( https://github.com/emqx/emqx-exporter )
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import (
4+ appsv1 " k8s.io/api/apps/v1 "
5+ " k8s.io/api/core/v1 "
6+ )
7+
8+ #DeploymentList : appsv1 .#DeploymentList & {
9+ apiVersion : " apps/v1 "
10+ kind : " DeploymentList "
11+ items : [...{
12+ apiVersion : " apps/v1 "
13+ kind : " Deployment "
14+ }]
15+ }
16+
17+ #DeploymentList : items : [{
18+ spec : {
19+ selector : matchLabels : " app.kubernetes.io/name " : #Name
20+ template : {
21+ metadata : labels : " app.kubernetes.io/name " : #Name
22+ spec : {
23+ volumes : [{
24+ name : " config "
25+ secret : secretName : #Name
26+ }]
27+ containers : [{
28+ name : " emqx-exporter "
29+ image : " emqx/emqx-exporter:\(#Version ) "
30+ args : [" --config.file=/etc/emqx-exporter/config.yaml " ]
31+ ports : [{
32+ name : " http-metrics "
33+ containerPort : 8085
34+ }]
35+ resources : requests : {
36+ (v1 .#ResourceCPU ): " 100m "
37+ (v1 .#ResourceMemory ): " 256Mi "
38+ }
39+ volumeMounts : [{
40+ name : " config "
41+ mountPath : " /etc/emqx-exporter/config.yaml "
42+ subPath : " config.yaml "
43+ }]
44+
45+ let probe = {httpGet : port : " http-metrics " }
46+
47+ livenessProbe : probe
48+ readinessProbe : probe
49+
50+ imagePullPolicy : v1 .#PullIfNotPresent
51+ securityContext : {
52+ capabilities : drop : [" ALL " ]
53+ readOnlyRootFilesystem : true
54+ allowPrivilegeEscalation : false
55+ }
56+ }]
57+ securityContext : {
58+ runAsUser : 1000
59+ runAsGroup : 3000
60+ runAsNonRoot : true
61+ fsGroup : 2000
62+ seccompProfile : type : v1 .#SeccompProfileTypeRuntimeDefault
63+ }
64+ }
65+ }
66+ }
67+ }]
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import (
4+ " encoding/yaml "
5+
6+ externalsecretsv1beta1 " github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1 "
7+ )
8+
9+ #ExternalSecretList : externalsecretsv1beta1 .#ExternalSecretList & {
10+ apiVersion : " external-secrets.io/v1beta1 "
11+ kind : " ExternalSecretList "
12+ items : [...{
13+ apiVersion : " external-secrets.io/v1beta1 "
14+ kind : " ExternalSecret "
15+ }]
16+ }
17+
18+ #ExternalSecretList : items : [{
19+ spec : {
20+ secretStoreRef : {
21+ name : " onepassword "
22+ kind : " ClusterSecretStore "
23+ }
24+ target : template : {
25+ engineVersion : " v2 "
26+ metadata : {
27+ annotations : {}
28+ labels : {}
29+ }
30+ data : " config.yaml " : yaml .Marshal ({
31+ metrics : {
32+ target : " emqx.emqx "
33+ api_key : " {{ .key }} "
34+ api_secret : " {{ .secret }} "
35+ }
36+ probes : [{target : " emqx.emqx:1883 " }]
37+ })
38+ }
39+ data : [{
40+ secretKey : " key "
41+ remoteRef : {
42+ key : " emqx-exporter "
43+ property : " api key "
44+ }
45+ }, {
46+ secretKey : " secret "
47+ remoteRef : {
48+ key : " emqx-exporter "
49+ property : " api secret key "
50+ }
51+ }]
52+ }
53+ }]
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import (
4+ " list "
5+
6+ " k8s.io/api/core/v1 "
7+ )
8+
9+ #Name : " emqx-exporter "
10+ #Namespace : #Name
11+
12+ // renovate: datasource=github-releases depName=emqx/emqx-exporter
13+ #Version : " 0.2.7 "
14+
15+ #List : v1 .#List & {
16+ apiVersion : " v1 "
17+ kind : " List "
18+ items : [...{
19+ metadata : {
20+ name : #Name
21+ namespace : #Namespace
22+ labels : {
23+ " app.kubernetes.io/name " : #Name
24+ " app.kubernetes.io/version " : #Version
25+ }
26+ }
27+ }]
28+ }
29+
30+ #List : items : list .Concat (_items )
31+
32+ _items : [
33+ #ExternalSecretList .items ,
34+ #DeploymentList .items ,
35+ #NamespaceList .items ,
36+ #ServiceList .items ,
37+ #VMServiceScrapeList .items ,
38+ ]
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import " k8s.io/api/core/v1 "
4+
5+ #NamespaceList : v1 .#NamespaceList & {
6+ apiVersion : " v1 "
7+ kind : " NamespaceList "
8+ items : [...{
9+ apiVersion : " v1 "
10+ kind : " Namespace "
11+ }]
12+ }
13+
14+ #NamespaceList : items : [{}]
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import " k8s.io/api/core/v1 "
4+
5+ #ServiceList : v1 .#ServiceList & {
6+ apiVersion : " v1 "
7+ kind : " ServiceList "
8+ items : [...{
9+ apiVersion : " v1 "
10+ kind : " Service "
11+ }]
12+ }
13+
14+ #ServiceList : items : [{
15+ spec : {
16+ ports : [{
17+ name : " http-metrics "
18+ port : 80
19+ targetPort : " http-metrics "
20+ }]
21+ selector : " app.kubernetes.io/name " : #Name
22+ }
23+ }]
Original file line number Diff line number Diff line change 1+ package emqx_exporter
2+
3+ import victoriametricsv1beta1 " github.com/VictoriaMetrics/operator/api/victoriametrics/v1beta1 "
4+
5+ #VMServiceScrapeList : victoriametricsv1beta1 .#VMServiceScrapeList & {
6+ apiVersion : " operator.victoriametrics.com/v1beta1 "
7+ kind : " VMServiceScrapeList "
8+ items : [...{
9+ apiVersion : " operator.victoriametrics.com/v1beta1 "
10+ kind : " VMServiceScrape "
11+ }]
12+ }
13+
14+ let sharedRelabelConfigs = [{
15+ action : " replace "
16+ // user-defined cluster name, requires unique
17+ replacement : " emqx "
18+ targetLabel : " cluster "
19+ }, {
20+ action : " replace "
21+ // fix value, don't modify
22+ replacement : " exporter "
23+ targetLabel : " from "
24+ }, {
25+ action : " replace "
26+ // fix value, don't modify
27+ sourceLabels : [" pod " ]
28+ regex : " (.*)-.*-.* "
29+ replacement : " $1 "
30+ targetLabel : " instance "
31+ }, {
32+ action : " labeldrop "
33+ // fix value, don't modify
34+ regex : " pod "
35+ }]
36+
37+ #VMServiceScrapeList : items : [{
38+ spec : {
39+ endpoints : [{
40+ port : " http-metrics "
41+ relabelConfigs : sharedRelabelConfigs
42+ }, {
43+ port : " http-metrics "
44+ path : " /probe "
45+ relabelConfigs : sharedRelabelConfigs
46+ }]
47+ selector : matchLabels : " app.kubernetes.io/name " : #Name
48+ }
49+ }]
Original file line number Diff line number Diff line change 88 " github.com/uhthomas/automata/k8s/amour/cilium "
99 " github.com/uhthomas/automata/k8s/amour/dcgm_exporter "
1010 " github.com/uhthomas/automata/k8s/amour/emqx "
11+ " github.com/uhthomas/automata/k8s/amour/emqx_exporter "
1112 " github.com/uhthomas/automata/k8s/amour/external_secrets "
1213 " github.com/uhthomas/automata/k8s/amour/frigate "
1314 " github.com/uhthomas/automata/k8s/amour/grafana "
@@ -69,6 +70,7 @@ _items: [
6970 cilium .#List .items ,
7071 dcgm_exporter .#List .items ,
7172 emqx .#List .items ,
73+ emqx_exporter .#List .items ,
7274 external_secrets .#List .items ,
7375 frigate .#List .items ,
7476 grafana .#List .items ,
You can’t perform that action at this time.
0 commit comments