added repo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
{{- if eq (printf "%s" .Values.stackdriver.projectId) "FALSE" }}
|
||||
######################################################################################
|
||||
#### ERROR: You did not set stackdriver.projectId in your `helm install' call. ####
|
||||
######################################################################################
|
||||
|
||||
This deployment will be incomplete until you set an appropriate Google Cloud
|
||||
Project ID so we know where to gather metrics from. You can do this by:
|
||||
|
||||
helm upgrade {{ .Release.Name }} \
|
||||
--set stackdriver.projectId=project-id stable/stackdriver-exporter
|
||||
{{- end }}
|
||||
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "stackdriver-exporter.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT{{ .Values.web.path }}
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "stackdriver-exporter.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "stackdriver-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.httpPort }}{{ .Values.web.path }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "stackdriver-exporter.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:{{ .Values.service.httpPort }}{{ .Values.web.path }} to use your application"
|
||||
kubectl port-forward $POD_NAME {{ .Values.service.httpPort }}:{{ .Values.service.httpPort }} --namespace {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,68 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "stackdriver-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 "stackdriver-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 "stackdriver-exporter.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "stackdriver-exporter.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "stackdriver-exporter.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate basic labels
|
||||
*/}}
|
||||
{{- define "stackdriver-exporter.labels" }}
|
||||
helm.sh/chart: {{ template "stackdriver-exporter.chart" . }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/component: metrics
|
||||
app.kubernetes.io/part-of: {{ template "stackdriver-exporter.name" . }}
|
||||
{{- include "stackdriver-exporter.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.customLabels }}
|
||||
{{ toYaml .Values.customLabels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "stackdriver-exporter.selectorLabels" }}
|
||||
app.kubernetes.io/name: {{ include "stackdriver-exporter.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,133 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "stackdriver-exporter.fullname" . }}
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "stackdriver-exporter.selectorLabels" . | indent 6 }}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 8 }}
|
||||
{{- if .Values.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.annotations | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml .Values.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccount: {{ template "stackdriver-exporter.serviceAccountName" . }}
|
||||
serviceAccountName: {{ template "stackdriver-exporter.serviceAccountName" . }}
|
||||
restartPolicy: {{ .Values.restartPolicy }}
|
||||
volumes:
|
||||
{{- if .Values.stackdriver.serviceAccountSecret }}
|
||||
- name: stackdriver-service-account
|
||||
secret:
|
||||
secretName: {{ .Values.stackdriver.serviceAccountSecret | quote }}
|
||||
{{- if and (.Values.stackdriver.serviceAccountSecret) (.Values.stackdriver.serviceAccountSecretKey) }}
|
||||
items:
|
||||
- key: {{ .Values.stackdriver.serviceAccountSecretKey | quote }}
|
||||
path: credentials.json
|
||||
{{- end }}
|
||||
{{- else if .Values.stackdriver.serviceAccountKey }}
|
||||
- name: stackdriver-service-account
|
||||
secret:
|
||||
secretName: {{ template "stackdriver-exporter.fullname" . }}
|
||||
{{- end}}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["stackdriver_exporter"]
|
||||
volumeMounts:
|
||||
{{- if or .Values.stackdriver.serviceAccountSecret .Values.stackdriver.serviceAccountKey }}
|
||||
- name: stackdriver-service-account
|
||||
mountPath: /etc/secrets/service-account/
|
||||
{{- end}}
|
||||
args:
|
||||
- --google.project-id={{ .Values.stackdriver.projectId }}
|
||||
- --monitoring.metrics-interval={{ .Values.stackdriver.metrics.interval }}
|
||||
- --monitoring.metrics-offset={{ .Values.stackdriver.metrics.offset }}
|
||||
- --monitoring.metrics-type-prefixes={{ .Values.stackdriver.metrics.typePrefixes }}
|
||||
{{- range .Values.stackdriver.metrics.filters }}
|
||||
- --monitoring.filters={{ . }}
|
||||
{{- end }}
|
||||
- --stackdriver.backoff-jitter={{ .Values.stackdriver.backoffJitter }}
|
||||
- --stackdriver.http-timeout={{ .Values.stackdriver.httpTimeout }}
|
||||
- --stackdriver.max-backoff={{ .Values.stackdriver.maxBackoff }}
|
||||
- --stackdriver.max-retries={{ .Values.stackdriver.maxRetries }}
|
||||
- --stackdriver.retry-statuses={{ .Values.stackdriver.retryStatuses }}
|
||||
- --web.listen-address={{ .Values.web.listenAddress }}
|
||||
- --web.telemetry-path={{ .Values.web.path }}
|
||||
{{- if .Values.stackdriver.dropDelegatedProjects }}
|
||||
- --monitoring.drop-delegated-projects
|
||||
{{- end }}
|
||||
{{- if .Values.stackdriver.metrics.ingestDelay }}
|
||||
- --monitoring.metrics-ingest-delay
|
||||
{{- end }}
|
||||
{{- if .Values.stackdriver.metrics.aggregateDeltas }}
|
||||
- --monitoring.aggregate-deltas
|
||||
- --monitoring.aggregate-deltas-ttl={{ .Values.stackdriver.metrics.aggregateDeltasTTL }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraArgs }}
|
||||
{{- range $key, $value := .Values.extraArgs }}
|
||||
{{- if $value }}
|
||||
- --{{ $key }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.stackdriver.serviceAccountSecret .Values.stackdriver.serviceAccountKey }}
|
||||
env:
|
||||
- name: GOOGLE_APPLICATION_CREDENTIALS
|
||||
value: /etc/secrets/service-account/credentials.json
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.httpPort }}
|
||||
name: http
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 10
|
||||
{{- if .Values.containerSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if .Values.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ template "stackdriver-exporter.fullname" . }}
|
||||
{{- with .Values.prometheusRule.namespace }}
|
||||
namespace: {{ . }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
{{- with .Values.prometheusRule.additionalLabels -}}
|
||||
{{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.prometheusRule.rules }}
|
||||
groups:
|
||||
- name: {{ template "stackdriver-exporter.name" $ }}
|
||||
rules: {{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.stackdriver.serviceAccountKey -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "stackdriver-exporter.fullname" . }}
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
{{- if .Values.secret.labels }}
|
||||
{{- toYaml .Values.secret.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
credentials.json: {{ .Values.stackdriver.serviceAccountKey | b64enc | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "stackdriver-exporter.fullname" . }}
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.httpPort }}
|
||||
protocol: TCP
|
||||
selector:
|
||||
{{- include "stackdriver-exporter.selectorLabels" . | indent 4 }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
name: {{ template "stackdriver-exporter.serviceAccountName" . }}
|
||||
{{- if .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- if .Values.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "stackdriver-exporter.fullname" . }}
|
||||
{{- if .Values.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "stackdriver-exporter.labels" . | indent 4 }}
|
||||
{{- if .Values.serviceMonitor.additionalLabels }}
|
||||
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- port: http
|
||||
{{- if .Values.serviceMonitor.interval }}
|
||||
interval: {{ .Values.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
|
||||
honorTimestamps: {{ .Values.serviceMonitor.honorTimestamps }}
|
||||
{{- if .Values.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml .Values.serviceMonitor.metricRelabelings | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "stackdriver-exporter.selectorLabels" . | indent 6 }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user