Skip to content
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

feat: add labels to kube artifacts #427

Merged
merged 4 commits into from
Dec 12, 2023
Merged

feat: add labels to kube artifacts #427

merged 4 commits into from
Dec 12, 2023

Conversation

cmwylie19
Copy link
Collaborator

@cmwylie19 cmwylie19 commented Dec 7, 2023

Description

This PR is a draft and discussion around adding labels to kube artifacts to distinguish what is what. For instance, I may want to get logs from only the watcher or admission pods without looking up the pod/deployment or uuid names. It also creates a method for scraping services using a ServiceMonitor's MatchLabel. This PR was created while writing documentation around scraping the Pepr services with Prometheus.

It also provides documentation how to scrape the Pepr services. Use this gist as a guide if needed

End Result:

┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr] - [2023-12-07 04:21:28]
└─[0] <git:(426 324b16f) > k get svc,po,deploy -n pepr-system  --show-labels     
NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE     LABELS
service/pepr-static-test           ClusterIP   10.43.9.3      <none>        443/TCP   5m24s   pepr.dev/controller=admission
service/pepr-static-test-watcher   ClusterIP   10.43.75.252   <none>        443/TCP   5m24s   pepr.dev/controller=watcher

NAME                                            READY   STATUS    RESTARTS   AGE     LABELS
pod/pepr-static-test-b7f858d7-fsx5z             1/1     Running   0          5m24s   app=pepr-static-test,pepr.dev/controller=admission,pod-template-hash=b7f858d7
pod/pepr-static-test-b7f858d7-vr89k             1/1     Running   0          5m24s   app=pepr-static-test,pepr.dev/controller=admission,pod-template-hash=b7f858d7
pod/pepr-static-test-watcher-78647f6bbd-8jckv   1/1     Running   0          5m24s   app=pepr-static-test-watcher,pepr.dev/controller=watcher,pod-template-hash=78647f6bbd

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE     LABELS
deployment.apps/pepr-static-test           2/2     2            2           5m24s   app=pepr-static-test,pepr.dev/controller=admission
deployment.apps/pepr-static-test-watcher   1/1     1            1           5m24s   app=pepr-static-test-watcher,pepr.dev/controller=watcher

Related Issue

Fixes #426

Relates to #412

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Copy link

netlify bot commented Dec 7, 2023

Deploy Preview for pepr-docs canceled.

Name Link
🔨 Latest commit f7d9697
🔍 Latest deploy log https://app.netlify.com/sites/pepr-docs/deploys/657766ce10dbd30008948f05

@cmwylie19
Copy link
Collaborator Author

Examples:

┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr] - [2023-12-07 04:27:10]
└─[130] <git:(426 324b16f) > k logs -n pepr-system -l pepr.dev/controller=watcher -f --since 10s | jq 
{
  "level": 30,
  "time": 1701984435092,
  "pid": 16,
  "hostname": "pepr-static-test-watcher-78647f6bbd-8jckv",
  "method": "GET",
  "url": "/healthz",
  "status": 200,
  "duration": "1 ms"
}
{
  "level": 30,
  "time": 1701984435092,
  "pid": 16,
  "hostname": "pepr-static-test-watcher-78647f6bbd-8jckv",
  "method": "GET",
  "url": "/healthz",
  "status": 200,
  "duration": "0 ms"
}
{
  "level": 20,
  "time": 1701984437743,
  "pid": 16,
  "hostname": "pepr-static-test-watcher-78647f6bbd-8jckv",
  "apiVersion": "pepr.dev/v1",
  "kind": "PeprStore",
  "metadata": {
    "resourceVersion": "1344"
  },
  "msg": "Pepr Store update"
}

@cmwylie19 cmwylie19 marked this pull request as ready for review December 11, 2023 19:45
@cmwylie19 cmwylie19 merged commit 0e1c6e3 into main Dec 12, 2023
15 checks passed
@cmwylie19 cmwylie19 deleted the 426 branch December 12, 2023 16:22
@cmwylie19 cmwylie19 self-assigned this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Add labels to Pepr services for Prometheus scrapes
2 participants