From a3be3daf70c08dc3cb7df47da3ec4a5e755fab5a Mon Sep 17 00:00:00 2001 From: Mike Ng Date: Mon, 14 Mar 2022 16:06:06 -0400 Subject: [PATCH] Add e2e helm repo for future e2e tests (#120) Signed-off-by: Mike Ng --- testhr/e2e/index.yaml | 36 ++++++++ testhr/e2e/ingress-0.1.0.tgz | Bin 0 -> 3752 bytes testhr/e2e/ingress-0.2.0.tgz | Bin 0 -> 3754 bytes testhr/e2e/install-ingress/.helmignore | 23 +++++ testhr/e2e/install-ingress/Chart.yaml | 24 +++++ .../e2e/install-ingress/templates/NOTES.txt | 22 +++++ .../install-ingress/templates/_helpers.tpl | 62 +++++++++++++ .../install-ingress/templates/deployment.yaml | 61 +++++++++++++ testhr/e2e/install-ingress/templates/hpa.yaml | 28 ++++++ .../install-ingress/templates/ingress.yaml | 61 +++++++++++++ .../install-ingress/templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ testhr/e2e/install-ingress/values.yaml | 82 ++++++++++++++++++ testhr/e2e/preinstall-hook-0.1.0.tgz | Bin 0 -> 3885 bytes testhr/e2e/preinstall-hook/.helmignore | 23 +++++ testhr/e2e/preinstall-hook/Chart.yaml | 24 +++++ .../e2e/preinstall-hook/templates/NOTES.txt | 22 +++++ .../preinstall-hook/templates/_helpers.tpl | 62 +++++++++++++ .../preinstall-hook/templates/deployment.yaml | 61 +++++++++++++ testhr/e2e/preinstall-hook/templates/hpa.yaml | 28 ++++++ .../preinstall-hook/templates/ingress.yaml | 61 +++++++++++++ .../preinstall-hook/templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ .../templates/wait-long-job.yaml | 16 ++++ testhr/e2e/preinstall-hook/values.yaml | 82 ++++++++++++++++++ testhr/e2e/upgrade-fail-ingress/.helmignore | 23 +++++ testhr/e2e/upgrade-fail-ingress/Chart.yaml | 24 +++++ .../upgrade-fail-ingress/templates/NOTES.txt | 22 +++++ .../templates/_helpers.tpl | 62 +++++++++++++ .../templates/bad-deployment.yaml | 61 +++++++++++++ .../upgrade-fail-ingress/templates/hpa.yaml | 28 ++++++ .../templates/ingress.yaml | 61 +++++++++++++ .../templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ testhr/e2e/upgrade-fail-ingress/values.yaml | 82 ++++++++++++++++++ 38 files changed, 1267 insertions(+) create mode 100644 testhr/e2e/index.yaml create mode 100644 testhr/e2e/ingress-0.1.0.tgz create mode 100644 testhr/e2e/ingress-0.2.0.tgz create mode 100644 testhr/e2e/install-ingress/.helmignore create mode 100644 testhr/e2e/install-ingress/Chart.yaml create mode 100644 testhr/e2e/install-ingress/templates/NOTES.txt create mode 100644 testhr/e2e/install-ingress/templates/_helpers.tpl create mode 100644 testhr/e2e/install-ingress/templates/deployment.yaml create mode 100644 testhr/e2e/install-ingress/templates/hpa.yaml create mode 100644 testhr/e2e/install-ingress/templates/ingress.yaml create mode 100644 testhr/e2e/install-ingress/templates/service.yaml create mode 100644 testhr/e2e/install-ingress/templates/serviceaccount.yaml create mode 100644 testhr/e2e/install-ingress/templates/tests/test-connection.yaml create mode 100644 testhr/e2e/install-ingress/values.yaml create mode 100644 testhr/e2e/preinstall-hook-0.1.0.tgz create mode 100644 testhr/e2e/preinstall-hook/.helmignore create mode 100644 testhr/e2e/preinstall-hook/Chart.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/NOTES.txt create mode 100644 testhr/e2e/preinstall-hook/templates/_helpers.tpl create mode 100644 testhr/e2e/preinstall-hook/templates/deployment.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/hpa.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/ingress.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/service.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/serviceaccount.yaml create mode 100644 testhr/e2e/preinstall-hook/templates/tests/test-connection.yaml create mode 100755 testhr/e2e/preinstall-hook/templates/wait-long-job.yaml create mode 100644 testhr/e2e/preinstall-hook/values.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/.helmignore create mode 100644 testhr/e2e/upgrade-fail-ingress/Chart.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/NOTES.txt create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/_helpers.tpl create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/bad-deployment.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/hpa.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/ingress.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/service.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/serviceaccount.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/templates/tests/test-connection.yaml create mode 100644 testhr/e2e/upgrade-fail-ingress/values.yaml diff --git a/testhr/e2e/index.yaml b/testhr/e2e/index.yaml new file mode 100644 index 00000000..f2dab1c6 --- /dev/null +++ b/testhr/e2e/index.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +entries: + ingress: + - apiVersion: v2 + appVersion: 1.17.0 + created: "2022-03-14T15:44:53.12252298-04:00" + description: A Helm chart for Kubernetes + digest: 55b60779b46e1f7cab06ee212c65beeca610ec6d84dbdd63f6a38eac990407a5 + name: ingress + type: application + urls: + - ingress-0.2.0.tgz + version: 0.2.0 + - apiVersion: v2 + appVersion: 1.16.0 + created: "2022-03-14T15:44:53.122040505-04:00" + description: A Helm chart for Kubernetes + digest: 36b4d4a27d119125fc6cc437b10f5c2555c14a7142053aa4ab31bd9c94e15dce + name: ingress + type: application + urls: + - ingress-0.1.0.tgz + version: 0.1.0 + preinstall-hook: + - apiVersion: v2 + appVersion: 1.16.0 + created: "2022-03-14T15:44:53.122975416-04:00" + description: A Helm chart for Kubernetes + digest: 8dc2e359f00f93d2f1eac4a01f4659dfc77ba57a7be0e47e786d81d46062f780 + name: preinstall-hook + type: application + urls: + - preinstall-hook-0.1.0.tgz + version: 0.1.0 +generated: "2022-03-14T15:44:53.121401083-04:00" + diff --git a/testhr/e2e/ingress-0.1.0.tgz b/testhr/e2e/ingress-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..6f65c3c9cf11ec1af2a9af6a79696b2e859a3ffe GIT binary patch literal 3752 zcmV;Z4p;FXiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PH;bZ`(MN{aJs-oSP4QTrJCawI`qlH=Pd|= z;BbH6{ttqn`9B!G+s12LqG6hRFR~KwtYwNPh@k5%x-~+knm$VM#)j5@;I4e2-$}6 z^fJK^NRlub5i{9avU#(HgQP^RVl(AN)r%*0vghx?iS+bO!Cm7KQMFm$g)H9SoAR7n7 z4Fok4DT|G~B8fy}>_PSvf|e;-Ku4SlZEdI(E{S9F&+yX#=K+v%YzV6xJO5&aU`Pfr z>6&GLr3!sJ_GAKFXi%tu@HnHzichBa0*C`d6-<$%G!#RsD4$xuxonEH_5j?eU}Tht z_^3gh={v_Ll~gZ}1=o133#upT2Px7dgxw$rjD)*~MI<3(%BZHOoZJCoDU$rT4@d9b z*=LC){=nJtObGqol%ZNGjq{3}Wy+7#so-Wnv->B7GK679ij|+i;7++?mMV?%WMnq0 zkUE4{f#+pfWQHL(su71UAxs&l5hF^S=A!9ZHiP-HI9z=y2Dw(+xutfr2WqDJB(ks# z69)cFC~YY*0x=&#rwe_&Ci8@$&qPF+eGiZjJ58DY7_|AmmMlrXjgiIJGkk;ir; zYXQpAv@C2vG28BNEr20eAZTOhh_Q5$;3}dbb!0^|VU)$#MYG3Kh0=FskuW8Ia-$;( zl_8Z!?!VN^Y#R_9kT0kd+(<~l71c9fRBM)Pt(=q>pweh&(7&ggn&tG3DlSC|v4AVW zYn)W3rQC6=odOER#1-XJ3!PDJhLHHTRN41)gMed%N)fqyVfmLh7nXa3D3xppV@a%R zCK@F?DMkIn&w$QpxkgcvTCJF8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EqIC0% zBd{~Qp4RH6>huOQ)8hI!olnhIlQ^4z_A(hjos0y zQUCK=kvqu$2M0mW&i@~d_wM!oF4~PsdfFGTwxP&}-_TxMla;;In^=pNTfC6{A99eo z`ma%G_jecx&M`6)`X)25RsWy2zW=uy1c&$epF3&2YCREgk1h|kAO6GEwi$e*PIpvv zP?V)Egg76BVDOb*L%a5(C?mL-qpp{sgfPw2YAPly5Zul*BteSO{)mC^`LE7CooOM_dkA?k`^V!m zh^bVbKc{+R|2pzLfBJ_U*}p}{Vm>l|ijQi^M-`wciO#ds{-BNWp8Dz{^`81ua_&9# zbz+`{q;v1-|9B7KBau{O3Qk_VR-T_q@f$|k^J$D^H8lLb-M9O8 U-}>AC1^@v6|5hb4m;h1$01E=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ingress.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/install-ingress/templates/service.yaml b/testhr/e2e/install-ingress/templates/service.yaml new file mode 100644 index 00000000..663622e1 --- /dev/null +++ b/testhr/e2e/install-ingress/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ingress.fullname" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "ingress.selectorLabels" . | nindent 4 }} diff --git a/testhr/e2e/install-ingress/templates/serviceaccount.yaml b/testhr/e2e/install-ingress/templates/serviceaccount.yaml new file mode 100644 index 00000000..761408fc --- /dev/null +++ b/testhr/e2e/install-ingress/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ingress.serviceAccountName" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/install-ingress/templates/tests/test-connection.yaml b/testhr/e2e/install-ingress/templates/tests/test-connection.yaml new file mode 100644 index 00000000..04a68e0d --- /dev/null +++ b/testhr/e2e/install-ingress/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ingress.fullname" . }}-test-connection" + labels: + {{- include "ingress.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ingress.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/testhr/e2e/install-ingress/values.yaml b/testhr/e2e/install-ingress/values.yaml new file mode 100644 index 00000000..f1f0397c --- /dev/null +++ b/testhr/e2e/install-ingress/values.yaml @@ -0,0 +1,82 @@ +# Default values for ingress. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/testhr/e2e/preinstall-hook-0.1.0.tgz b/testhr/e2e/preinstall-hook-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..dfd457fc370c2b919a0c2a4beddedde2fccc99a1 GIT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*=lipAF#px?}tyGuGD{a zM|bxBHpYfdo-$jvW9-^VQ3%+|_*FC2A~r#IvjeDA=Wiqg2~SoysXAogfw}fSP?#=I z9*Hy~62bq^=c8csY!Lbo95p(CgP-yVmd)KiQeC`!_^`h87kPvSbE1C2e1>SV(< zXwCH$#t|>j9@X9I&3pR_&DF%(8Z+bC_=+a+N(e-A+6Hx~|E3-7b01?t^U4 zE>BO{#(%|W+4+j&Qjhxk0VNynnhkvGHo}bwi9aJxx;c?e)^00KyR@pTVVBx^bI~3) zC$sVtfamE1rJG;6!j_Kmu;wKrXPW!TSX1sCX2FP;B1Dv*>@7bBv;FcIIo&B?Drfa z`1QU4z5k&sLd%&l54V@Y6<=<$SS6a%r^{xD6I`IYT@$ii|IY~3119)v@JURrbqm;} z|NHyh?|(dfI=YMhZ)G&~e?oLTuNwgWM@)LGfISh#w;;{Q*hVWeiG$*l)ggVW6Rz1d zw%QvtSWo*3HEt@huNY$HKL+sk!qERv7y4H9&n2G3boz>>R7bGy{pGy+_M@x+f!R7b z<3i$%(byRO?>$-h{io6Xo&Mj(xCdjRHA?rBLT=;XY>pfzIb{juGssB%naogCKLe%m z%-*&^&5<#fF)?wyvXsvrgG5F&U7*eVHl7onc=v$g%>BZ^gG}O-o@3&I^nZI8z#Gn% zAh?}rSb_|t{qd5(3tpUlJk>&?cMpm$t-L=vg@j7w1v9FL_OD~#3nstIq5WGvn9qjh zPx)3Y_^?J~v^~%44_PViQJ~H;?@=%zpS?$cPR(l}>CAidzurA~Pb3w&g5wu2l^0}E ve8O0J0Zot$9k>*qykMbXk>K!eY&P!3-MAZngYka>00960JyD*^09F71NZhaU literal 0 HcmV?d00001 diff --git a/testhr/e2e/preinstall-hook/.helmignore b/testhr/e2e/preinstall-hook/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/testhr/e2e/preinstall-hook/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/testhr/e2e/preinstall-hook/Chart.yaml b/testhr/e2e/preinstall-hook/Chart.yaml new file mode 100644 index 00000000..a2667bca --- /dev/null +++ b/testhr/e2e/preinstall-hook/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: preinstall-hook +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/testhr/e2e/preinstall-hook/templates/NOTES.txt b/testhr/e2e/preinstall-hook/templates/NOTES.txt new file mode 100644 index 00000000..bb55e8d1 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "preinstall-hook.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 "preinstall-hook.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "preinstall-hook.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 "preinstall-hook.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/_helpers.tpl b/testhr/e2e/preinstall-hook/templates/_helpers.tpl new file mode 100644 index 00000000..8191aef5 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "preinstall-hook.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 "preinstall-hook.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 "preinstall-hook.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "preinstall-hook.labels" -}} +helm.sh/chart: {{ include "preinstall-hook.chart" . }} +{{ include "preinstall-hook.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "preinstall-hook.selectorLabels" -}} +app.kubernetes.io/name: {{ include "preinstall-hook.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "preinstall-hook.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "preinstall-hook.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/deployment.yaml b/testhr/e2e/preinstall-hook/templates/deployment.yaml new file mode 100644 index 00000000..3ab4acb2 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "preinstall-hook.fullname" . }} + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "preinstall-hook.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "preinstall-hook.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "preinstall-hook.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/hpa.yaml b/testhr/e2e/preinstall-hook/templates/hpa.yaml new file mode 100644 index 00000000..8cb0b124 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "preinstall-hook.fullname" . }} + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "preinstall-hook.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/ingress.yaml b/testhr/e2e/preinstall-hook/templates/ingress.yaml new file mode 100644 index 00000000..3f241416 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "preinstall-hook.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/service.yaml b/testhr/e2e/preinstall-hook/templates/service.yaml new file mode 100644 index 00000000..e4b3f15c --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "preinstall-hook.fullname" . }} + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "preinstall-hook.selectorLabels" . | nindent 4 }} diff --git a/testhr/e2e/preinstall-hook/templates/serviceaccount.yaml b/testhr/e2e/preinstall-hook/templates/serviceaccount.yaml new file mode 100644 index 00000000..85504b6f --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "preinstall-hook.serviceAccountName" . }} + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/preinstall-hook/templates/tests/test-connection.yaml b/testhr/e2e/preinstall-hook/templates/tests/test-connection.yaml new file mode 100644 index 00000000..d0409a93 --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "preinstall-hook.fullname" . }}-test-connection" + labels: + {{- include "preinstall-hook.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "preinstall-hook.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/testhr/e2e/preinstall-hook/templates/wait-long-job.yaml b/testhr/e2e/preinstall-hook/templates/wait-long-job.yaml new file mode 100755 index 00000000..36245b7e --- /dev/null +++ b/testhr/e2e/preinstall-hook/templates/wait-long-job.yaml @@ -0,0 +1,16 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: long-running-job + annotations: + "helm.sh/hook": pre-install +spec: + template: + spec: + containers: + - name: long-running-job + image: busybox + command: ["sleep", "300"] + restartPolicy: Never + backoffLimit: 4 + diff --git a/testhr/e2e/preinstall-hook/values.yaml b/testhr/e2e/preinstall-hook/values.yaml new file mode 100644 index 00000000..b8d413b4 --- /dev/null +++ b/testhr/e2e/preinstall-hook/values.yaml @@ -0,0 +1,82 @@ +# Default values for preinstall-hook. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/testhr/e2e/upgrade-fail-ingress/.helmignore b/testhr/e2e/upgrade-fail-ingress/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/testhr/e2e/upgrade-fail-ingress/Chart.yaml b/testhr/e2e/upgrade-fail-ingress/Chart.yaml new file mode 100644 index 00000000..425233f9 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ingress +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.2.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.17.0" diff --git a/testhr/e2e/upgrade-fail-ingress/templates/NOTES.txt b/testhr/e2e/upgrade-fail-ingress/templates/NOTES.txt new file mode 100644 index 00000000..aedfa20b --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "ingress.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 "ingress.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ingress.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 "ingress.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/_helpers.tpl b/testhr/e2e/upgrade-fail-ingress/templates/_helpers.tpl new file mode 100644 index 00000000..8c9e045c --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ingress.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 "ingress.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 "ingress.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ingress.labels" -}} +helm.sh/chart: {{ include "ingress.chart" . }} +{{ include "ingress.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ingress.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ingress.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ingress.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ingress.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/bad-deployment.yaml b/testhr/e2e/upgrade-fail-ingress/templates/bad-deployment.yaml new file mode 100644 index 00000000..846b3381 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/bad-deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment1 +metadata: + name: {{ include "ingress.fullname" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ingress.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ingress.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ingress.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/hpa.yaml b/testhr/e2e/upgrade-fail-ingress/templates/hpa.yaml new file mode 100644 index 00000000..80f47490 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "ingress.fullname" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "ingress.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/ingress.yaml b/testhr/e2e/upgrade-fail-ingress/templates/ingress.yaml new file mode 100644 index 00000000..1b27b5a7 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ingress.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ingress.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/service.yaml b/testhr/e2e/upgrade-fail-ingress/templates/service.yaml new file mode 100644 index 00000000..663622e1 --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ingress.fullname" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "ingress.selectorLabels" . | nindent 4 }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/serviceaccount.yaml b/testhr/e2e/upgrade-fail-ingress/templates/serviceaccount.yaml new file mode 100644 index 00000000..761408fc --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ingress.serviceAccountName" . }} + labels: + {{- include "ingress.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/testhr/e2e/upgrade-fail-ingress/templates/tests/test-connection.yaml b/testhr/e2e/upgrade-fail-ingress/templates/tests/test-connection.yaml new file mode 100644 index 00000000..04a68e0d --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ingress.fullname" . }}-test-connection" + labels: + {{- include "ingress.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ingress.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/testhr/e2e/upgrade-fail-ingress/values.yaml b/testhr/e2e/upgrade-fail-ingress/values.yaml new file mode 100644 index 00000000..f1f0397c --- /dev/null +++ b/testhr/e2e/upgrade-fail-ingress/values.yaml @@ -0,0 +1,82 @@ +# Default values for ingress. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}