-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chart for Envoy deployments #8
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v2 | ||
name: envoy | ||
description: |- | ||
Helm chart to deploy [envoy](https://www.envoyproxy.io/). | ||
type: application | ||
version: 0.0.10 | ||
appVersion: "v1.18.2" | ||
home: https://github.com/slamdev/helm-charts/tree/master/charts/envoy | ||
icon: https://www.envoyproxy.io/docs/envoy/latest/_static/envoy-logo.png | ||
maintainers: | ||
kylehodgetts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: slamdev | ||
email: valentin.fedoskin@gmail.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# envoy | ||
|
||
![Version: 0.0.9](https://img.shields.io/badge/Version-0.0.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.18.2](https://img.shields.io/badge/AppVersion-v1.18.2-informational?style=flat-square) | ||
|
||
Helm chart to deploy [envoy](https://www.envoyproxy.io/). | ||
|
||
**Homepage:** <https://github.com/slamdev/helm-charts/tree/master/charts/envoy> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. old reference |
||
|
||
## Maintainers | ||
|
||
| Name | Email | Url | | ||
| ---- | ------ | --- | | ||
| slamdev | valentin.fedoskin@gmail.com | | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here as well |
||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| affinity | object | `{}` | affinity for scheduler pod assignment | | ||
| args | list | `[]` | extra args to pass to container | | ||
| configYaml | string | `"admin:\n access_log_path: /tmp/admin_access.log\n address:\n socket_address:\n protocol: TCP\n address: 0.0.0.0\n port_value: 9901\nstatic_resources:\n listeners:\n - name: listener_0\n address:\n socket_address:\n protocol: TCP\n address: 0.0.0.0\n port_value: 10000\n filter_chains:\n - filters:\n - name: envoy.filters.network.http_connection_manager\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager\n stat_prefix: ingress_http\n access_log:\n - name: envoy.access_loggers.file\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog\n # For the demo config in the Docker container we use:\n # - system logs -> `/dev/stderr`\n # - (listener) access_logs -> `/dev/stdout`\n path: /dev/stdout\n route_config:\n name: local_route\n virtual_hosts:\n - name: local_service\n domains: [\"*\"]\n routes:\n - match:\n prefix: \"/\"\n route:\n host_rewrite_literal: www.envoyproxy.io\n cluster: service_envoyproxy_io\n http_filters:\n - name: envoy.filters.http.router\n clusters:\n - name: service_envoyproxy_io\n connect_timeout: 30s\n type: LOGICAL_DNS\n # Comment out the following line to test on v6 networks\n dns_lookup_family: V4_ONLY\n lb_policy: ROUND_ROBIN\n load_assignment:\n cluster_name: service_envoyproxy_io\n endpoints:\n - lb_endpoints:\n - endpoint:\n address:\n socket_address:\n address: www.envoyproxy.io\n port_value: 443\n transport_socket:\n name: envoy.transport_sockets.tls\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext\n sni: www.envoyproxy.io"` | config yaml | | ||
| containerAdminPort | int | `9901` | | | ||
| containerPort | int | `10000` | container port, should match admin port_value from config.yaml | | ||
| env | string | `nil` | environment variables for the deployment | | ||
| fullnameOverride | string | `""` | full name of the chart. | | ||
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | | ||
| image.repository | string | `"envoyproxy/envoy"` | image repository | | ||
| image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) | | ||
| imagePullSecrets | list | `[]` | image pull secret for private images | | ||
| ingress.annotations | object | `{}` | ingress annotations | | ||
| ingress.enabled | bool | `false` | enables Ingress for envoy | | ||
| ingress.hosts | list | `[]` | ingress accepted hostnames | | ||
| ingress.tls | list | `[]` | ingress TLS configuration | | ||
| livenessProbe.httpGet.path | string | `"/"` | path for liveness probe | | ||
| livenessProbe.httpGet.port | string | `"http"` | port for liveness probe | | ||
| nameOverride | string | `""` | override name of the chart | | ||
| nodeSelector | object | `{}` | node for scheduler pod assignment | | ||
| podSecurityContext | object | `{}` | specifies security settings for a pod | | ||
| readinessProbe.httpGet.path | string | `"/"` | path for readiness probe | | ||
| readinessProbe.httpGet.port | string | `"http"` | port for readiness probe | | ||
| replicaCount | int | `1` | number of replicas for haproxy deployment. | | ||
| resources | object | `{}` | custom resource configuration | | ||
| service.annotations | object | `{}` | annotations to add to the service | | ||
| service.port | int | `80` | service port | | ||
| service.type | string | `"ClusterIP"` | service type | | ||
| serviceAccount.annotations | object | `{}` | annotations to add to the service account | | ||
| serviceAccount.create | bool | `false` | specifies whether a service account should be created | | ||
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template | | ||
| serviceMonitor.additionalLabels | object | `{}` | additional labels for service monitor | | ||
| serviceMonitor.enabled | bool | `false` | ServiceMonitor CRD is created for a prometheus operator | | ||
| tolerations | list | `[]` | tolerations for scheduler pod assignment | | ||
| volumeMounts | string | `nil` | volume mounts | | ||
| volumes | string | `nil` | volumes | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 "envoy.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 "envoy.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "envoy.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 "envoy.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "envoy.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 "envoy.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 "envoy.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "envoy.labels" -}} | ||
helm.sh/chart: {{ include "envoy.chart" . }} | ||
{{ include "envoy.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "envoy.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "envoy.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "envoy.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "envoy.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the tag for the docker image to use | ||
*/}} | ||
{{- define "envoy.tag" -}} | ||
{{- .Values.image.tag | default .Chart.AppVersion -}} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "envoy.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
data: | ||
envoy.yaml: |- {{ .Values.configYaml | nindent 4 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "envoy.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "envoy.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "envoy.selectorLabels" . | nindent 8 }} | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "envoy.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
initContainers: | ||
- name: preprocess-config | ||
image: alpine:3.12.4 | ||
args: | ||
- sh | ||
- -c | ||
- apk add perl && cp /opt/envoy.yaml.tpl /config/envoy.yaml && perl -pi -e 's/ENV_([_A-Z0-9]+)_ENV/$ENV{$1}/g' /config/envoy.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. welp, that no go - we can't run these commands during each pod start. I suggest removing this init container completely and use only config map with envoy.yaml |
||
{{- with .Values.env }} | ||
env: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: /config | ||
- name: config-tpl | ||
mountPath: /opt/envoy.yaml.tpl | ||
subPath: envoy.yaml | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ include "envoy.tag" . }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- -c | ||
- /config/envoy.yaml | ||
{{- range .Values.args }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.containerPort }} | ||
protocol: TCP | ||
- name: http-admin | ||
containerPort: {{ .Values.containerAdminPort }} | ||
protocol: TCP | ||
livenessProbe: | ||
{{- toYaml .Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.env }} | ||
env: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: /config | ||
{{- with .Values.volumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
- name: config | ||
emptyDir: {} | ||
- name: config-tpl | ||
configMap: | ||
name: {{ include "envoy.fullname" . }} | ||
{{- with .Values.volumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need ingress object completely |
||
{{- $fullName := include "envoy.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: networking.k8s.io/v1 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.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: {{ . }} | ||
{{- if semverCompare "<1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||
backend: | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $svcPort }} | ||
{{- else }} | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "envoy.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
{{- with .Values.service.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "envoy.selectorLabels" . | nindent 4 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "envoy.fullname" . }}-admin | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
admin: "true" | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http-admin | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "envoy.selectorLabels" . | nindent 4 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "envoy.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if .Values.serviceMonitor.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "envoy.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "envoy.labels" . | nindent 4 }} | ||
{{- if .Values.serviceMonitor.additionalLabels }} | ||
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
endpoints: | ||
- port: http | ||
path: "/stats/prometheus" | ||
selector: | ||
matchLabels: | ||
{{- include "envoy.selectorLabels" . | nindent 6 }} | ||
admin: "true" | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference to old source