Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

prometurbo chart #2

Merged
merged 2 commits into from
Nov 20, 2024
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 charts/prometurbo/.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/
8 changes: 8 additions & 0 deletions charts/prometurbo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
appVersion: "8.0"
description: A Helm chart for Turbonomic prometurbo metric server and data ingestion framework probe
name: prometurbo
version: 1.0.0
sources:
- https://github.com/turbonomic/prometurbo
- https://github.com/turbonomic/data-ingestion-framework
32 changes: 32 additions & 0 deletions charts/prometurbo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "prometurbo.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 "prometurbo.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 "prometurbo.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
67 changes: 67 additions & 0 deletions charts/prometurbo/templates/configmap-prometurbo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: prometurbo-config-{{ .Release.Name }}
data:
{{- if or .Values.servers .Values.exporters }}
prometheus.config: |-
{{- if .Values.servers }}
# This configuration defines the Prometheus servers and metrics to scrape.
# This configuration is deprecated. Please use PrometheusServerConfig CR to configure servers.
# [Schema]
# server
# url: string # `yaml:"url"`
# username: string # `yaml:"username"`
# password: string # `yaml:"password"`
# clusterId: string # `yaml:"clusterId"`
# bearerToken: string # `yaml:"bearerToken"`
# exporters: [ string ] #`yaml:"exporters"`
servers:
{{ toYaml .Values.servers | indent 6 }}
{{- end }}
{{- if .Values.exporters }}
# This configuration is deprecated. Please use PrometheusQueryMappings CR to configure exporters.
# [Schema]
# exporter:
# type: string # `yaml:"type"`
# hostedOnVM: bool # `yaml:"hostedOnVM,omitempty"`
# metrics: [ metrics ] # `yaml:"metrics"`
# attributes: map[string] ValueMapping # `yaml:"attributes"`
# metrics:
# type: string # `yaml:"type"`
# queries: map[string]string # `yaml:"queries"`
# ValueMapping:
# label: string # `yaml:"label"`
# matches: string # `yaml:"matches,omitempty"`
# as: string # `yaml:"as,omitempty"`
# isIdentifier: bool # `yaml:"isIdentifier"`
exporters:
{{ toYaml .Values.exporters | indent 6 }}
{{- end }}
{{- end }}

businessapp.config: |-
# This configuration defines business applications and their associated business transactions
# and dependent services.
#
# [Schema]
# businessApplications: [ businessApplication ]
# businessApplication:
# name: string # The name of the business application. Required.
# from: string # The discovering source (target URL) of the business application. Required.
# transactions: [ transaction ] # A list of business transactions. Optional.
# services: [ string ] # A list of services that the business application depends on. Required.
# transaction:
# name: string # The display name of the transaction. Optional.
# path: string # The request path of a business transaction. Required.
# dependOn: [ string ] # The list of services that the business transaction depends on. Required.
businessApplications:
{{- if .Values.businessApplications }}
{{ toYaml .Values.businessApplications | indent 6 }}
{{- end }}
turbo-autoreload.config: |-
{
"logging": {
"level": {{ .Values.logging.level }}
}
}
34 changes: 34 additions & 0 deletions charts/prometurbo/templates/configmap-turbodif.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: turbodif-config-{{ .Release.Name }}
data:
turbodif-config.json: |-
{
"communicationConfig": {
"serverMeta": {
"version": "{{ .Values.serverMeta.version }}",
"turboServer": "{{ .Values.serverMeta.turboServer }}"
},
"restAPIConfig": {
"opsManagerUserName": "{{ .Values.restAPIConfig.opsManagerUserName }}",
"opsManagerPassword": "{{ .Values.restAPIConfig.opsManagerPassword }}"
},
"sdkProtocolConfig": {
"registrationTimeoutSec": {{ .Values.sdkProtocolConfig.registrationTimeoutSec }},
"restartOnRegistrationTimeout": {{ .Values.sdkProtocolConfig.restartOnRegistrationTimeout }}
}
{{- if and .Values.targetName .Values.targetAddress }}
},
"targetConfig": {
"targetName": "{{ .Values.targetName }}",
"targetAddress": "{{ .Values.targetAddress }}"
}
{{- end }}
}
turbo-autoreload.config: |-
{
"logging": {
"level": {{ .Values.logging.level }}
}
}
81 changes: 81 additions & 0 deletions charts/prometurbo/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "prometurbo.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "prometurbo.name" . }}
helm.sh/chart: {{ include "prometurbo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "prometurbo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
annotations:
{{- with .Values.annotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "prometurbo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: {{ .Values.serviceAccountName }}
{{- if .Values.image.imagePullSecret }}
imagePullSecrets:
- name: {{ .Values.image.imagePullSecret }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image.prometurboRepository }}:{{ .Values.image.prometurboTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --v={{ .Values.args.logginglevel }}
resources:
{{ toYaml .Values.resources | indent 12 }}
ports:
- containerPort: 8081
volumeMounts:
- name: prometurbo-config
mountPath: /etc/prometurbo
readOnly: true
- name: turbodif
image: {{ .Values.image.turbodifRepository }}:{{ .Values.image.turbodifTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: "TURBODIF_TARGET_TYPE_OVERWRITE"
value: "Prometheus"
args:
- --v={{ .Values.args.logginglevel }}
{{- if .Values.args.ignoreCommodityIfPresent }}
- --ignoreCommodityIfPresent=true
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: turbodif-config
mountPath: /etc/turbodif
readOnly: true
- name: turbonomic-credentials-volume
mountPath: /etc/turbonomic-credentials
readOnly: true
- name: varlog
mountPath: /var/log
volumes:
- name: prometurbo-config
configMap:
name: prometurbo-config-{{ .Release.Name }}
- name: turbodif-config
configMap:
name: turbodif-config-{{ .Release.Name }}
- name: turbonomic-credentials-volume
secret:
defaultMode: 420
optional: true
secretName: {{ .Values.restAPIConfig.turbonomicCredentialsSecretName | quote }}
- name: varlog
emptyDir: {}
restartPolicy: Always
56 changes: 56 additions & 0 deletions charts/prometurbo/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccountName }}
{{- if eq .Values.roleName "prometurbo" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.roleName }}-{{ .Release.Name }}-{{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- services
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- metrics.turbonomic.io
resources:
- prometheusquerymappings
- prometheusserverconfigs
verbs:
- get
- list
- watch
- patch
- update
{{- end }}
---
kind: ClusterRoleBinding
# For OpenShift 3.4-3.7 use apiVersion: v1
# For kubernetes 1.9 use rbac.authorization.k8s.io/v1
# For kubernetes 1.8 use rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.roleBinding }}-{{ .Release.Name }}-{{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccountName }}
namespace: {{ .Release.Namespace }}
roleRef:
# User creating this resource must have permissions to add this policy to the SA
kind: ClusterRole
# accepted values cluster-reader disc and monitoring.
{{- if eq .Values.roleName "prometurbo"}}
name: {{ .Values.roleName }}-{{ .Release.Name }}-{{ .Release.Namespace }}
{{- else }}
name: {{ .Values.roleName }}
{{- end }}
# For OpenShift v3.4 remove apiGroup line
apiGroup: rbac.authorization.k8s.io

Loading