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

Adds onos-exporter helm chart #429

Merged
merged 1 commit into from
May 12, 2021
Merged
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
22 changes: 22 additions & 0 deletions onos-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions onos-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: LicenseRef-ONF-Member-1.0

apiVersion: v2
name: onos-exporter
description: ONOS KPIs Exporter
kubeVersion: ">=1.17.0"
type: application
version: 0.1.0
appVersion: v0.1.0
keywords:
- onos
- sdn
- ric
home: https://onosproject.org
maintainers:
- name: ONOS Support
email: support@opennetworking.org
70 changes: 70 additions & 0 deletions onos-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "onos-exporter.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 "onos-exporter.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 "onos-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "onos-exporter.labels" -}}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "onos-exporter.chart" . }}
{{ include "onos-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "onos-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "onos-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
onos-exporter image name
*/}}
{{- define "onos-exporter.imagename" -}}
{{- if .Values.global.image.registry -}}
{{- printf "%s/" .Values.global.image.registry -}}
{{- else if .Values.image.registry -}}
{{- printf "%s/" .Values.image.registry -}}
{{- end -}}
{{- printf "%s:" .Values.image.repository -}}
{{- if .Values.global.image.tag -}}
{{- .Values.global.image.tag -}}
{{- else -}}
{{- .Values.image.tag -}}
{{- end -}}
{{- end -}}
55 changes: 55 additions & 0 deletions onos-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: LicenseRef-ONF-Member-1.0

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "onos-exporter.fullname" . }}
labels:
{{- include "onos-exporter.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
name: {{ template "onos-exporter.fullname" . }}
app: onos
type: exporter
resource: {{ template "onos-exporter.fullname" . }}
{{- include "onos-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
name: {{ template "onos-exporter.fullname" . }}
app: onos
type: exporter
resource: {{ template "onos-exporter.fullname" . }}
{{- include "onos-exporter.selectorLabels" . | nindent 8 }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ include "onos-exporter.imagename" . | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-e2tEndpoint={{ index .Values "config" "onos-exporter" "e2tEndpoint" }}"
- "-mode={{ index .Values "config" "onos-exporter" "mode" }}"
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 }}
25 changes: 25 additions & 0 deletions onos-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: LicenseRef-ONF-Member-1.0
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "onos-exporter.fullname" . }}
labels:
app: {{ template "onos-exporter.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- include "onos-exporter.labels" . | nindent 4 }}
spec:
type: ClusterIP
selector:
name: {{ template "onos-exporter.fullname" . }}
app: onos
type: exporter
resource: {{ template "onos-exporter.fullname" . }}
{{- include "onos-exporter.selectorLabels" . | nindent 4 }}
ports:
- name: exporter
port: {{ .Values.service.exporter.port }}
22 changes: 22 additions & 0 deletions onos-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: LicenseRef-ONF-Member-1.0

{{- $mode := index .Values "config" "onos-exporter" "mode" }}
{{- if eq $mode "prometheus" }}

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: onos-exporter
labels:
{{- include "onos-exporter.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "onos-exporter.selectorLabels" . | nindent 6 }}
endpoints:
- port: exporter
path: /metrics
scheme: HTTP
{{ end }}
50 changes: 50 additions & 0 deletions onos-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: LicenseRef-ONF-Member-1.0

global:
image:
registry: ""
tag: ""

replicaCount: 1

image:
registry: ""
repository: onosproject/onos-exporter
tag: v0.1.0
pullPolicy: IfNotPresent
pullSecrets: []

imagePullSecrets: []
nameOverride: ""
fullnameOverride: "onos-exporter"

service:
exporter:
port: 9861

config:
onos-exporter:
mode: "prometheus"
e2tEndpoint: "onos-e2t:5150"

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

logging:
loggers:
root:
level: info
output:
stdout:
sink: stdout
sinks:
stdout:
type: stdout
stdout: {}