Skip to content

Commit 2c479a2

Browse files
authored
[GITOPS-5120] Add e2e test for write-back GIT repository as annotation. (#1068)
Signed-off-by: Denis Karpelevich <[email protected]>
1 parent 44fef15 commit 2c479a2

29 files changed

+1535
-0
lines changed

test/e2e/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ git-container-push: git-container-build
1313
remove-docker-images:
1414
docker rmi $$(docker images | grep $(IMAGE_REPO) | awk '{print $$3}')
1515

16+
remove-k3s-images:
17+
sudo k3s crictl rmi $$(sudo k3s crictl images | grep $(IMAGE_REPO) | awk '{print $$3}')
18+
1619
copy-testdata:
1720
cp -r testdata containers/git
1821

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: 008-simple-helm-app
3+
description: A Helm chart for Kubernetes
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+
appVersion: "1.0"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "helm-guestbook.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "helm-guestbook.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "helm-guestbook.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "helm-guestbook.fullname" . }}
5+
labels:
6+
app: {{ template "helm-guestbook.name" . }}
7+
chart: {{ template "helm-guestbook.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
revisionHistoryLimit: 3
13+
selector:
14+
matchLabels:
15+
app: {{ template "helm-guestbook.name" . }}
16+
release: {{ .Release.Name }}
17+
template:
18+
metadata:
19+
labels:
20+
app: {{ template "helm-guestbook.name" . }}
21+
release: {{ .Release.Name }}
22+
spec:
23+
containers:
24+
- name: {{ .Chart.Name }}
25+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
26+
imagePullPolicy: {{ .Values.image.pullPolicy }}
27+
ports:
28+
- name: http
29+
containerPort: {{ .Values.containerPort }}
30+
protocol: TCP
31+
livenessProbe:
32+
httpGet:
33+
path: /
34+
port: http
35+
readinessProbe:
36+
httpGet:
37+
path: /
38+
port: http
39+
resources:
40+
{{ toYaml .Values.resources | indent 12 }}
41+
{{- with .Values.nodeSelector }}
42+
nodeSelector:
43+
{{ toYaml . | indent 8 }}
44+
{{- end }}
45+
{{- with .Values.affinity }}
46+
affinity:
47+
{{ toYaml . | indent 8 }}
48+
{{- end }}
49+
{{- with .Values.tolerations }}
50+
tolerations:
51+
{{ toYaml . | indent 8 }}
52+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "helm-guestbook.fullname" . }}
5+
labels:
6+
app: {{ template "helm-guestbook.name" . }}
7+
chart: {{ template "helm-guestbook.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
type: {{ .Values.service.type }}
12+
ports:
13+
- port: {{ .Values.service.port }}
14+
targetPort: http
15+
protocol: TCP
16+
name: http
17+
selector:
18+
app: {{ template "helm-guestbook.name" . }}
19+
release: {{ .Release.Name }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Default values for helm-guestbook.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: gcr.io/heptio-images/ks-guestbook-demo
9+
tag: 0.1@sha256:fe18e00a6aeece16b5b2f77a32ee60929e8a60e27c71df8df66bf804f5677f47
10+
pullPolicy: IfNotPresent
11+
12+
containerPort: 80
13+
14+
service:
15+
type: ClusterIP
16+
port: 80
17+
18+
ingress:
19+
enabled: false
20+
annotations: {}
21+
# kubernetes.io/ingress.class: nginx
22+
# kubernetes.io/tls-acme: "true"
23+
path: /
24+
hosts:
25+
- chart-example.local
26+
tls: []
27+
# - secretName: chart-example-tls
28+
# hosts:
29+
# - chart-example.local
30+
31+
resources: {}
32+
# We usually recommend not to specify default resources and to leave this as a conscious
33+
# choice for the user. This also increases chances charts run on environments with little
34+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
35+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
36+
# limits:
37+
# cpu: 100m
38+
# memory: 128Mi
39+
# requests:
40+
# cpu: 100m
41+
# memory: 128Mi
42+
43+
nodeSelector: {}
44+
45+
tolerations: []
46+
47+
affinity: {}
48+
49+
#image:
50+
# repository: 10.42.0.1:30000/test-image
51+
# tag: 1.0.0
52+
# pullPolicy: IfNotPresent
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: image-updater-007
5+
spec:
6+
source:
7+
path: ./001-simple-kustomize-app
8+
repoURL: https://10.42.0.1:30003/testdata.git
9+
targetRevision: master
10+
status:
11+
health:
12+
status: Healthy
13+
sync:
14+
status: Synced
15+
summary:
16+
images:
17+
- 10.42.0.1:30000/test-image:1.0.0
18+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: image-updater-e2e-007
5+
---
6+
apiVersion: argoproj.io/v1alpha1
7+
kind: Application
8+
metadata:
9+
name: image-updater-007
10+
annotations:
11+
argocd-image-updater.argoproj.io/image-list: test=10.42.0.1:30000/test-image:1.X.X
12+
argocd-image-updater.argoproj.io/update-strategy: semver
13+
argocd-image-updater.argoproj.io/force-update: "false"
14+
argocd-image-updater.argoproj.io/write-back-method: git
15+
argocd-image-updater.argoproj.io/write-back-target: kustomization
16+
argocd-image-updater.argoproj.io/git-repository: https://10.42.0.1:30003/testdata.git
17+
finalizers:
18+
- resources-finalizer.argocd.argoproj.io
19+
spec:
20+
project: default
21+
source:
22+
repoURL: https://10.42.0.1:30003/testdata.git
23+
path: ./001-simple-kustomize-app
24+
targetRevision: master
25+
destination:
26+
server: https://kubernetes.default.svc
27+
namespace: image-updater-e2e-007
28+
syncPolicy:
29+
automated: {}
30+
retry:
31+
limit: 2
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: image-updater-007
5+
spec:
6+
source:
7+
path: ./001-simple-kustomize-app
8+
repoURL: https://10.42.0.1:30003/testdata.git
9+
targetRevision: master
10+
status:
11+
health:
12+
status: Healthy
13+
sync:
14+
status: Synced
15+
summary:
16+
images:
17+
- 10.42.0.1:30000/test-image:1.0.2
18+
---
19+
apiVersion: v1
20+
kind: Pod
21+
metadata:
22+
namespace: image-updater-e2e-007
23+
spec:
24+
containers:
25+
- image: 10.42.0.1:30000/test-image:1.0.2

0 commit comments

Comments
 (0)