Skip to content

Commit

Permalink
Fix profiling and update cluster config to use custom clusters
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall committed Oct 3, 2024
1 parent 0b988ce commit 9d380fc
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 19 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,23 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v4

- name: Check for cluster config
id: check-cluster-config
run: |
if [ -f "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml" ]; then
echo "has-cluster-config=true" >> "${GITHUB_ENV}"
else
echo "has-cluster-config=false" >> "${GITHUB_ENV}"
fi
- name: Create kind cluster
if: steps.check-cluster-config.outputs.has-cluster-config == false
uses: helm/kind-action@v1
with:
config: charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml

- name: Create kind cluster with special config
if: steps.check-cluster-config.outputs.has-cluster-config == true
uses: helm/kind-action@v1

- name: Run test
Expand Down
2 changes: 1 addition & 1 deletion charts/feature-profiling/templates/_java.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pyroscope.java "java_pods" {
sample_rate = {{ .Values.java.profilingConfig.sampleRate }}
lock = {{ .Values.java.profilingConfig.lock | quote }}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/feature-profiling/templates/_pprof.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pyroscope.scrape "pyroscope_scrape_{{ $currentType }}" {
{{- end }}
}

forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/feature-profiling/tests/java_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ tests:
sample_rate = 100
lock = "10ms"
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
}
12 changes: 6 additions & 6 deletions charts/feature-profiling/tests/pprof_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
discovery.relabel "pprof_pods_cpu_default_name" {
targets = discovery.relabel.pprof_pods.output
Expand Down Expand Up @@ -281,7 +281,7 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
discovery.relabel "pprof_pods_fgprof_default_name" {
targets = discovery.relabel.pprof_pods.output
Expand Down Expand Up @@ -394,7 +394,7 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
discovery.relabel "pprof_pods_goroutine_default_name" {
targets = discovery.relabel.pprof_pods.output
Expand Down Expand Up @@ -507,7 +507,7 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
discovery.relabel "pprof_pods_memory_default_name" {
targets = discovery.relabel.pprof_pods.output
Expand Down Expand Up @@ -620,7 +620,7 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
discovery.relabel "pprof_pods_mutex_default_name" {
targets = discovery.relabel.pprof_pods.output
Expand Down Expand Up @@ -733,6 +733,6 @@ tests:
}
}
forward_to = [pyroscope.write.profiles_service.receiver]
forward_to = argument.profiles_destinations.value
}
}
2 changes: 1 addition & 1 deletion charts/k8s-monitoring-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tests:
type: promql
```
Each query will be executed sequentially, and the test will fail if any of the queries return an error or does not have
Each query will be run sequentially, and the test will fail if any of the queries return an error or does not have
the expected output.
In order to specify different destinations of the same type, you can use multiple tests:
Expand Down
2 changes: 1 addition & 1 deletion charts/k8s-monitoring-test/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tests:
type: promql
```

Each query will be executed sequentially, and the test will fail if any of the queries return an error or does not have
Each query will be run sequentially, and the test will fail if any of the queries return an error or does not have
the expected output.

In order to specify different destinations of the same type, you can use multiple tests:
Expand Down
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ dependencies:
repository: https://grafana.github.io/helm-charts
version: 0.7.0
digest: sha256:a7478342074296ebf188fa7f1f61da0acebcf11cbe7293a9c5b933d834bcc30e
generated: "2024-10-01T11:35:02.136157-05:00"
generated: "2024-10-03T17:12:52.784993-05:00"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions charts/k8s-monitoring/schema-mods/types-and-enums.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
"frontendObservability": {"properties": {"destinations": { "uniqueItems": true, "items": { "type": "string" }}}},

"destinations": {"$ref": "#/definitions/destination-list"}
},
"definitions": {
"loki-destination": {"properties": {"tenantId": {"type": ["string", "number"]}}},
"otlp-destination": {"properties": {"tenantId": {"type": ["string", "number"]}}},
"prometheus-destination": {"properties": {"tenantId": {"type": ["string", "number"]}}},
"pyroscope-destination": {"properties": {"tenantId": {"type": ["string", "number"]}}}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ pyroscope.write {{ include "helper.alloy_name" .name | quote }} {
{{- else if eq (include "destinations.auth.type" .) "bearerToken" }}
bearer_token = {{ include "destinations.secret.read" (dict "destination" . "key" "auth.bearerToken") }}
{{- end }}
}

{{- if .tls }}
{{- if .tls }}
tls_config {
insecure_skip_verify = {{ .tls.insecureSkipVerify | default false }}
{{- if eq (include "destinations.secret.uses_secret" (dict "destination" . "key" "tls.ca")) "true" }}
Expand All @@ -40,6 +39,7 @@ pyroscope.write {{ include "helper.alloy_name" .name | quote }} {
{{- end }}
}
{{- end }}
}

external_labels = {
cluster = {{ $.clusterName | quote }},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
controllerManager:
extraArgs:
bind-address: 0.0.0.0
secure-port: "10257"
scheduler:
extraArgs:
bind-address: 0.0.0.0
secure-port: "10259"
- |
kind: KubeProxyConfiguration
metricsBindAddress: 0.0.0.0:10249
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ destinations:
- name: pyro
type: pyroscope
url: http://pyroscope.pyroscope.svc:4040
tenantId: "1"
tenantId: 1

profiling:
enabled: true
Expand Down
20 changes: 16 additions & 4 deletions charts/k8s-monitoring/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@
}
},
"tenantId": {
"type": "string"
"type": [
"string",
"number"
]
},
"tenantIdFrom": {
"type": "string"
Expand Down Expand Up @@ -949,7 +952,10 @@
}
},
"tenantId": {
"type": "string"
"type": [
"string",
"number"
]
},
"tenantIdFrom": {
"type": "string"
Expand Down Expand Up @@ -1127,7 +1133,10 @@
"type": "boolean"
},
"tenantId": {
"type": "string"
"type": [
"string",
"number"
]
},
"tenantIdFrom": {
"type": "string"
Expand Down Expand Up @@ -1247,7 +1256,10 @@
}
},
"tenantId": {
"type": "string"
"type": [
"string",
"number"
]
},
"tenantIdFrom": {
"type": "string"
Expand Down

0 comments on commit 9d380fc

Please sign in to comment.