Skip to content

Commit

Permalink
envoy: allow multiple ports and make init container optional
Browse files Browse the repository at this point in the history
  • Loading branch information
slamdev committed Jun 1, 2022
1 parent e666993 commit 204f81a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/envoy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: envoy
description: |-
Helm chart to deploy [envoy](https://www.envoyproxy.io/).
type: application
version: 0.0.14
version: 0.0.15
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
Expand Down
12 changes: 8 additions & 4 deletions charts/envoy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# envoy

![Version: 0.0.14](https://img.shields.io/badge/Version-0.0.14-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)
![Version: 0.0.15](https://img.shields.io/badge/Version-0.0.15-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/).

Expand All @@ -10,7 +10,7 @@ Helm chart to deploy [envoy](https://www.envoyproxy.io/).

| Name | Email | Url |
| ---- | ------ | --- |
| slamdev | [email protected] | |
| slamdev | <[email protected]> | |

## Values

Expand All @@ -20,7 +20,7 @@ Helm chart to deploy [envoy](https://www.envoyproxy.io/).
| 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 |
| containerPorts | list | `[{"containerPort":10000,"name":"http","protocol":"TCP"}]` | list of container ports, should match static port_value 's 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 |
Expand All @@ -32,6 +32,7 @@ Helm chart to deploy [envoy](https://www.envoyproxy.io/).
| ingress.hosts | list | `[]` | ingress accepted hostnames |
| ingress.tls | list | `[]` | ingress TLS configuration |
| initContainer.command | string | `"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"` | |
| initContainer.enabled | bool | `true` | |
| initContainer.image.pullPolicy | string | `"IfNotPresent"` | initContainer image pull policy |
| initContainer.image.repository | string | `"alpine"` | initContainer image repository |
| initContainer.image.tag | string | `"3.12.4"` | initContainer image tag |
Expand All @@ -44,12 +45,15 @@ Helm chart to deploy [envoy](https://www.envoyproxy.io/).
| readinessProbe.httpGet.port | string | `"http-admin"` | port for readiness probe |
| replicaCount | int | `1` | number of replicas for haproxy deployment. |
| resources | object | `{}` | custom resource configuration |
| secret | string | `nil` | secret |
| service.annotations | object | `{}` | annotations to add to the service |
| service.port | int | `80` | service port |
| service.loadBalancerIP | string | `""` | IP of service load balancer |
| service.ports | list | `[{"name":"http","port":80,"protocol":"TCP","targetPort":"http"}]` | list of service ports |
| 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 |
| serviceAdmin.port | int | `80` | port of envoy admin service |
| 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 |
Expand Down
13 changes: 10 additions & 3 deletions charts/envoy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spec:
serviceAccountName: {{ include "envoy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.initContainer.enabled }}
initContainers:
- name: preprocess-config
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
Expand All @@ -42,6 +43,7 @@ spec:
- name: config-tpl
mountPath: /opt/envoy.yaml.tpl
subPath: envoy.yaml
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ include "envoy.tag" . }}"
Expand All @@ -53,9 +55,7 @@ spec:
- {{ . | quote }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
{{ .Values.containerPorts | toYaml | nindent 12 }}
- name: http-admin
containerPort: {{ .Values.containerAdminPort }}
protocol: TCP
Expand All @@ -77,10 +77,17 @@ spec:
{{- end }}
volumes:
- name: config
{{- if .Values.initContainer.enabled }}
emptyDir: {}
{{- else }}
configMap:
name: {{ include "envoy.fullname" . }}
{{- end }}
{{- if .Values.initContainer.enabled }}
- name: config-tpl
configMap:
name: {{ include "envoy.fullname" . }}
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
6 changes: 1 addition & 5 deletions charts/envoy/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ metadata:
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
ports: {{ .Values.service.ports | toYaml | nindent 4 }}
{{- with .Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/envoy/templates/serviceAdmin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.port }}
- port: {{ .Values.serviceAdmin.port }}
targetPort: http-admin
protocol: TCP
name: http
Expand Down
20 changes: 16 additions & 4 deletions charts/envoy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
initContainer:
enabled: true
image:
# initContainer.image.repository -- initContainer image repository
repository: alpine
Expand Down Expand Up @@ -41,13 +42,21 @@ podSecurityContext: {}
service:
# service.type -- service type
type: ClusterIP
# service.port -- service port
port: 80
# service.ports -- list of service ports
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
# service.loadBalancerIP -- IP of service load balancer
loadBalancerIP: ""
# service.annotations -- annotations to add to the service
annotations: {}

serviceAdmin:
# serviceAdmin.port -- port of envoy admin service
port: 80

ingress:
# ingress.enabled -- enables Ingress for envoy
enabled: false
Expand Down Expand Up @@ -129,8 +138,11 @@ readinessProbe:
# readinessProbe.httpGet.port -- port for readiness probe
port: http-admin

# containerPort -- container port, should match static port_value from config.yaml
containerPort: 10000
# containerPorts -- list of container ports, should match static port_value 's from config.yaml
containerPorts:
- name: http
containerPort: 10000
protocol: TCP

# containerPort -- container port, should match admin port_value from config.yaml
containerAdminPort: 9901
Expand Down

0 comments on commit 204f81a

Please sign in to comment.