From ef7ae6da8d3868adbd0427e1234be28480aa0647 Mon Sep 17 00:00:00 2001 From: Mohammad Yosefpor Date: Thu, 21 Oct 2021 15:43:24 +0330 Subject: [PATCH] chore(charts): restructure charts --- charts/.helmignore | 23 ------------ charts/Chart.yaml | 8 ---- charts/templates/_helpers.tpl | 32 ---------------- charts/templates/cm.yaml | 8 ---- charts/templates/deploy.yaml | 70 ----------------------------------- charts/templates/hpa.yaml | 28 -------------- charts/templates/svc.yaml | 13 ------- charts/values.yaml | 39 ------------------- 8 files changed, 221 deletions(-) delete mode 100644 charts/.helmignore delete mode 100644 charts/Chart.yaml delete mode 100644 charts/templates/_helpers.tpl delete mode 100644 charts/templates/cm.yaml delete mode 100644 charts/templates/deploy.yaml delete mode 100644 charts/templates/hpa.yaml delete mode 100644 charts/templates/svc.yaml delete mode 100644 charts/values.yaml diff --git a/charts/.helmignore b/charts/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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/Chart.yaml b/charts/Chart.yaml deleted file mode 100644 index fc3ef6b..0000000 --- a/charts/Chart.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v2 -name: health-exporter -home: https://github.com/snapp-cab/health-exporter -sources: - - https://github.com/snapp-cab/health-exporter.git -type: application -version: 0.3.0 -appVersion: 1.0.0 diff --git a/charts/templates/_helpers.tpl b/charts/templates/_helpers.tpl deleted file mode 100644 index 1fa20b6..0000000 --- a/charts/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ - -{{/* -Expand the name of the chart. -*/}} -{{- define "health_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 "health_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 "health_exporter.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/charts/templates/cm.yaml b/charts/templates/cm.yaml deleted file mode 100644 index 8b7be8b..0000000 --- a/charts/templates/cm.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: '{{ template "health_exporter.fullname" . }}' - namespace: '{{ .Release.Namespace }}' -data: - config.yaml: | - {{- toYaml .Values.config | default "{}" | nindent 4 }} diff --git a/charts/templates/deploy.yaml b/charts/templates/deploy.yaml deleted file mode 100644 index cb92be0..0000000 --- a/charts/templates/deploy.yaml +++ /dev/null @@ -1,70 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: '{{ template "health_exporter.fullname" . }}' - namespace: '{{ .Release.Namespace }}' - labels: - app: '{{ template "health_exporter.fullname" . }}' -spec: - replicas: {{ .Values.replicas }} - selector: - matchLabels: - app: '{{ template "health_exporter.fullname" . }}' - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 1 - maxSurge: 0 - template: - metadata: - labels: - app: '{{ template "health_exporter.fullname" . }}' - spec: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - '{{ template "health_exporter.fullname" . }}' - topologyKey: "kubernetes.io/hostname" - containers: - - name: health-exporter - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - volumeMounts: - - mountPath: /app/config.yaml - name: config - subPath: config.yaml - imagePullPolicy: Always - resources: - {{- toYaml .Values.resources | nindent 10 }} - ports: - - containerPort: '{{ .Values.config.listen }}' - livenessProbe: - failureThreshold: 3 - httpGet: - path: /healthz - port: '{{ .Values.config.listen }}' - scheme: HTTP - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - readinessProbe: - failureThreshold: 3 - httpGet: - path: /healthz - port: '{{ .Values.config.listen }}' - scheme: HTTP - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - volumes: - - name: config - configMap: - defaultMode: 420 - name: '{{ template "health_exporter.fullname" . }}' - items: - - key: config.yaml - path: config.yaml diff --git a/charts/templates/hpa.yaml b/charts/templates/hpa.yaml deleted file mode 100644 index 6ef9539..0000000 --- a/charts/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "health_exporter.fullname" . }} - labels: - {{- include "health_exporter.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "health_exporter.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/templates/svc.yaml b/charts/templates/svc.yaml deleted file mode 100644 index feea788..0000000 --- a/charts/templates/svc.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: '{{ template "health_exporter.fullname" . }}' - namespace: '{{ .Release.Namespace }}' -spec: - ports: - - name: web - port: 8080 - protocol: TCP - targetPort: '{{ .Values.config.listen }}' - selector: - app: '{{ template "health_exporter.fullname" . }}' diff --git a/charts/values.yaml b/charts/values.yaml deleted file mode 100644 index 82665b8..0000000 --- a/charts/values.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Default values for health-exporter. -image: - repository: "spc35771/health-exporter" - tag: "latest" -replicas: 1 -resources: - limits: - memory: "100Mi" - cpu: "1" - requests: - memory: "100Mi" - cpu: "1" - -autoscaling: - enabled: false - minReplicas: 2 - maxReplicas: 4 - targetCPUUtilizationPercentage: 80 - targetMemoryUtilizationPercentage: 80 - -config: - listen: ':9876' - targets: - http: - - name: 'sample' - url: 'http://google.com' - rps: 0.5 - timeout: '5s' - - name: 'google-tls' - url: 'https://google.com' - rps: 0.5 - timeout: '5s' - tls_skip_verify: true - dns: - - name: 'google' - domain: 'google.com' - record_type: 'A' - rps: 0.5 - timeout: '2s'