Skip to content

Commit 71575b6

Browse files
authored
Upstream echo-server updates (cloudposse/terraform-aws-components#486)
* init move * echo server update * add reference to upstream * add eks to precommit
0 parents  commit 71575b6

19 files changed

+1127
-0
lines changed

src/README.md

Lines changed: 160 additions & 0 deletions
Large diffs are not rendered by default.

src/charts/echo-server/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

src/charts/echo-server/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: "echo-server"
3+
description: A server that replicates the request sent by the client and sends it back.
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.2.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.2.0"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "echo-server.name" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "echo-server.name" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "echo-server.name" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "echo-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "echo-server.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "echo-server.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "echo-server.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
helm.sh/chart: {{ include "echo-server.chart" . }}
36+
{{- if .Chart.AppVersion }}
37+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
38+
{{- end }}
39+
app.kubernetes.io/managed-by: {{ .Release.Service }}
40+
*/}}
41+
{{- define "echo-server.labels" -}}
42+
{{ include "echo-server.selectorLabels" . }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
app.kubernetes.io/name: {{ include "echo-server.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
*/}}
50+
{{- define "echo-server.selectorLabels" -}}
51+
app: {{ include "echo-server.fullname" . }}
52+
{{- end }}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "echo-server.serviceAccountName" -}}
58+
{{- if .Values.serviceAccount.create }}
59+
{{- default (include "echo-server.fullname" .) .Values.serviceAccount.name }}
60+
{{- else }}
61+
{{- default "default" .Values.serviceAccount.name }}
62+
{{- end }}
63+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "echo-server.fullname" . }}
5+
labels:
6+
{{- include "echo-server.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "echo-server.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
name: {{ include "echo-server.fullname" . }}
17+
labels:
18+
{{- include "echo-server.selectorLabels" . | nindent 8 }}
19+
spec:
20+
containers:
21+
- name: {{ .Chart.Name }}
22+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
23+
imagePullPolicy: {{ .Values.image.pullPolicy }}
24+
ports:
25+
- name: http
26+
containerPort: 80
27+
protocol: TCP
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{- if or (eq (printf "%v" .Values.ingress.nginx.enabled) "true") (eq (printf "%v" .Values.ingress.alb.enabled) "true") -}}
2+
{{- $fullName := include "echo-server.fullname" . -}}
3+
{{- $svcName := include "echo-server.name" . -}}
4+
{{- $svcPort := .Values.service.port -}}
5+
{{- $nginxTlsEnabled := and (eq (printf "%v" .Values.ingress.nginx.enabled) "true") (eq (printf "%v" .Values.tlsEnabled) "true")}}
6+
apiVersion: networking.k8s.io/v1
7+
kind: Ingress
8+
metadata:
9+
name: {{ $fullName }}
10+
annotations:
11+
{{- if eq (printf "%v" .Values.ingress.nginx.enabled) "true" }}
12+
kubernetes.io/ingress.class: {{ .Values.ingress.nginx.class }}
13+
{{- if (index .Values.ingress.nginx "tls_certificate_cluster_issuer") }}
14+
cert-manager.io/cluster-issuer: {{ .Values.ingress.nginx.tls_certificate_cluster_issuer }}
15+
{{- end }}
16+
{{- else if eq (printf "%v" .Values.ingress.alb.enabled) "true" }}
17+
kubernetes.io/ingress.class: {{ .Values.ingress.alb.class }}
18+
alb.ingress.kubernetes.io/load-balancer-name: {{ index .Values.ingress.alb "load_balancer_name" | default "k8s-common" }}
19+
alb.ingress.kubernetes.io/group.name: {{ index .Values.ingress.alb "group_name" | default "common" }}
20+
alb.ingress.kubernetes.io/scheme: internet-facing
21+
alb.ingress.kubernetes.io/target-type: 'ip'
22+
{{- if eq (printf "%v" .Values.ingress.alb.ssl_redirect.enabled) "true" }}
23+
alb.ingress.kubernetes.io/ssl-redirect: '{{ .Values.ingress.alb.ssl_redirect.port }}'
24+
{{- end }}
25+
{{- if eq (printf "%v" .Values.tlsEnabled) "true" }}
26+
alb.ingress.kubernetes.io/backend-protocol: HTTP
27+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
28+
{{- else }}
29+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
30+
{{- end }}
31+
{{- end }}
32+
labels:
33+
{{- include "echo-server.labels" . | nindent 4 }}
34+
spec:
35+
{{- if $nginxTlsEnabled }}
36+
tls: # < placing a host in the TLS config will indicate a certificate should be created
37+
- hosts:
38+
- {{ .Values.ingress.hostname }}
39+
secretName: {{ $svcName }}-cert # < cert-manager will store the created certificate in this secret.
40+
{{- end }}
41+
rules:
42+
- host: {{ .Values.ingress.hostname }}
43+
http:
44+
paths:
45+
- path: /
46+
pathType: Prefix
47+
backend:
48+
service:
49+
name: {{ $svcName }}
50+
port:
51+
number: {{ $svcPort }}
52+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "echo-server.name" . }}
5+
labels:
6+
{{- include "echo-server.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "echo-server.selectorLabels" . | nindent 4 }}

src/charts/echo-server/values.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Default values for echo-server.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
# image.repository -- https://hub.docker.com/r/ealen/echo-server
9+
repository: ealen/echo-server
10+
# image.tag -- https://github.com/Ealenn/Echo-Server/releases
11+
tag: 0.4.2
12+
pullPolicy: Always
13+
14+
#imagePullSecrets: []
15+
nameOverride: ""
16+
#fullnameOverride: ""
17+
18+
#serviceAccount:
19+
# # Specifies whether a service account should be created
20+
# create: true
21+
# # Annotations to add to the service account
22+
# annotations: {}
23+
# # The name of the service account to use.
24+
# # If not set and create is true, a name is generated using the fullname template
25+
# name: ""
26+
27+
#podAnnotations: {}
28+
29+
#podSecurityContext: {}
30+
# # fsGroup: 2000
31+
32+
#securityContext: {}
33+
# # capabilities:
34+
# # drop:
35+
# # - ALL
36+
# # readOnlyRootFilesystem: true
37+
# # runAsNonRoot: true
38+
# # runAsUser: 1000
39+
40+
service:
41+
type: ClusterIP
42+
port: 80
43+
44+
tlsEnabled: true
45+
46+
ingress:
47+
nginx:
48+
# ingress.nginx.enabled -- Enable NGiNX ingress
49+
enabled: false
50+
# annotation values
51+
## kubernetes.io/ingress.class:
52+
class: "nginx"
53+
## cert-manager.io/cluster-issuer:
54+
tls_certificate_cluster_issuer: "letsencrypt-prod"
55+
alb:
56+
enabled: true
57+
# annotation values
58+
## kubernetes.io/ingress.class:
59+
class: "alb"
60+
## alb.ingress.kubernetes.io/load-balancer-name:
61+
### load_balancer_name: "k8s-common"
62+
## alb.ingress.kubernetes.io/group.name:
63+
### group_name: "common"
64+
ssl_redirect:
65+
enabled: true
66+
## alb.ingress.kubernetes.io/ssl-redirect:
67+
port: 443
68+
69+
#resources: {}
70+
# # We usually recommend not to specify default resources and to leave this as a conscious
71+
# # choice for the user. This also increases chances charts run on environments with little
72+
# # resources, such as Minikube. If you do want to specify resources, uncomment the following
73+
# # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
74+
# # limits:
75+
# # cpu: 100m
76+
# # memory: 128Mi
77+
# # requests:
78+
# # cpu: 100m
79+
# # memory: 128Mi
80+
81+
autoscaling:
82+
enabled: false
83+
#minReplicas: 1
84+
#maxReplicas: 100
85+
#targetCPUUtilizationPercentage: 80
86+
#targetMemoryUtilizationPercentage: 80
87+
88+
#nodeSelector: {}
89+
90+
#tolerations: []
91+
92+
#affinity: {}

0 commit comments

Comments
 (0)