added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -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,162 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "stackdriver-exporter.fullname" . }}
labels:
{{- include "stackdriver-exporter.labels" . | indent 4 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
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 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | 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 }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- 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}}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- 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}}
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
args:
{{- if .Values.stackdriver.projectIds }}
{{- range .Values.stackdriver.projectIds }}
- --google.project-ids={{ . }}
{{- end }}
{{- else }}
- --google.project-id={{ .Values.stackdriver.projectId }}
{{- end }}
{{- if .Values.stackdriver.projectFilters }}
- --google.projects.filter='{{ .Values.stackdriver.projectFilters }}'
{{- end }}
- --monitoring.metrics-interval={{ .Values.stackdriver.metrics.interval }}
- --monitoring.metrics-offset={{ .Values.stackdriver.metrics.offset }}
{{- if .Values.stackdriver.metrics.prefixes }}
{{- range .Values.stackdriver.metrics.prefixes }}
- --monitoring.metrics-prefixes={{ . }}
{{- end }}
{{- else }}
- --monitoring.metrics-type-prefixes={{ .Values.stackdriver.metrics.typePrefixes | replace " " "" }}
{{- end }}
{{- 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.telemetryPath }}
- --web.stackdriver-telemetry-path={{ .Values.web.stackdriverTelemetryPath }}
{{- 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 .Values.extraEnv }}
env:
{{- if or .Values.stackdriver.serviceAccountSecret .Values.stackdriver.serviceAccountKey }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/secrets/service-account/credentials.json
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
{{- if .Values.containerSecurityContext }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
{{- end }}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- 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,11 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- include "stackdriver-exporter.labels" . | indent 4 }}
name: {{ template "stackdriver-exporter.serviceAccountName" . }}
{{- with .Values.serviceAccount.annotations }}
annotations: {{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- end -}}
@@ -0,0 +1,60 @@
{{- 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:
{{- if .Values.serviceMonitor.scrapeClass }}
scrapeClass: {{ .Values.serviceMonitor.scrapeClass }}
{{- end }}
endpoints:
- port: http
path: {{ .Values.web.telemetryPath }}
{{- 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 }}
{{- if ne .Values.web.telemetryPath .Values.web.stackdriverTelemetryPath }}
- port: http
path: {{ .Values.web.stackdriverTelemetryPath }}
{{- 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 }}
{{- end }}
selector:
matchLabels:
{{- include "stackdriver-exporter.selectorLabels" . | indent 6 }}
{{- end }}