Skip to content

Commit

Permalink
Added ephemeral_storage_node_* metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcgrath207 committed Nov 27, 2023
1 parent 43f6c5e commit f329a8e
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 96 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: e2e

on:
push:
branches:
- main
- master

jobs:
e2e:
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ release-docker:

release-helm:
cd chart
sed -i "s/tag.*/tag: ${VERSION}/g" values.yaml
sed -i "s/version.*/version: ${VERSION}/g" Chart.yaml
sed -i "s/appVersion.*/appVersion: ${VERSION}/g" Chart.yaml
sed -i "s/tag:.*/tag: ${VERSION}/g" values.yaml
sed -i "s/version:.*/version: ${VERSION}/g" Chart.yaml
sed -i "s/appVersion:.*/appVersion: ${VERSION}/g" Chart.yaml
helm package .
helm repo index --merge index.yaml .
sed -i "s!k8s-ephemeral-storage-metrics-${VERSION}.tgz!https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/releases/download/${VERSION}/k8s-ephemeral-storage-metrics-${VERSION}.tgz!g" index.yaml
cd ..

release: github_login release-docker release-helm helm-docs
# ex. make VERSION=1.2.1 release
# ex. make VERSION=1.3.0 release

release-github: github_login
# ex. make VERSION=1.2.1 release-github
# ex. make VERSION=1.3.0 release-github
gh release create ${VERSION} --generate-notes
gh release upload ${VERSION} "chart/k8s-ephemeral-storage-metrics-${VERSION}.tgz"
rm chart/k8s-ephemeral-storage-metrics-*.tgz
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ helm upgrade --install my-deployment k8s-ephemeral-storage-metrics/k8s-ephemeral
|-----|------|---------|-------------|
| deploy_type | string | `"Deployment"` | Set as Deployment for single controller to query all nodes or Daemonset |
| dev.enabled | bool | `false` | |
| extra.adjusted_polling_rate | bool | `false` | Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing. |
| image.imagePullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/jmcgrath207/k8s-ephemeral-storage-metrics"` | |
| image.tag | string | `"1.2.1"` | |
| image.tag | string | `"1.3.0"` | |
| interval | int | `15` | Polling node rate for exporter |
| log_level | string | `"info"` | |
| max_node_concurrency | int | `10` | Max amount of concurrent query requests at a time. |
| max_node_concurrency | int | `10` | Max number of concurrent query requests to the kubernetes API. |
| metrics | object | `{"adjusted_polling_rate":false,"ephemeral_storage_node_available":true,"ephemeral_storage_node_capacity":true,"ephemeral_storage_node_percentage":true,"ephemeral_storage_pod_usage":true}` | Set metrics you want to enable |
| metrics.adjusted_polling_rate | bool | `false` | Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing. |
| metrics.ephemeral_storage_node_available | bool | `true` | Available ephemeral storage for a node |
| metrics.ephemeral_storage_node_capacity | bool | `true` | Capacity of ephemeral storage for a node |
| metrics.ephemeral_storage_node_percentage | bool | `true` | Percentage of ephemeral storage used on a node |
| metrics.ephemeral_storage_pod_usage | bool | `true` | Current ephemeral byte usage of pod |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| prometheus.enable | bool | `true` | |
Expand Down
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: k8s-ephemeral-storage-metrics
version: 1.2.1
appVersion: 1.2.1
version: 1.3.0
appVersion: 1.3.0
kubeVersion: ">=1.21.0-0"
description: Ephemeral storage metrics for prometheus operator.
home: https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics
Expand Down
11 changes: 8 additions & 3 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ helm upgrade --install my-deployment k8s-ephemeral-storage-metrics/k8s-ephemeral
|-----|------|---------|-------------|
| deploy_type | string | `"Deployment"` | Set as Deployment for single controller to query all nodes or Daemonset |
| dev.enabled | bool | `false` | |
| extra.adjusted_polling_rate | bool | `false` | Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing. |
| image.imagePullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/jmcgrath207/k8s-ephemeral-storage-metrics"` | |
| image.tag | string | `"1.2.1"` | |
| image.tag | string | `"1.3.0"` | |
| interval | int | `15` | Polling node rate for exporter |
| log_level | string | `"info"` | |
| max_node_concurrency | int | `10` | Max amount of concurrent query requests at a time. |
| max_node_concurrency | int | `10` | Max number of concurrent query requests to the kubernetes API. |
| metrics | object | `{"adjusted_polling_rate":false,"ephemeral_storage_node_available":true,"ephemeral_storage_node_capacity":true,"ephemeral_storage_node_percentage":true,"ephemeral_storage_pod_usage":true}` | Set metrics you want to enable |
| metrics.adjusted_polling_rate | bool | `false` | Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing. |
| metrics.ephemeral_storage_node_available | bool | `true` | Available ephemeral storage for a node |
| metrics.ephemeral_storage_node_capacity | bool | `true` | Capacity of ephemeral storage for a node |
| metrics.ephemeral_storage_node_percentage | bool | `true` | Percentage of ephemeral storage used on a node |
| metrics.ephemeral_storage_pod_usage | bool | `true` | Current ephemeral byte usage of pod |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| prometheus.enable | bool | `true` | |
Expand Down
24 changes: 23 additions & 1 deletion chart/index.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
apiVersion: v1
entries:
k8s-ephemeral-storage-metrics:
- annotations:
artifacthub.io/license: MIT
artifacthub.io/links: |
- name: Documentation
url: https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics
artifacthub.io/prerelease: "false"
apiVersion: v2
appVersion: 1.3.0
created: "2023-11-26T22:34:31.469506023-06:00"
description: Ephemeral storage metrics for prometheus operator.
digest: 907280778c7dfb692248f3585ce53b848d4e4b9d2db6e13e4752c6033604f77a
home: https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics
keywords:
- kubernetes
- metrics
kubeVersion: '>=1.21.0-0'
name: k8s-ephemeral-storage-metrics
sources:
- https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics
urls:
- https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/releases/download/1.3.0/k8s-ephemeral-storage-metrics-1.3.0.tgz
version: 1.3.0
- annotations:
artifacthub.io/license: MIT
artifacthub.io/links: |
Expand Down Expand Up @@ -155,4 +177,4 @@ entries:
urls:
- https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/releases/download/1.0.0/k8s-ephemeral-storage-metrics-1.0.0.tgz
version: 1.0.0
generated: "2023-11-03T18:46:23.291817062-05:00"
generated: "2023-11-26T22:34:31.469131799-06:00"
26 changes: 21 additions & 5 deletions chart/templates/DeployType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,30 @@ spec:
value: "{{ .Values.max_node_concurrency }}"
- name: LOG_LEVEL
value: "{{ .Values.log_level }}"
{{ if .Values.extra.adjusted_polling_rate }}
{{- if .Values.metrics.ephemeral_storage_pod_usage }}
- name: EPHEMERAL_STORAGE_POD_USAGE
value: "{{ .Values.metrics.ephemeral_storage_pod_usage }}"
{{- end }}
{{- if .Values.metrics.ephemeral_storage_node_available }}
- name: EPHEMERAL_STORAGE_NODE_AVAILABLE
value: "{{ .Values.metrics.ephemeral_storage_node_available }}"
{{- end }}
{{- if .Values.metrics.ephemeral_storage_node_capacity }}
- name: EPHEMERAL_STORAGE_NODE_CAPACITY
value: "{{ .Values.metrics.ephemeral_storage_node_capacity }}"
{{- end }}
{{- if .Values.metrics.ephemeral_storage_node_percentage }}
- name: EPHEMERAL_STORAGE_NODE_PERCENTAGE
value: "{{ .Values.metrics.ephemeral_storage_node_percentage }}"
{{- end }}
{{- if .Values.metrics.adjusted_polling_rate }}
- name: ADJUSTED_POLLING_RATE
value: "{{ .Values.extra.adjusted_polling_rate }}"
{{ end }}
{{ if eq .Values.deploy_type "DaemonSet" }}
value: "{{ .Values.metrics.adjusted_polling_rate }}"
{{- end }}
{{- if eq .Values.deploy_type "DaemonSet" }}
- name: CURRENT_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{ end }}
{{- end }}

21 changes: 16 additions & 5 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
image:
repository: ghcr.io/jmcgrath207/k8s-ephemeral-storage-metrics
tag: 1.2.1
tag: 1.3.0
imagePullPolicy: IfNotPresent

# -- Set metrics you want to enable
metrics:
# -- Current ephemeral byte usage of pod
ephemeral_storage_pod_usage: true
# -- Available ephemeral storage for a node
ephemeral_storage_node_available: true
# -- Capacity of ephemeral storage for a node
ephemeral_storage_node_capacity: true
# -- Percentage of ephemeral storage used on a node
ephemeral_storage_node_percentage: true
# -- Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing.
adjusted_polling_rate: false

log_level: info
# -- Set as Deployment for single controller to query all nodes or Daemonset
deploy_type: Deployment
# Note in testing, Kube API does not refresh faster than 10 seconds
# -- Polling node rate for exporter
interval: 15 # Seconds
# -- Max amount of concurrent query requests at a time.
# -- Max number of concurrent query requests to the kubernetes API.
max_node_concurrency: 10
prometheus:
enable: true
release: kube-prometheus-stack

extra:
# -- Create the ephemeral_storage_adjusted_polling_rate metrics to report Adjusted Poll Rate in milliseconds. Typically used for testing.
adjusted_polling_rate: false

# For local development and testing
dev:
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ go 1.21

require (
github.com/cenkalti/backoff/v4 v4.2.1
github.com/deckarep/golang-set/v2 v2.3.1
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.29.0
github.com/panjf2000/ants/v2 v2.8.2
github.com/deckarep/golang-set/v2 v2.4.0
github.com/onsi/ginkgo/v2 v2.13.1
github.com/onsi/gomega v1.30.0
github.com/panjf2000/ants/v2 v2.9.0
github.com/prometheus/client_golang v1.17.0
github.com/rs/zerolog v1.31.0
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4

)

Expand All @@ -20,7 +20,7 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
Expand Down Expand Up @@ -49,17 +49,17 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.28.3 // indirect
k8s.io/api v0.28.4 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
Expand Down
Loading

0 comments on commit f329a8e

Please sign in to comment.