-
Notifications
You must be signed in to change notification settings - Fork 566
OCPBUGS-57640: add kube-scheduler service monitor #6880
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
Changes from all commits
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,30 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| labels: | ||
| app: kube-scheduler | ||
| name: kube-scheduler | ||
| namespace: hcp-namespace | ||
| ownerReferences: | ||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||
| blockOwnerDeletion: true | ||
| controller: true | ||
| kind: HostedControlPlane | ||
| name: hcp | ||
| uid: "" | ||
| resourceVersion: "1" | ||
| spec: | ||
| internalTrafficPolicy: Cluster | ||
| ipFamilyPolicy: PreferDualStack | ||
| ports: | ||
| - name: client | ||
| port: 10259 | ||
| protocol: TCP | ||
| targetPort: client | ||
| selector: | ||
| app: kube-scheduler | ||
| sessionAffinity: None | ||
| type: ClusterIP | ||
| status: | ||
| loadBalancer: {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: kube-scheduler | ||
| namespace: hcp-namespace | ||
| ownerReferences: | ||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||
| blockOwnerDeletion: true | ||
| controller: true | ||
| kind: HostedControlPlane | ||
| name: hcp | ||
| uid: "" | ||
| resourceVersion: "1" | ||
| spec: | ||
| endpoints: | ||
| - honorLabels: true | ||
| interval: 30s | ||
| metricRelabelings: | ||
| - action: keep | ||
| regex: (kube_pod_resource_request|kube_pod_resource_limit) | ||
| sourceLabels: | ||
| - __name__ | ||
| - action: replace | ||
| replacement: "" | ||
| targetLabel: _id | ||
| path: /metrics/resources | ||
| relabelings: | ||
| - action: replace | ||
| replacement: "" | ||
| targetLabel: _id | ||
| scheme: https | ||
| targetPort: client | ||
| tlsConfig: | ||
| ca: | ||
| configMap: | ||
| key: ca.crt | ||
| name: root-ca | ||
| cert: | ||
| secret: | ||
| key: tls.crt | ||
| name: kube-scheduler-server | ||
| keySecret: | ||
| key: tls.key | ||
| name: kube-scheduler-server | ||
| serverName: kube-scheduler | ||
| namespaceSelector: | ||
| matchNames: | ||
| - hcp-namespace | ||
| selector: | ||
| matchLabels: | ||
| app: kube-scheduler |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| creationTimestamp: null | ||
| labels: | ||
| app: kube-scheduler | ||
| name: kube-scheduler | ||
| namespace: hcp-namespace | ||
| ownerReferences: | ||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||
| blockOwnerDeletion: true | ||
| controller: true | ||
| kind: HostedControlPlane | ||
| name: hcp | ||
| uid: "" | ||
| resourceVersion: "1" | ||
| spec: | ||
| internalTrafficPolicy: Cluster | ||
| ipFamilyPolicy: PreferDualStack | ||
| ports: | ||
| - name: client | ||
| port: 10259 | ||
| protocol: TCP | ||
| targetPort: client | ||
| selector: | ||
| app: kube-scheduler | ||
| sessionAffinity: None | ||
| type: ClusterIP | ||
| status: | ||
| loadBalancer: {} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||
| apiVersion: monitoring.coreos.com/v1 | ||||||||||||||||||||||||||
| kind: ServiceMonitor | ||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||
| creationTimestamp: null | ||||||||||||||||||||||||||
| name: kube-scheduler | ||||||||||||||||||||||||||
| namespace: hcp-namespace | ||||||||||||||||||||||||||
| ownerReferences: | ||||||||||||||||||||||||||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||||||||||||||||||||||||||
| blockOwnerDeletion: true | ||||||||||||||||||||||||||
| controller: true | ||||||||||||||||||||||||||
| kind: HostedControlPlane | ||||||||||||||||||||||||||
| name: hcp | ||||||||||||||||||||||||||
| uid: "" | ||||||||||||||||||||||||||
| resourceVersion: "1" | ||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||
| endpoints: | ||||||||||||||||||||||||||
| - honorLabels: true | ||||||||||||||||||||||||||
| interval: 30s | ||||||||||||||||||||||||||
| metricRelabelings: | ||||||||||||||||||||||||||
| - action: keep | ||||||||||||||||||||||||||
| regex: (kube_pod_resource_request|kube_pod_resource_limit) | ||||||||||||||||||||||||||
| sourceLabels: | ||||||||||||||||||||||||||
| - __name__ | ||||||||||||||||||||||||||
| - action: replace | ||||||||||||||||||||||||||
| replacement: "" | ||||||||||||||||||||||||||
| targetLabel: _id | ||||||||||||||||||||||||||
|
Comment on lines
+19
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metric filter likely drops all scheduler metrics Keeping only (kube_pod_resource_request|kube_pod_resource_limit) looks like a KSM filter, not kube-scheduler. This will likely result in zero samples from scheduler. Proposed fix: drop the keep filter so we scrape scheduler metrics normally. metricRelabelings:
- - action: keep
- regex: (kube_pod_resource_request|kube_pod_resource_limit)
- sourceLabels:
- - __name__
- - action: replace
+ - action: replace
replacement: ""
targetLabel: _id📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| path: /metrics/resources | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics path is nonstandard for kube-scheduler kube-scheduler exposes at /metrics (not /metrics/resources). - path: /metrics/resources
+ path: /metrics📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| relabelings: | ||||||||||||||||||||||||||
| - action: replace | ||||||||||||||||||||||||||
| replacement: "" | ||||||||||||||||||||||||||
| targetLabel: _id | ||||||||||||||||||||||||||
| scheme: https | ||||||||||||||||||||||||||
| targetPort: client | ||||||||||||||||||||||||||
| tlsConfig: | ||||||||||||||||||||||||||
| ca: | ||||||||||||||||||||||||||
| configMap: | ||||||||||||||||||||||||||
| key: ca.crt | ||||||||||||||||||||||||||
| name: root-ca | ||||||||||||||||||||||||||
| cert: | ||||||||||||||||||||||||||
| secret: | ||||||||||||||||||||||||||
| key: tls.crt | ||||||||||||||||||||||||||
| name: kube-scheduler-server | ||||||||||||||||||||||||||
| keySecret: | ||||||||||||||||||||||||||
| key: tls.key | ||||||||||||||||||||||||||
| name: kube-scheduler-server | ||||||||||||||||||||||||||
| serverName: kube-scheduler | ||||||||||||||||||||||||||
| namespaceSelector: | ||||||||||||||||||||||||||
| matchNames: | ||||||||||||||||||||||||||
| - hcp-namespace | ||||||||||||||||||||||||||
| selector: | ||||||||||||||||||||||||||
| matchLabels: | ||||||||||||||||||||||||||
| app: kube-scheduler | ||||||||||||||||||||||||||
|
Comment on lines
+51
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify selector matches the actual Service labels Ensure the Service has label app: kube-scheduler; otherwise the monitor won’t select it. 🏁 Script executed: #!/bin/bash
# Verify selector label on kube-scheduler Service definitions
rg -nC3 --type=yaml -P '\bkind:\s*Service\b' | rg -nC5 -P 'name:\s*kube-scheduler|\bapp:\s*kube-scheduler'Length of output: 0 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Files mentioning 'kube-scheduler' =="
rg -n --hidden -S 'kube-scheduler' -g '!*node_modules/*' -g '!*vendor/*' || true
echo
echo "== YAML files with 'kube-scheduler' (context) =="
rg -n --hidden -S --type=yaml -C5 'kube-scheduler' -g '!*node_modules/*' -g '!*vendor/*' || true
echo
echo "== All YAML Service definitions (showing 3 lines context) =="
rg -n --hidden -S --type=yaml -C3 'kind:\s*Service' -g '!*node_modules/*' -g '!*vendor/*' || trueLength of output: 598 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE='control-plane-operator/controllers/hostedcontrolplane/testdata/kube-scheduler/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_scheduler_servicemonitor.yaml'
echo "== Showing $FILE (first 200 lines, with numbers) =="
if [ -f "$FILE" ]; then
nl -ba -w3 -s': ' "$FILE" | sed -n '1,200p'
else
echo "File not found: $FILE"
fi
echo
echo "== Repo grep: 'name: kube-scheduler' =="
grep -RIn --line-number --exclude-dir=node_modules --exclude-dir=vendor 'name:[[:space:]]*kube-scheduler' . || true
echo
echo "== Repo grep: 'app: kube-scheduler' =="
grep -RIn --line-number --exclude-dir=node_modules --exclude-dir=vendor 'app:[[:space:]]*kube-scheduler' . || true
echo
echo "== Repo grep: YAML Service docs containing 'kube-scheduler' (show filename only) =="
# list files that have both 'kind: Service' and 'kube-scheduler' somewhere inside
for f in $(grep -RIl --exclude-dir=node_modules --exclude-dir=vendor 'kind:[[:space:]]*Service' . || true); do
if grep -Iq 'kube-scheduler' "$f"; then
echo "$f"
echo "----- snippet -----"
nl -ba -w3 -s': ' "$f" | sed -n '1,200p'
echo
fi
doneLength of output: 258 🏁 Script executed: #!/bin/bash
set -euo pipefail
FILE='control-plane-operator/controllers/hostedcontrolplane/testdata/kube-scheduler/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_scheduler_servicemonitor.yaml'
echo "== Showing $FILE =="
if [ -f "$FILE" ]; then
awk '{printf "%4d: %s\n", NR, $0}' "$FILE" | sed -n '1,240p'
else
echo "File not found: $FILE"
fi
echo
echo "== Search for YAML files declaring a Service =="
# find yaml files and show any that contain 'kind: Service'
find . -type f \( -iname '*.yaml' -o -iname '*.yml' \) -not -path '*/node_modules/*' -not -path '*/vendor/*' -print0 \
| xargs -0 -n1 grep -I -n -H -E '^[[:space:]]*kind:[[:space:]]*Service' || true
echo
echo "== Search for files containing 'app: kube-scheduler' or 'name: kube-scheduler' =="
grep -RIn --exclude-dir=node_modules --exclude-dir=vendor -n -C5 -E 'app:[[:space:]]*kube-scheduler|name:[[:space:]]*kube-scheduler' . || true
echo
echo "== If any Service files were found above, print surrounding context (20 lines) =="
# For each yaml file that contains 'kind: Service', show context lines containing 'kube-scheduler' if present
for f in $(find . -type f \( -iname '*.yaml' -o -iname '*.yml' \) -not -path '*/node_modules/*' -not -path '*/vendor/*' -print); do
if grep -Iq '^[[:space:]]*kind:[[:space:]]*Service' "$f"; then
if grep -Iq 'kube-scheduler' "$f"; then
echo "---- $f ----"
grep -n -C20 -E 'kube-scheduler|kind:[[:space:]]*Service' "$f" || true
echo
fi
fi
doneLength of output: 157679 ServiceMonitor selector has no matching Service — add or align the Service label ServiceMonitor control-plane-operator/controllers/hostedcontrolplane/testdata/kube-scheduler/TechPreviewNoUpgrade/zz_fixture_TestControlPlaneComponents_kube_scheduler_servicemonitor.yaml (lines 46–47) selects matchLabels: app: kube-scheduler but no Service with that label exists in the repo (only the Deployment has app: kube-scheduler). Add a Service labeled app: kube-scheduler in the same namespace or update the ServiceMonitor selector to the Service's actual labels. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.