Skip to content

Commit c2b0260

Browse files
authored
[eks/echo-server] Deprecate ALB controller specific echo-server (cloudposse/terraform-aws-components#893)
1 parent 3330cab commit c2b0260

File tree

10 files changed

+145
-121
lines changed

10 files changed

+145
-121
lines changed

src/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Changes in PR #893, components version ~v1.337.0
2+
3+
- Moved `eks/echo-server` v1.147.0 to `/deprecated/eks/echo-server` for those
4+
who still need it and do not want to switch. It may later become the basis
5+
for an example app or something similar.
6+
- Removed dependency on and connection to the `eks/alb-controller-ingress-group` component
7+
- Added liveness probe, and disabled logging of probe requests. Probe request
8+
logging can be restored by setting `livenessProbeLogging: true` in `chart_values`
9+
- This component no longer configures automatic redirects from HTTP to HTTPS. This
10+
is because for ALB controller, setting that on one ingress sets it for all
11+
ingresses in the same IngressGroup, and it is a design goal that deploying
12+
this component does not affect other Ingresses (with the obvious exception
13+
of possibly being the first to create the Application Load Balancer).
14+
- Removed from `chart_values`:`ingress.nginx.class` (was set to "nginx") and
15+
`ingress.alb.class` (was set to "alb"). IngressClass should usually not be set,
16+
as this component is intended to be used to test the defaults, including the
17+
default IngressClass. However, if you do want to set it, you can do so by
18+
setting `ingress.class` in `chart_values`.
19+
- Removed the deprecated `kubernetes.io/ingress.class` annotation by default.
20+
It can be restored by setting `ingress.use_ingress_class_annotation: true` in `chart_values`.
21+
IngressClass is now set using the preferred `ingressClassName` field of the
22+
Ingress resource.

src/README.md

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@ This is copied from [cloudposse/terraform-aws-components](https://github.com/clo
55
This component installs the [Ealenn/Echo-Server](https://github.com/Ealenn/Echo-Server) to EKS clusters.
66
The echo server is a server that sends it back to the client a JSON representation of all the data
77
the server received, which is a combination of information sent by the client and information sent
8-
by the web server infrastructure. For further details, please see [Echo-Server documentation](https://ealenn.github.io/Echo-Server/).
8+
by the web server infrastructure. For further details, please consult the [Echo-Server documentation](https://ealenn.github.io/Echo-Server/).
99

1010
## Prerequisites
1111

12-
Echo server is intended to provide end-to-end testing of everything needed to deploy an application or service with a public HTTPS endpoint.
13-
Therefore, it requires several other components.
12+
Echo server is intended to provide end-to-end testing of everything needed
13+
to deploy an application or service with a public HTTPS endpoint. It uses
14+
defaults where possible, such as using the default IngressClass, in order
15+
to verify that the defaults are sufficient for a typical application.
1416

15-
At the moment, it supports 2 configurations:
17+
In order to minimize the impact of the echo server on the rest of the cluster,
18+
it does not set any configuration that would affect other ingresses, such
19+
as WAF rules, logging, or redirecting HTTP to HTTPS. Those settings should
20+
be configured in the IngressClass where possible.
21+
22+
Therefore, it requires several other components. At the moment, it supports 2 configurations:
1623

1724
1. ALB with ACM Certificate
1825
- AWS Load Balancer Controller (ALB) version 2.2.0 or later, with ACM certificate auto-discovery enabled
26+
- A default IngressClass, which can be provisioned by the `alb-controller` component as part of deploying
27+
the controller, or can be provisioned separately, for example by the `alb-controller-ingress-class` component.
1928
- Pre-provisioned ACM TLS certificate covering the provisioned host name (typically a wildcard certificate covering all hosts in the domain)
2029
2. Nginx with Cert Manager Certificate
2130
- Nginx (via `kubernetes/ingress-nginx` controller). We recommend `ingress-nginx` v1.1.0 or later, but `echo-server`
@@ -24,6 +33,7 @@ At the moment, it supports 2 configurations:
2433
(by default, named `letsEncrypt-prod`).
2534

2635
In both configurations, it has these common requirements:
36+
- EKS component deployed, with component name specified in `eks_component_name` (defaults to "eks/cluster")
2737
- Kubernetes version 1.19 or later
2838
- Ingress API version `networking.k8s.io/v1`
2939
- [kubernetes-sigs/external-dns](https://github.com/kubernetes-sigs/external-dns)
@@ -43,12 +53,31 @@ a "plan" file.
4353

4454
Use this in the catalog or use these variables to overwrite the catalog values.
4555

56+
Set `ingress_type` to "alb" if using `alb-controller` or "nginx" if using `ingress-nginx`.
57+
58+
Normally, you should not set the IngressClass or IngressGroup, as this component is intended to test the defaults.
59+
However, if you need to, set them in `chart_values`:
60+
```yaml
61+
chart_values:
62+
ingress:
63+
class: "other-ingress-class"
64+
alb:
65+
# IngressGroup is specific to alb-controller
66+
group_name: "other-ingress-group"
67+
```
68+
69+
Note that if you follow recommendations and do not set the ingress class name,
70+
the deployed Ingress will have the ingressClassName setting injected by the
71+
Ingress controller, set to the then-current default. This means that if later
72+
you change the default IngressClass, the Ingress will be NOT be updated to use
73+
the new default. Furthermore, because of limitations in the Helm provider, this
74+
will not be detected as drift. You will need to destroy and re-deploy the
75+
echo server to update the Ingress to the new default.
76+
4677
```yaml
4778
components:
4879
terraform:
49-
eks/echo-server:
50-
metadata:
51-
component: eks/echo-server
80+
echo-server:
5281
settings:
5382
spacelift:
5483
workspace_enabled: true
@@ -63,11 +92,15 @@ components:
6392
atomic: true
6493
cleanup_on_fail: true
6594

66-
ingress_type: "alb"
95+
ingress_type: "alb" # or "nginx"
6796
# %[1]v is the tenant name, %[2]v is the stage name, %[3]v is the region name
6897
hostname_template: "echo.%[3]v.%[2]v.%[1]v.sample-domain.net"
6998
```
7099
100+
In rare cases where some ingress controllers do not support the `ingressClassName` field,
101+
you can restore the old `kubernetes.io/ingress.class` annotation by setting
102+
`ingress.use_ingress_class_annotation: true` in `chart_values`.
103+
71104
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
72105
## Requirements
73106

@@ -88,8 +121,7 @@ components:
88121

89122
| Name | Source | Version |
90123
|------|--------|---------|
91-
| <a name="module_alb"></a> [alb](#module\_alb) | cloudposse/stack-config/yaml//modules/remote-state | 1.5.0 |
92-
| <a name="module_echo_server"></a> [echo\_server](#module\_echo\_server) | cloudposse/helm-release/aws | 0.10.0 |
124+
| <a name="module_echo_server"></a> [echo\_server](#module\_echo\_server) | cloudposse/helm-release/aws | 0.10.1 |
93125
| <a name="module_eks"></a> [eks](#module\_eks) | cloudposse/stack-config/yaml//modules/remote-state | 1.5.0 |
94126
| <a name="module_iam_roles"></a> [iam\_roles](#module\_iam\_roles) | ../../account-map/modules/iam-roles | n/a |
95127
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
@@ -105,7 +137,6 @@ components:
105137
| Name | Description | Type | Default | Required |
106138
|------|-------------|------|---------|:--------:|
107139
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
108-
| <a name="input_alb_controller_ingress_group_component_name"></a> [alb\_controller\_ingress\_group\_component\_name](#input\_alb\_controller\_ingress\_group\_component\_name) | The name of the alb\_controller\_ingress\_group component | `string` | `"eks/alb-controller-ingress-group"` | no |
109140
| <a name="input_atomic"></a> [atomic](#input\_atomic) | If set, installation process purges chart on fail. The wait flag will be set automatically if atomic is used. | `bool` | `true` | no |
110141
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
111142
| <a name="input_chart_values"></a> [chart\_values](#input\_chart\_values) | Addition map values to yamlencode as `helm_release` values. | `any` | `{}` | no |
@@ -154,6 +185,7 @@ components:
154185

155186
| Name | Description |
156187
|------|-------------|
188+
| <a name="output_hostname"></a> [hostname](#output\_hostname) | Hostname of the deployed echo server |
157189
| <a name="output_metadata"></a> [metadata](#output\_metadata) | Block status of the deployed release |
158190
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
159191

src/charts/echo-server/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.3.0
18+
version: 0.4.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.3.0"
24+
appVersion: "0.8.0"

src/charts/echo-server/templates/deployment.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,31 @@ spec:
2424
args:
2525
# Disable the feature that turns the echo server into a file browser on the server (security risk)
2626
- "--enable:file=false"
27+
{{- if eq (printf "%v" .Values.livenessProbeLogging) "false" }}
28+
- "--logs:ignore:ping=true"
29+
{{- end }}
2730
ports:
2831
- name: http
2932
containerPort: 80
3033
protocol: TCP
34+
livenessProbe:
35+
httpGet:
36+
port: http
37+
path: /ping
38+
httpHeaders:
39+
- name: x-echo-code
40+
value: "200"
41+
initialDelaySeconds: 5
42+
periodSeconds: 10
43+
timeoutSeconds: 2
44+
failureThreshold: 3
45+
successThreshold: 1
46+
{{- with index .Values "resources" }}
47+
resources:
48+
limits:
49+
cpu: {{ index . "limits.cpu" | default "50m" }}
50+
memory: {{ index . "limits.memory" | default "128Mi" }}
51+
requests:
52+
cpu: {{ index . "requests.cpu" | default "50m" }}
53+
memory: {{ index . "requests.memory" | default "128Mi" }}
54+
{{- end }}

src/charts/echo-server/templates/ingress.yaml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,42 @@
22
{{- $fullName := include "echo-server.fullname" . -}}
33
{{- $svcName := include "echo-server.name" . -}}
44
{{- $svcPort := .Values.service.port -}}
5-
{{- $nginxTlsEnabled := and (eq (printf "%v" .Values.ingress.nginx.enabled) "true") (eq (printf "%v" .Values.tlsEnabled) "true")}}
5+
{{- $nginxTlsEnabled := and (eq (printf "%v" .Values.ingress.nginx.enabled) "true") (eq (printf "%v" .Values.tlsEnabled) "true") }}
66
apiVersion: networking.k8s.io/v1
77
kind: Ingress
88
metadata:
99
name: {{ $fullName }}
1010
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-
{{- if not .Values.ingress.alb.group_name }}
19-
alb.ingress.kubernetes.io/load-balancer-name: {{ index .Values.ingress.alb "load_balancer_name" | default "k8s-common" }}
20-
{{- end }}
21-
alb.ingress.kubernetes.io/group.name: {{ index .Values.ingress.alb "group_name" | default "common" }}
22-
alb.ingress.kubernetes.io/scheme: {{ index .Values.ingress.alb "scheme" | default "internet-facing" }}
23-
{{- if .Values.ingress.alb.access_logs.enabled }}
24-
alb.ingress.kubernetes.io/load-balancer-attributes: access_logs.s3.enabled=true,access_logs.s3.bucket={{.Values.ingress.alb.access_logs.s3_bucket_name}},access_logs.s3.prefix={{.Values.ingress.alb.access_logs.s3_bucket_prefix}}
25-
{{- end }}
26-
alb.ingress.kubernetes.io/target-type: 'ip'
27-
{{- if eq (printf "%v" .Values.ingress.alb.ssl_redirect.enabled) "true" }}
28-
alb.ingress.kubernetes.io/ssl-redirect: '{{ .Values.ingress.alb.ssl_redirect.port }}'
11+
{{- with and (eq (printf "%v" .Values.ingress.use_ingress_class_annotation) "true") (index .Values.ingress "class") }}
12+
kubernetes.io/ingress.class: {{ . }}
13+
{{- end }}
14+
{{- with and $nginxTlsEnabled (index .Values.ingress.nginx "tls_certificate_cluster_issuer") }}
15+
cert-manager.io/cluster-issuer: {{ . }}
16+
{{- end }}
17+
{{- if eq (printf "%v" .Values.ingress.alb.enabled) "true" }}
18+
alb.ingress.kubernetes.io/healthcheck-path: /ping
19+
{{- with index .Values.ingress.alb "group_name" }}
20+
alb.ingress.kubernetes.io/group.name: {{ . }}
2921
{{- end }}
3022
{{- if eq (printf "%v" .Values.tlsEnabled) "true" }}
3123
alb.ingress.kubernetes.io/backend-protocol: HTTP
32-
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
24+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
3325
{{- else }}
34-
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
26+
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80}]'
3527
{{- end }}
28+
# See https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.5/guide/ingress/annotations/#target-type
29+
alb.ingress.kubernetes.io/target-type: {{ if eq (printf "%v" .Values.service.type) "NodePort" -}} "instance" {{- else -}} "ip" {{- end }}
3630
{{- end }}
3731
labels:
3832
{{- include "echo-server.labels" . | nindent 4 }}
3933
spec:
34+
# If not specified, the Ingress controller will insert the ingressClassName field
35+
# when creating the Ingress resource, setting ingressClassName to the name of the then-default IngressClass.
36+
{{- with and (ne (printf "%v" .Values.ingress.use_ingress_class_annotation) "true") (index .Values.ingress "class") }}
37+
ingressClassName: {{ . }}
38+
{{- end }}
39+
# ALB controller will auto-discover the ACM certificate based on rules[].host
40+
# Nginx needs explicit configuration of location of cert-manager TLS certificate
4041
{{- if $nginxTlsEnabled }}
4142
tls: # < placing a host in the TLS config will indicate a certificate should be created
4243
- hosts:

src/charts/echo-server/values.yaml

Lines changed: 23 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,89 +8,52 @@ image:
88
# image.repository -- https://hub.docker.com/r/ealen/echo-server
99
repository: ealen/echo-server
1010
# image.tag -- https://github.com/Ealenn/Echo-Server/releases
11-
tag: 0.4.2
12-
pullPolicy: Always
11+
tag: 0.8.12
12+
pullPolicy: IfNotPresent
1313

1414
#imagePullSecrets: []
1515
nameOverride: ""
1616
#fullnameOverride: ""
1717

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
3918

4019
service:
4120
type: ClusterIP
4221
port: 80
4322

4423
tlsEnabled: true
24+
# If livenessProbeLogging is false, requests to /ping will not be logged
25+
livenessProbeLogging: false
4526

4627
ingress:
28+
## Allow class to be specified, but use default class (not class named "default") by default
29+
# class: default
30+
31+
# Use deprecated `kubernetes.io/ingress.class` annotation
32+
use_ingress_class_annotation: false
4733
nginx:
4834
# ingress.nginx.enabled -- Enable NGiNX ingress
4935
enabled: false
50-
# annotation values
51-
## kubernetes.io/ingress.class:
52-
class: "nginx"
53-
## cert-manager.io/cluster-issuer:
5436
tls_certificate_cluster_issuer: "letsencrypt-prod"
5537
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-
access_logs:
69-
enabled: false
70-
## s3_bucket_name: "acme-ue2-prod-eks-cluster-alb-access-logs"
71-
s3_bucket_prefix: "echo-server"
38+
enabled: false
39+
## Allow group to be specified, but use default by default
40+
# group_name: common
7241

73-
#resources: {}
74-
# # We usually recommend not to specify default resources and to leave this as a conscious
75-
# # choice for the user. This also increases chances charts run on environments with little
76-
# # resources, such as Minikube. If you do want to specify resources, uncomment the following
77-
# # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
78-
# # limits:
79-
# # cpu: 100m
80-
# # memory: 128Mi
81-
# # requests:
82-
# # cpu: 100m
83-
# # memory: 128Mi
42+
# Do NOT allow SSL redirect to be specified, because that affects other ingresses.
43+
# "Once defined on a single Ingress, it impacts every Ingress within IngressGroup."
44+
# See https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.6/guide/ingress/annotations/#ssl-redirect
45+
46+
resources:
47+
limits:
48+
cpu: 50m
49+
memory: 128Mi
50+
# requests:
51+
# cpu: 50m
52+
# memory: 128Mi
8453

8554
autoscaling:
8655
enabled: false
8756
#minReplicas: 1
8857
#maxReplicas: 100
8958
#targetCPUUtilizationPercentage: 80
9059
#targetMemoryUtilizationPercentage: 80
91-
92-
#nodeSelector: {}
93-
94-
#tolerations: []
95-
96-
#affinity: {}

0 commit comments

Comments
 (0)