-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create a Service for the workload and fix the metrics collector (#…
…101) * fix: create a Service for the workload and fix the metrics collector This charm was not deploying any Service for the workload container, which is fine for its regular functions, but causes an issue when the Prometheus scraper tries reaching out the metrics endpoint. This commit adds a Service that is attached to the WORKLOAD (the container inside the Pod that gets created by the StatefulSet we are applying manually) so that the metrics from it can be reached correctly. Because of that, the MetricsEndpointProvider's target has to be refactored to point to the correct service. In a previous version of this charm, the target was pointing to the charm's container, which does not have any metrics endpoit, causing the issues reported in canonical/bundle-kubeflow#564. Part of canonical/bundle-kubeflow#564 * tests: add an assertion for checking unit is available The test_prometheus_grafana_integration test case was doing queries to prometheus and checking the request returned successfully and that the application name and model was listed correctly. To make this test case more accurately, we can add an assertion that also checks that the unit is available, this way we avoid issues like the one described in canonical/bundle-kubeflow#564. Part of canonical/bundle-kubeflow#564
- Loading branch information
Showing
3 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ app_name }}-svc | ||
namespace: {{ namespace }} | ||
spec: | ||
ports: | ||
- name: metrics-endpoint | ||
port: {{ metrics_port }} | ||
protocol: TCP | ||
targetPort: {{ metrics_port }} | ||
selector: | ||
# This selector ensures this Service identifies | ||
# the metacontroller workload Pod correctly as ti will have | ||
# the same tag. Please NOTE this is pointing at the workload | ||
# and not the charm. The label is assigned to the Pod via the | ||
# StatefulSet located in the same directory as this file. | ||
app.kubernetes.io/name: {{ namespace }}-{{ app_name }}-charm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters