diff --git a/charts/github-exporter/.helmignore b/charts/github-exporter/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/charts/github-exporter/.helmignore @@ -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/ diff --git a/charts/github-exporter/Chart.yaml b/charts/github-exporter/Chart.yaml new file mode 100755 index 0000000..a8c3f8a --- /dev/null +++ b/charts/github-exporter/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: github-exporter +description: exporter for export github metrics +home: https://github.com/jkroepke/github_exporter +version: 1.0.0 +appVersion: 1.5.0 +maintainers: + - name: jkroepke + email: github@jkroepke.de + url: https://github.com/jkroepke +keywords: + - github_exporter + - config + - exporter + - github + - prometheus +sources: + - https://github.com/adorsys/github_exporter diff --git a/charts/github-exporter/README.md b/charts/github-exporter/README.md new file mode 100644 index 0000000..6fc0e01 --- /dev/null +++ b/charts/github-exporter/README.md @@ -0,0 +1,57 @@ +# github-exporter + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +exporter for export github metrics + +**Homepage:** + +## Installation + +```shell +helm repo add jkroepke https://jkroepke.github.io/helm-charts/ +helm install github-exporter jkroepke/github-exporter +``` + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| jkroepke | | | + +## Source Code + +* + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| annotations | object | `{}` | annotations of the Deployment. | +| env | object | `{}` | | +| extraVolumeMounts | string | `""` | Add additional volumes mounts, e. g. for custom secrets | +| extraVolumes | string | `""` | Add additional volumes, e.g. for custom secrets | +| fullnameOverride | string | `""` | String to fully override amazon-eks-pod-identity.fullname template | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.registry | string | `"docker.io"` | github_exporter image registry | +| image.repository | string | `"jkroepke/github_exporter"` | github_exporter image repository | +| image.tag | string | `.Chart.AppVersion` | github_exporter image tag (immutable tags are recommended). | +| imagePullSecrets | list | `[]` | registry secret names as an array | +| labels | object | `{}` | labels of the Deployment. | +| nameOverride | string | `""` | String to partially override github_exporter.fullname template (will maintain the release name) | +| podAnnotations | object | `{}` | Annotations for github_exporter pods | +| podLabels | object | `{}` | Additional labels for github_exporter pods | +| podSecurityContext | object | `{}` | github_exporter pods' Security Context. | +| resources.limits | object | `{}` | The resources limits for the amazon-eks-pod-identity-webhook container # Example: # limits: # cpu: 100m # memory: 128Mi | +| resources.requests | object | `{}` | The requested resources for the amazon-eks-pod-identity-webhook container # Examples: # requests: # cpu: 100m # memory: 128Mi | +| secrets | object | `{}` | | +| securityContext.readOnlyRootFilesystem | bool | `true` | Pod securityContext: Enable read-only root filesystem | +| securityContext.runAsGroup | int | `1` | Pod securityContext: Run primary group id | +| securityContext.runAsNonRoot | bool | `false` | Pod securityContext: Disable root user | +| securityContext.runAsUser | int | `65534` | Pod securityContext: Run user id | +| service.annotations | object | `{}` | Service annotations | +| service.type | string | `"ClusterIP"` | Service type | +| serviceAccount.annotations | object | `{}` | Annotations for service account. Evaluated as a template. | +| serviceAccount.create | bool | `true` | Enable creation of ServiceAccount for nginx pod | +| serviceAccount.labels | object | `{}` | Labels for service account. Evaluated as a template. | +| serviceAccount.name | string | A name is generated using the `github_exporter.fullname` template | The name of the ServiceAccount to use. | diff --git a/charts/github-exporter/README.md.gotmpl b/charts/github-exporter/README.md.gotmpl new file mode 100644 index 0000000..3be3ee3 --- /dev/null +++ b/charts/github-exporter/README.md.gotmpl @@ -0,0 +1,24 @@ +{{ template "chart.header" . }} + +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +## Installation + +```shell +helm repo add jkroepke https://jkroepke.github.io/helm-charts/ +helm install {{ template "chart.name" $ }} jkroepke/{{ template "chart.name" $ }} +``` + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/charts/github-exporter/templates/_helpers.tpl b/charts/github-exporter/templates/_helpers.tpl new file mode 100755 index 0000000..cdb5a89 --- /dev/null +++ b/charts/github-exporter/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "github-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 "github-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 "github-exporter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "github-exporter.labels" -}} +helm.sh/chart: {{ include "github-exporter.chart" . }} +{{ include "github-exporter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "github-exporter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "github-exporter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "github-exporter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "github-exporter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/github-exporter/templates/deployment.yaml b/charts/github-exporter/templates/deployment.yaml new file mode 100755 index 0000000..7603986 --- /dev/null +++ b/charts/github-exporter/templates/deployment.yaml @@ -0,0 +1,73 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + name: {{ template "github-exporter.fullname" . }} + labels: + {{- include "github-exporter.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "github-exporter.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- . | nindent 8 }} + {{- end }} + labels: + {{- include "github-exporter.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: github-exporter + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: metrics + containerPort: 9171 + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + env: + - name: GITHUB_EXPORTER_PORT + value: "9171" + {{- range $name, $value := .Values.env }} + - name: {{ $name | quote }} + value: {{ tpl $value $ | quote }} + {{- end }} + {{- range $name, $value := .Values.secrets }} + - name: {{ $name | quote }} + valueFrom: + secretKeyRef: + name: "{{ template "github-exporter.fullname" $ }}" + key: {{ $name | quote }} + {{- end }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- with .Values.extraVolumeMounts }} + {{- tpl . $ | nindent 12 }} + {{- end }} + volumes: + {{- with .Values.extraVolumes }} + {{- tpl . $ | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "github-exporter.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/github-exporter/templates/secrets.yaml b/charts/github-exporter/templates/secrets.yaml new file mode 100755 index 0000000..8c49994 --- /dev/null +++ b/charts/github-exporter/templates/secrets.yaml @@ -0,0 +1,13 @@ +{{ if .Values.secrets }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "github-exporter.fullname" . }} + labels: + {{- include "github-exporter.labels" . | nindent 4 }} +data: + {{- range $name, $value := .Values.secrets }} + {{ $name }}: "{{ tpl $value $ | b64enc }}" + {{- end }} + {{- end }} diff --git a/charts/github-exporter/templates/service.yaml b/charts/github-exporter/templates/service.yaml new file mode 100644 index 0000000..b7ffb04 --- /dev/null +++ b/charts/github-exporter/templates/service.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "github-exporter.fullname" . }} + labels: + {{- include "github-exporter.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 9171 + targetPort: metrics + protocol: TCP + name: metrics + selector: + {{- include "github-exporter.selectorLabels" . | nindent 4 }} diff --git a/charts/github-exporter/templates/serviceaccount.yaml b/charts/github-exporter/templates/serviceaccount.yaml new file mode 100644 index 0000000..f465f07 --- /dev/null +++ b/charts/github-exporter/templates/serviceaccount.yaml @@ -0,0 +1,16 @@ +{{- if .Values.serviceAccount.create -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "github-exporter.serviceAccountName" . }} + labels: + {{- include "github-exporter.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/github-exporter/templates/servicemonitor.yaml b/charts/github-exporter/templates/servicemonitor.yaml new file mode 100644 index 0000000..c1362ab --- /dev/null +++ b/charts/github-exporter/templates/servicemonitor.yaml @@ -0,0 +1,31 @@ +{{- if .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "github-exporter.fullname" . }} + labels: + {{- include "github-exporter.labels" . | nindent 4 }} +spec: + jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }} + selector: + matchLabels: + {{- include "github-exporter.selectorLabels" . | nindent 4 }} + endpoints: + - port: metrics + path: /metrics + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.honorLabels }} + honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.metricRelabelings }} + metricRelabelings: {{ toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 8 }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.relabelings }} + relabelings: {{ toYaml .Values.metrics.serviceMonitor.relabelings | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/github-exporter/values.yaml b/charts/github-exporter/values.yaml new file mode 100755 index 0000000..b495ac1 --- /dev/null +++ b/charts/github-exporter/values.yaml @@ -0,0 +1,133 @@ +# -- String to partially override github_exporter.fullname template (will maintain the release name) +nameOverride: '' + +# -- String to fully override amazon-eks-pod-identity.fullname template +fullnameOverride: '' + +image: + pullPolicy: IfNotPresent + # -- github_exporter image registry + registry: docker.io + # -- github_exporter image repository + repository: jkroepke/github_exporter + # -- github_exporter image tag (immutable tags are recommended). + # @default -- `.Chart.AppVersion` + tag: '' + +# -- registry secret names as an array +imagePullSecrets: [] + +service: + # -- Service type + type: ClusterIP + # -- Service annotations + annotations: {} + +# -- annotations of the Deployment. +annotations: {} + +# -- labels of the Deployment. +labels: {} + +resources: + # -- The resources limits for the amazon-eks-pod-identity-webhook container + ## Example: + ## limits: + ## cpu: 100m + ## memory: 128Mi + limits: {} + # -- The requested resources for the amazon-eks-pod-identity-webhook container + ## Examples: + ## requests: + ## cpu: 100m + ## memory: 128Mi + requests: {} + +env: {} + +secrets: {} + +# KEYCLOAK_PASSWORD: +serviceAccount: + # -- Enable creation of ServiceAccount for nginx pod + create: true + # -- The name of the ServiceAccount to use. + # @default -- A name is generated using the `github_exporter.fullname` template + name: '' + # -- Annotations for service account. Evaluated as a template. + annotations: {} + # -- Labels for service account. Evaluated as a template. + labels: {} + +securityContext: + # -- Pod securityContext: Enable read-only root filesystem + readOnlyRootFilesystem: true + # -- Pod securityContext: Run primary group id + runAsGroup: 1 + # -- Pod securityContext: Disable root user + runAsNonRoot: false + # -- Pod securityContext: Run user id + runAsUser: 65534 + +# -- github_exporter pods' Security Context. +podSecurityContext: {} + +# -- Additional labels for github_exporter pods +podLabels: {} + +# -- Annotations for github_exporter pods +podAnnotations: {} +# prometheus.io/port: "9999" +# prometheus.io/scheme: "http" +# prometheus.io/scrape: "true" + +# -- Add additional volumes, e.g. for custom secrets +extraVolumes: "" + +# -- Add additional volumes mounts, e. g. for custom secrets +extraVolumeMounts: "" + +metrics: + serviceMonitor: + # -- Specify if a ServiceMonitor will be deployed for Prometheus Operator + ## + enabled: false + # -- Namespace in which Prometheus is running + ## + namespace: "" + # -- Extra labels for the ServiceMonitor + ## + labels: {} + # -- Additional ServiceMonitor annotations (evaluated as a template) + ## + annotations: {} + # -- The name of the label on the target service to use as the job name in Prometheus + ## + jobLabel: "" + # -- honorLabels chooses the metric's labels on collisions with target labels + ## + honorLabels: false + # -- Interval at which metrics should be scraped. + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## e.g: + ## interval: 10s + ## + interval: "" + # -- Timeout after which the scrape is ended + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## e.g: + ## scrapeTimeout: 10s + ## + scrapeTimeout: "" + # -- Specify additional relabeling of metrics + ## + metricRelabelings: [] + # -- Specify general relabeling + ## + relabelings: [] + # -- Prometheus instance selector labels + ## ref: https://github.com/bitnami/charts/tree/master/bitnami/prometheus-operator#prometheus-configuration + ## selector: + ## prometheus: my-prometheus + ## + selector: {}