-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test showing how to use extraConfig and statsd #1057
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: grafana | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1 | ||
kind: HelmRepository | ||
metadata: | ||
name: grafana | ||
namespace: grafana | ||
spec: | ||
interval: 1m | ||
url: https://grafana.github.io/helm-charts | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2 | ||
kind: HelmRelease | ||
metadata: | ||
name: grafana | ||
namespace: grafana | ||
spec: | ||
interval: 1m | ||
chart: | ||
spec: | ||
chart: grafana | ||
sourceRef: | ||
kind: HelmRepository | ||
name: grafana | ||
namespace: grafana | ||
interval: 1m | ||
values: | ||
datasources: | ||
datasources.yaml: | ||
apiVersion: 1 | ||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
url: http://prometheus-server.prometheus.svc:9090 | ||
isDefault: true | ||
basicAuth: true | ||
basicAuthUser: promuser | ||
jsonData: | ||
tlsSkipVerify: true | ||
secureJsonData: | ||
basicAuthPassword: prometheuspassword | ||
|
||
- name: Loki | ||
type: loki | ||
url: http://loki-gateway.loki.svc:8080 | ||
basicAuth: true | ||
basicAuthUser: loki | ||
jsonData: | ||
httpHeaderName1: X-Scope-OrgID | ||
secureJsonData: | ||
basicAuthPassword: lokipassword | ||
httpHeaderValue1: "1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: prometheus | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1 | ||
kind: HelmRepository | ||
metadata: | ||
name: prometheus-community | ||
namespace: prometheus | ||
spec: | ||
interval: 1m | ||
url: https://prometheus-community.github.io/helm-charts | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2 | ||
kind: HelmRelease | ||
metadata: | ||
name: prometheus | ||
namespace: prometheus | ||
spec: | ||
interval: 1m | ||
chart: | ||
spec: | ||
chart: prometheus | ||
version: "^25" | ||
sourceRef: | ||
kind: HelmRepository | ||
name: prometheus-community | ||
namespace: prometheus | ||
interval: 1m | ||
values: | ||
server: | ||
extraFlags: | ||
- enable-feature=otlp-write-receiver | ||
- enable-feature=remote-write-receiver | ||
|
||
persistentVolume: | ||
enabled: false | ||
|
||
probeHeaders: | ||
- name: "Authorization" | ||
value: "Basic cHJvbXVzZXI6cHJvbWV0aGV1c3Bhc3N3b3Jk" | ||
|
||
service: | ||
servicePort: 9090 | ||
|
||
serverFiles: | ||
prometheus.yml: | ||
scrape_configs: [] | ||
web.yml: | ||
basic_auth_users: | ||
promuser: $2a$12$1UJsAG4QnhjjDzqcSVkZmeDxxjgIFOAmzfuVTybTuhhDnYgfuAbAq # "prometheuspassword" | ||
|
||
configmapReload: | ||
prometheus: | ||
enabled: false | ||
|
||
alertmanager: | ||
enabled: false | ||
|
||
kube-state-metrics: | ||
enabled: false | ||
|
||
prometheus-node-exporter: | ||
enabled: false | ||
|
||
prometheus-pushgateway: | ||
enabled: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1 | ||
kind: GitRepository | ||
metadata: | ||
name: k8s-monitoring-test | ||
spec: | ||
interval: 1m | ||
url: https://github.com/grafana/k8s-monitoring-helm | ||
ref: | ||
branch: hackathon-2024-12-cluster-o-nimbus | ||
ignore: | | ||
/* | ||
!/charts/k8s-monitoring-test | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2 | ||
kind: HelmRelease | ||
metadata: | ||
name: k8s-monitoring-test | ||
spec: | ||
interval: 1m | ||
chart: | ||
spec: | ||
chart: charts/k8s-monitoring-test | ||
sourceRef: | ||
kind: GitRepository | ||
name: k8s-monitoring-test | ||
interval: 1m | ||
values: | ||
tests: | ||
- env: | ||
CLUSTER: statsd-test | ||
PROMETHEUS_URL: http://prometheus-server.prometheus.svc:9090/api/v1/query | ||
PROMETHEUS_USER: promuser | ||
PROMETHEUS_PASS: prometheuspassword | ||
queries: | ||
- query: example_gauge{cluster="$CLUSTER", job="integrations/statsd"} | ||
type: promql | ||
expect: | ||
operator: == | ||
value: 42 | ||
- query: statsd_exporter_build_info{cluster="$CLUSTER", job="integrations/statsd"} | ||
type: promql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: statsd-example | ||
data: | ||
statsd-example.js: | | ||
function sleep(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
|
||
Check failure on line 11 in charts/k8s-monitoring/tests/integration/statsd/deployments/statsd-example.yaml
|
||
async function main() { | ||
console.log('Starting statsd example'); | ||
const StatsD = require('node-statsd'); | ||
const client = new StatsD({ | ||
host: 'k8smon-alloy-receiver.default.svc', | ||
port: 8125, | ||
}); | ||
|
||
Check failure on line 19 in charts/k8s-monitoring/tests/integration/statsd/deployments/statsd-example.yaml
|
||
while (true) { | ||
console.log('Sending metric'); | ||
client.gauge('example.gauge', 42, function(error, bytes) { | ||
if (error) { | ||
console.error('Failed to send metric:', error); | ||
} else { | ||
console.log('Successfully sent', bytes, 'bytes'); | ||
} | ||
}); | ||
await sleep(10000); | ||
} | ||
client.close(); | ||
} | ||
main(); | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: statsd-example | ||
spec: | ||
initContainers: | ||
- name: dependencies | ||
image: node | ||
command: | ||
- bash | ||
- -c | ||
- | | ||
Check failure on line 46 in charts/k8s-monitoring/tests/integration/statsd/deployments/statsd-example.yaml
|
||
npm install node-statsd | ||
cp /src/statsd-example.js /workspace | ||
workingDir: /workspace | ||
volumeMounts: | ||
- name: workspace | ||
mountPath: /workspace | ||
- name: source | ||
mountPath: /src | ||
containers: | ||
- name: main | ||
image: node | ||
args: ["statsd-example.js"] | ||
workingDir: /workspace | ||
volumeMounts: | ||
- name: workspace | ||
mountPath: /workspace | ||
volumes: | ||
- name: workspace | ||
emptyDir: {} | ||
- name: source | ||
configMap: | ||
name: statsd-example | ||
Check failure on line 68 in charts/k8s-monitoring/tests/integration/statsd/deployments/statsd-example.yaml
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
cluster: | ||
name: statsd-test | ||
|
||
destinations: | ||
- name: localPrometheus | ||
type: prometheus | ||
url: http://prometheus-server.prometheus.svc:9090/api/v1/write | ||
auth: | ||
type: basic | ||
username: promuser | ||
password: prometheuspassword | ||
|
||
alloy-receiver: | ||
enabled: true | ||
alloy: | ||
extraPorts: | ||
- name: statsd-udp | ||
port: 8125 | ||
targetPort: 8125 | ||
protocol: UDP | ||
- name: statsd-tcp | ||
port: 8125 | ||
targetPort: 8125 | ||
protocol: TCP | ||
extraConfig: |- | ||
prometheus.exporter.statsd "default" { | ||
listen_udp = ":8125" | ||
listen_tcp = ":8125" | ||
parse_dogstatsd_tags = true | ||
} | ||
prometheus.scrape "statsd" { | ||
targets = prometheus.exporter.statsd.default.targets | ||
forward_to = [prometheus.remote_write.localprometheus.receiver] | ||
} | ||
Check failure on line 35 in charts/k8s-monitoring/tests/integration/statsd/values.yaml
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the right branch ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, yep, gotta change that to main.