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

Enabling metrics via service-monitor for vpc-cni #1134

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/aws-vpc-cni/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: aws-vpc-cni
version: 1.18.2
version: 1.18.3
appVersion: "v1.18.2"
description: A Helm chart for the AWS VPC CNI
icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png
Expand Down
2 changes: 2 additions & 0 deletions stable/aws-vpc-cni/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ The following table lists the configurable parameters for this chart and their d
| `readinessProbe` | Readiness probe settings for daemonset | (see `values.yaml`) |
| `tolerations` | Optional deployment tolerations | `[{"operator": "Exists"}]` |
| `updateStrategy` | Optional update strategy | `type: RollingUpdate` |
| `serviceMonitor.enabled` | Optional service monitor | `false` |
| `serviceAnnotations` | Optional labels for service | `{}` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install` or provide a YAML file containing the values for the above parameters:

Expand Down
20 changes: 20 additions & 0 deletions stable/aws-vpc-cni/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "aws-vpc-cni.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{ include "aws-vpc-cni.labels" . | indent 4 }}
spec:
ports:
- port: 61678
name: metrics
targetPort: metrics
selector:
k8s-app: aws-node
{{- end }}
38 changes: 38 additions & 0 deletions stable/aws-vpc-cni/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if.Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "aws-vpc-cni.fullname" . }}
namespace: {{ default .Release.Namespace .Values.serviceMonitor.namespace }}
labels:
{{ include "aws-vpc-cni.labels" . | indent 4 }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: app.kubernetes.io/instance
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{ include "aws-vpc-cni.labels" . | indent 6 }}
endpoints:
- port: metrics
path: /metrics
scheme: http
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
18 changes: 18 additions & 0 deletions stable/aws-vpc-cni/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,21 @@ eniConfig:
# id: subnet-789
# securityGroups:
# - sg-789

serviceAnnotations: {}

serviceMonitor:
# Specifies whether a service monitor should be created
enabled: false
# Namespace to create the service monitor in
namespace:
# Labels to add to the service monitor
additionalLabels: {}
# Prometheus scrape interval
interval: 1m
# Prometheus scrape timeout
scrapeTimeout:
# Relabelings to apply to samples before ingestion
relabelings:
# Metric relabelings to apply to samples before ingestion
metricRelabelings: