-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Helm Charts Custom Metrics Server deployment
- Loading branch information
1 parent
72e4cfe
commit 4a80ee0
Showing
10 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: instmetrics | ||
description: The CrownLabs CustomMetricsServer | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
icon: https://crownlabs.polito.it/images/logo.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "instmetrics.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 "instmetrics.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 }} | ||
|
||
{{/* | ||
The version of the application to be deployed | ||
*/}} | ||
{{- define "instmetrics.version" -}} | ||
{{- if .Values.global }} | ||
{{- .Values.image.tag | default .Values.global.version | default .Chart.AppVersion }} | ||
{{- else }} | ||
{{- .Values.image.tag | default .Chart.AppVersion }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "instmetrics.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "instmetrics.labels" -}} | ||
helm.sh/chart: {{ include "instmetrics.chart" . }} | ||
{{ include "instmetrics.selectorLabels" . }} | ||
app.kubernetes.io/version: {{ include "instmetrics.version" . | quote }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "instmetrics.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "instmetrics.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ include "instmetrics.fullname" . }} | ||
labels: | ||
{{- include "instmetrics.labels" . | nindent 4 }} | ||
{{- with .Values.daemonsetAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "instmetrics.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "instmetrics.selectorLabels" . | nindent 8 }} | ||
spec: | ||
tolerations: | ||
{{ toYaml .Values.tolerations | indent 8 }} | ||
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.containerSecurityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ include "instmetrics.version" . }}" | ||
imagePullPolicy: "{{ .Values.image.pullPolicy }}" | ||
args: | ||
- "--runtime-endpoint={{ .Values.configurations.runtimeEndpoint }}" | ||
- "--connection-timeout={{ .Values.configurations.connectionTimeout }}" | ||
- "--update-period={{ .Values.configurations.updatePeriod }}" | ||
- "--grpc-port={{ .Values.configurations.grpcPort }}" | ||
ports: | ||
- name: grpc | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
- name: probes | ||
containerPort: 8081 | ||
protocol: TCP | ||
readinessProbe: | ||
httpGet: | ||
path: /ready | ||
port: probes | ||
initialDelaySeconds: 3 | ||
periodSeconds: 3 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
- name: container-runtime | ||
mountPath: "{{ .Values.configurations.containerRuntime }}" | ||
readOnly: true | ||
- name: docker-socket | ||
mountPath: "{{ .Values.configurations.dockerSocket }}" | ||
readOnly: true | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
volumes: | ||
- name: container-runtime | ||
hostPath: | ||
path: "{{ .Values.configurations.containerRuntime }}" | ||
- name: docker-socket | ||
hostPath: | ||
path: "{{ .Values.configurations.dockerSocket }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "instmetrics.fullname" . }} | ||
labels: | ||
{{- include "instmetrics.labels" . | nindent 4 }} | ||
spec: | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: grpc | ||
protocol: TCP | ||
name: grpc | ||
selector: | ||
{{- include "instmetrics.selectorLabels" . | nindent 4 }} | ||
# Traffic is restricted to be routed only to endpoinds on the same node. | ||
# This is because metrics of a specific container are colleted only by | ||
# instmetrics server(s) running on the same Node of the container. | ||
internalTrafficPolicy: Local | ||
type: {{ .Values.service.type }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Default values for instmetrics | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
image: | ||
repository: crownlabs/instmetrics | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart version. | ||
tag: "" | ||
|
||
configurations: | ||
runtimeEndpoint: unix:///run/dockershim.sock | ||
containerRuntime: /run/dockershim.sock | ||
dockerSocket: /var/run/docker.sock | ||
connectionTimeout: 10s | ||
updatePeriod: 4s | ||
grpcPort: 9090 | ||
|
||
automountServiceAccountToken: false | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
daemonsetAnnotations: {} | ||
podAnnotations: {} | ||
|
||
podSecurityContext: | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
runAsGroup: 0 | ||
|
||
containerSecurityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
privileged: false | ||
|
||
service: | ||
type: ClusterIP | ||
port: 9090 | ||
|
||
|
||
resources: | ||
limits: | ||
cpu: 1000m | ||
memory: 500Mi | ||
requests: | ||
cpu: 200m | ||
memory: 150Mi | ||
|
||
tolerations: [] | ||
# these tolerations are to have the daemonset runnable on control plane nodes | ||
# uncomment them to enable the daemonset pods to be also scheduled on control plane nodes | ||
# - key: node-role.kubernetes.io/control-plane | ||
# operator: Exists | ||
# effect: NoSchedule | ||
# - key: node-role.kubernetes.io/master | ||
# operator: Exists | ||
# effect: NoSchedule | ||
|