Skip to content

Commit bc4c15f

Browse files
chore: Helm test cases for custom domains (#1976)
* add folder structure for helm test cases * update test cases to include helm test-app * fix cluster config * changes * fix additional namespaces * fix pull secrets * rollback files that shouldnt have changed * create additional redis-app for v1beta1 deploys * add new helm charts * use custom domain instead of proxy.replicated.com * bump timeout for validateAppClusterReady * bump validateApp timeout * revert changes to operator defaults * fix missing sdk image for airgap * ensure labels are passed for legacy dr * remove placeholders and hardcode custom domains * remove unused sdk block from redis chart value override * remove usage of anonymous proxy within apps * Update e2e/kots-release-upgrade/restore.yaml Co-authored-by: Andrew Lavery <[email protected]> * fix global labels template * fix helper template for labels * revert changes to operator * use google artifact images instead of dockerhub * remove operator changes * add global labels to default values for redis * fix missing labels for legacy dr --------- Co-authored-by: Andrew Lavery <[email protected]>
1 parent 3aec255 commit bc4c15f

File tree

77 files changed

+1407
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1407
-39
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ hack/release
2727

2828
# Test binary, built with `go test -c`
2929
*.test
30+
31+
# helm charts dependencies
32+
*.tgz

e2e/helm-charts/nginx-app/.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/

e2e/helm-charts/nginx-app/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: replicated
3+
repository: oci://registry.replicated.com/library
4+
version: 1.2.0
5+
digest: sha256:e33bd5648e92533a9e0e43c0db252bc73da453cd59e643baa654b419ee3966b5
6+
generated: "2025-03-17T11:44:40.543758-04:00"

e2e/helm-charts/nginx-app/Chart.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v2
2+
name: nginx-app
3+
description: A Helm chart for nginx-app
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.1.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: "1.0.0"
25+
26+
dependencies:
27+
- name: replicated
28+
version: "^1.2.0"
29+
repository: "oci://registry.replicated.com/library"
30+
condition: replicated.enabled
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Thank you for installing {{ .Chart.Name }}.
2+
3+
Your release is named {{ .Release.Name }}.
4+
5+
## Nginx Server Component
6+
7+
The Nginx server has been deployed with the following configuration:
8+
- Replicas: {{ .Values.server.replicaCount }}
9+
- Image: {{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}
10+
- Port: {{ .Values.server.service.port }}
11+
12+
To connect to your Nginx server:
13+
14+
1. Get the Nginx service endpoint:
15+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nginx-app.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=server" -o jsonpath="{.items[0].metadata.name}")
16+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.server.service.port }}:{{ .Values.server.service.port }}
17+
18+
2. Connect to Nginx using curl:
19+
curl http://127.0.0.1:{{ .Values.server.service.port }}
20+
21+
## Client Component
22+
23+
{{- if .Values.client.enabled }}
24+
A curl client has been configured to make periodic requests to the server:
25+
- Image: {{ .Values.client.image.repository }}:{{ .Values.client.image.tag }}
26+
- Interval: {{ .Values.client.intervalSeconds }} seconds
27+
28+
To view the client's test operations:
29+
30+
1. View the client logs:
31+
kubectl logs --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=client" -f
32+
33+
2. The client is performing these operations every {{ .Values.client.intervalSeconds }} seconds:
34+
- Making HTTP requests to the Nginx server
35+
- Displaying the response
36+
{{- else }}
37+
The client component is disabled. To enable it, set .Values.client.enabled=true
38+
{{- end }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "nginx-app.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 "nginx-app.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 "nginx-app.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "nginx-app.labels" -}}
37+
helm.sh/chart: {{ include "nginx-app.chart" . }}
38+
{{ include "nginx-app.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- if and .Values.global .Values.global.labels (not (empty .Values.global.labels)) }}
44+
{{- toYaml .Values.global.labels | nindent 0 }}
45+
{{- end }}
46+
{{- end }}
47+
48+
{{/*
49+
Selector labels
50+
*/}}
51+
{{- define "nginx-app.selectorLabels" -}}
52+
app.kubernetes.io/name: {{ include "nginx-app.name" . }}
53+
app.kubernetes.io/instance: {{ .Release.Name }}
54+
{{- end }}
55+
56+
{{/*
57+
Create the name of the service account to use
58+
*/}}
59+
{{- define "nginx-app.serviceAccountName" -}}
60+
{{- if .Values.serviceAccount.create }}
61+
{{- default (include "nginx-app.fullname" .) .Values.serviceAccount.name }}
62+
{{- else }}
63+
{{- default "default" .Values.serviceAccount.name }}
64+
{{- end }}
65+
{{- end }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{- if .Values.client.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "nginx-app.fullname" . }}-client
6+
labels:
7+
{{- include "nginx-app.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: client
9+
spec:
10+
replicas: {{ .Values.client.replicaCount }}
11+
selector:
12+
matchLabels:
13+
{{- include "nginx-app.selectorLabels" . | nindent 6 }}
14+
app.kubernetes.io/component: client
15+
template:
16+
metadata:
17+
labels:
18+
{{- include "nginx-app.selectorLabels" . | nindent 8 }}
19+
app.kubernetes.io/component: client
20+
spec:
21+
{{- if .Values.client.imagePullSecrets }}
22+
imagePullSecrets:
23+
{{- if .Values.client.imagePullSecrets }}
24+
{{- toYaml .Values.client.imagePullSecrets | nindent 8 }}
25+
{{- end }}
26+
{{- end }}
27+
serviceAccountName: {{ include "nginx-app.serviceAccountName" . }}
28+
securityContext:
29+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
containers:
31+
- name: {{ .Chart.Name }}-client
32+
image: "{{ .Values.client.image.repository }}:{{ .Values.client.image.tag | default .Chart.AppVersion }}"
33+
imagePullPolicy: {{ .Values.client.image.pullPolicy }}
34+
env:
35+
- name: SERVER_HOST
36+
value: {{ include "nginx-app.fullname" . }}
37+
- name: SERVER_SERVICE_PORT
38+
value: "{{ .Values.server.service.port }}"
39+
- name: INTERVAL_SECONDS
40+
value: "{{ .Values.client.intervalSeconds }}"
41+
command:
42+
- "/bin/sh"
43+
- "-c"
44+
- |
45+
while true; do
46+
echo "$(date) - Making request to http://${SERVER_HOST}:${SERVER_SERVICE_PORT}/"
47+
curl -s http://${SERVER_HOST}:${SERVER_SERVICE_PORT}/
48+
echo ""
49+
echo "Sleeping for ${INTERVAL_SECONDS} seconds..."
50+
sleep ${INTERVAL_SECONDS}
51+
done
52+
resources:
53+
{{- toYaml .Values.client.resources | nindent 10 }}
54+
{{- with .Values.nodeSelector }}
55+
nodeSelector:
56+
{{- toYaml . | nindent 8 }}
57+
{{- end }}
58+
{{- with .Values.affinity }}
59+
affinity:
60+
{{- toYaml . | nindent 8 }}
61+
{{- end }}
62+
{{- with .Values.tolerations }}
63+
tolerations:
64+
{{- toYaml . | nindent 8 }}
65+
{{- end }}
66+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "nginx-app.fullname" . }}-config
5+
labels:
6+
{{- include "nginx-app.labels" . | nindent 4 }}
7+
data:
8+
index.html: |
9+
<!DOCTYPE html>
10+
<html>
11+
<head>
12+
<title>Welcome to Nginx</title>
13+
</head>
14+
<body>
15+
<h1>Welcome to Nginx!</h1>
16+
<p>This is a test page served by Nginx.</p>
17+
</body>
18+
</html>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "nginx-app.fullname" . }}
5+
labels:
6+
{{- include "nginx-app.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: server
8+
spec:
9+
{{- if not .Values.autoscaling.enabled }}
10+
replicas: {{ .Values.server.replicaCount }}
11+
{{- end }}
12+
selector:
13+
matchLabels:
14+
{{- include "nginx-app.selectorLabels" . | nindent 6 }}
15+
app.kubernetes.io/component: server
16+
template:
17+
metadata:
18+
{{- with .Values.podAnnotations }}
19+
annotations:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
labels:
23+
{{- include "nginx-app.selectorLabels" . | nindent 8 }}
24+
app.kubernetes.io/component: server
25+
spec:
26+
{{- if .Values.server.imagePullSecrets }}
27+
imagePullSecrets:
28+
{{- if .Values.server.imagePullSecrets }}
29+
{{- toYaml .Values.server.imagePullSecrets | nindent 8 }}
30+
{{- end }}
31+
{{- end }}
32+
serviceAccountName: {{ include "nginx-app.serviceAccountName" . }}
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
containers:
36+
- name: {{ .Chart.Name }}
37+
securityContext:
38+
{{- toYaml .Values.securityContext | nindent 12 }}
39+
image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag | default .Chart.AppVersion }}"
40+
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
41+
ports:
42+
- name: http
43+
containerPort: {{ .Values.server.service.port }}
44+
protocol: TCP
45+
livenessProbe:
46+
httpGet:
47+
path: /
48+
port: http
49+
readinessProbe:
50+
httpGet:
51+
path: /
52+
port: http
53+
resources:
54+
{{- toYaml .Values.server.resources | nindent 12 }}
55+
volumeMounts:
56+
- name: {{ include "nginx-app.fullname" . }}-config
57+
mountPath: /usr/share/nginx/html/index.html
58+
subPath: index.html
59+
volumes:
60+
- name: {{ include "nginx-app.fullname" . }}-config
61+
configMap:
62+
name: {{ include "nginx-app.fullname" . }}-config
63+
{{- with .Values.nodeSelector }}
64+
nodeSelector:
65+
{{- toYaml . | nindent 8 }}
66+
{{- end }}
67+
{{- with .Values.affinity }}
68+
affinity:
69+
{{- toYaml . | nindent 8 }}
70+
{{- end }}
71+
{{- with .Values.tolerations }}
72+
tolerations:
73+
{{- toYaml . | nindent 8 }}
74+
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "nginx-app.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "nginx-app.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}

0 commit comments

Comments
 (0)