-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from chatwork/charts
Add helm charts
- Loading branch information
Showing
13 changed files
with
433 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: sendgrid-stats-exporter | ||
description: A Helm chart for chatwork/sendgrid-stats-exporter (It's till private for now, but will make it public soon) | ||
type: application | ||
version: 0.0.1 | ||
appVersion: 0.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
KUBERNETES_VERSION="1.18.1" | ||
RELEASE = $$(basename $$PWD) | ||
|
||
.PHONY: install | ||
install: | ||
helm upgrade -i --wait $(RELEASE) . | ||
|
||
.PHONY: lint | ||
lint: lint-default | ||
|
||
.PHONY: lint-default | ||
lint-default: | ||
@echo "=> Linting default values.yaml" | ||
helm lint --strict | ||
@echo "=> Validating default value.yaml" | ||
helm template . | kubeval --kubernetes-version $(KUBERNETES_VERSION) | ||
@echo "" | ||
|
||
.PHONY: test | ||
test: | ||
helm test --logs $(RELEASE) | ||
|
||
.PHONY: uninstall | ||
uninstall: | ||
helm uninstall $(RELEASE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
sendgrid-stats-exporter | ||
=========== | ||
|
||
A Helm chart for [chatwork/sendgrid-stats-exporter](https://github.com/chatwork/sendgrid-stats-exporter). | ||
|
||
## Installing the Chart | ||
|
||
``` | ||
$ cat configmap.yaml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: sendgrid-config | ||
data: | ||
SENDGRID_API_KEY: 'secret' | ||
$ kubectl apply -f configmap.yaml | ||
configmap/sendgrid-config created | ||
$ helm install --set 'envFrom[0].configMapRef.name=sendgrid-config' sendgrid-stats-exporter ./ | ||
``` | ||
|
||
``` | ||
$ kubectl get svc | ||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | ||
sendgrid-stats-exporter ClusterIP 10.108.179.32 <none> 9154/TCP 2m54s | ||
$ kubectl run -it --rm=true busybox --image=yauritux/busybox-curl --restart=Never | ||
/home # curl 10.108.179.32:9154/-/healthy | ||
OK | ||
``` | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the Sendgrid-stats-exporter chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
| ------------------------ | ----------------------- | -------------- | | ||
| `replicaCount` | Number of replicas | `1` | | ||
| `image.repository` | Image repository | `"chatwork/sendgrid-stats-exporter"` | | ||
| `image.pullPolicy` | Image pull policy | `"IfNotPresent"` | | ||
| `image.tag` | Image tag | `"0.0.3"` | | ||
| `imagePullSecrets` | Image pull secret | `[]` | | ||
| `nameOverride` | Override the name of the chart | `""` | | ||
| `fullnameOverride` | Override the full-name of the chart | `""` | | ||
| `serviceAccount.create` | If true, create a new service account | `true` | | ||
| `serviceAccount.annotations` | Annotations for serviceAccount | `{}` | | ||
| `serviceAccount.name` | Name of the service account | `""` | | ||
| `podAnnotations` | Annotations for the pod | `{}` | | ||
| `podSecurityContext` | Security context for the pod | `{}` | | ||
| `securityContext` | Security context for container | `{}` | | ||
| `envFrom` | Extra custom environment variables from ConfigMaps | `[]` | | ||
| `service.type` | Service Type | `"ClusterIP"` | | ||
| `service.port` | Service port | `9154` | | ||
| `ingress.enabled` | If true, enable Ingress | `false` | | ||
| `ingress.annotations` | Annotations for ingress | `{}` | | ||
| `ingress.hosts` | Ingress accepted hostnames | `[{"host": "chart-example.local", "paths": []}]` | | ||
| `ingress.tls` | Ingress TLS configuration | `[]` | | ||
| `resources.limits.cpu` | | `"200m"` | | ||
| `resources.limits.memory` | | `"256Mi"` | | ||
| `resources.requests.cpu` | | `"100m"` | | ||
| `resources.requests.memory` | | `"128Mi"` | | ||
| `autoscaling.enabled` | If true, enable auto-scaling | `false` | | ||
| `autoscaling.minReplicas` | | `1` | | ||
| `autoscaling.maxReplicas` | | `5` | | ||
| `autoscaling.targetCPUUtilizationPercentage` | | `80` | | ||
| `nodeSelector` | Node labels for pod assignment | `{}` | | ||
| `tolerations` | Add tolerations | `[]` | | ||
| `affinity` | Node/Pod affinities | `{}` | | ||
|
||
--- | ||
_Documentation generated by [Frigate](https://frigate.readthedocs.io)._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sendgrid-stats-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 | ||
{{- 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 --namespace {{ .Release.Namespace }} svc -w {{ include "sendgrid-stats-exporter.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sendgrid-stats-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "sendgrid-stats-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "sendgrid-stats-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 "sendgrid-stats-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 "sendgrid-stats-exporter.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "sendgrid-stats-exporter.labels" -}} | ||
helm.sh/chart: {{ include "sendgrid-stats-exporter.chart" . }} | ||
{{ include "sendgrid-stats-exporter.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "sendgrid-stats-exporter.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "sendgrid-stats-exporter.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "sendgrid-stats-exporter.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "sendgrid-stats-exporter.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "sendgrid-stats-exporter.fullname" . }} | ||
labels: | ||
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "sendgrid-stats-exporter.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "sendgrid-stats-exporter.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "sendgrid-stats-exporter.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
envFrom: | ||
{{- toYaml .Values.envFrom | nindent 12 }} | ||
ports: | ||
- name: http | ||
containerPort: 9154 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /-/healthy | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: /-/healthy | ||
port: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "sendgrid-stats-exporter.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ . }} | ||
backend: | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "sendgrid-stats-exporter.fullname" . }} | ||
labels: | ||
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "sendgrid-stats-exporter.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "sendgrid-stats-exporter.serviceAccountName" . }} | ||
labels: | ||
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "sendgrid-stats-exporter.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "sendgrid-stats-exporter.fullname" . }}:{{ .Values.service.port }}/-/healthy'] | ||
restartPolicy: Never |
Oops, something went wrong.