Skip to content

Commit

Permalink
kruise state metrics chart (#39)
Browse files Browse the repository at this point in the history
Signed-off-by: liheng.zms <[email protected]>
  • Loading branch information
zmberg authored Jan 31, 2023
1 parent 201a65e commit f5439ca
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/kruise-state-metrics
23 changes: 23 additions & 0 deletions versions/kruise-state-metrics/0.1/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
17 changes: 17 additions & 0 deletions versions/kruise-state-metrics/0.1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: kruise-state-metrics
description: Install kruise-state-metrics to generate and expose kruise metrics
type: application
version: 0.1.0
appVersion: "1.16.0"
icon: https://openkruise.io/img/logo_white.png
keywords:
- metric
- monitoring
- prometheus
- kubernetes
- openkruise
- workload
home: https://openkruise.io
sources:
- https://github.com/openkruise/kruise-state-metrics
56 changes: 56 additions & 0 deletions versions/kruise-state-metrics/0.1/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kruise-state-metrics.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kruise-state-metrics.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kruise-state-metrics.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kruise-state-metrics.labels" -}}
control-plane: {{ .Values.fullnameOverride }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kruise-state-metrics.selectorLabels" -}}
control-plane: {{ .Values.fullnameOverride }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kruise-state-metrics.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kruise-state-metrics.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
71 changes: 71 additions & 0 deletions versions/kruise-state-metrics/0.1/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{- if .Values.installation.createNamespace }}
apiVersion: v1
kind: Namespace
metadata:
labels:
{{- include "kruise-state-metrics.labels" . | nindent 4 }}
name: {{ .Values.installation.namespace }}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kruise-state-metrics.fullname" . }}
namespace: {{ .Values.installation.namespace }}
labels:
{{- include "kruise-state-metrics.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "kruise-state-metrics.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "kruise-state-metrics.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "kruise-state-metrics.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
command:
- /kruise-state-metrics
args:
- --logtostderr=true
- --v=5
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http-metrics
containerPort: 8080
- name: telemetry
containerPort: 8081
livenessProbe:
httpGet:
path: /healthz
port: 8080
readinessProbe:
httpGet:
path: /
port: 8081
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
18 changes: 18 additions & 0 deletions versions/kruise-state-metrics/0.1/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "kruise-state-metrics.fullname" . }}
namespace: {{ .Values.installation.namespace }}
labels:
{{- include "kruise-state-metrics.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http-metrics
port: 8080
targetPort: http-metrics
- name: telemetry
port: 8081
targetPort: telemetry
selector:
{{- include "kruise-state-metrics.selectorLabels" . | nindent 4 }}
40 changes: 40 additions & 0 deletions versions/kruise-state-metrics/0.1/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kruise-state-metrics-role
rules:
- apiGroups:
- apps.kruise.io
resources:
- '*'
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kruise-state-metrics-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kruise-state-metrics-role
subjects:
- kind: ServiceAccount
name: {{ include "kruise-state-metrics.serviceAccountName" . }}
namespace: {{ .Values.installation.namespace }}
---
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "kruise-state-metrics.serviceAccountName" . }}
namespace: {{ .Values.installation.namespace }}
labels:
{{- include "kruise-state-metrics.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
57 changes: 57 additions & 0 deletions versions/kruise-state-metrics/0.1/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Default values for kruise-state-metrics.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

installation:
namespace: kruise-system
createNamespace: false

replicaCount: 1

image:
repository: openkruise/kruise-state-metrics
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.0"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: "kruise-state-metrics"

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

service:
type: ClusterIP

resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit f5439ca

Please sign in to comment.