Skip to content

Commit 720f495

Browse files
authored
Add e2e test for adding configMap to allow defining parameters for SSH client (#873)
Signed-off-by: Cheng Fang <cfang@redhat.com>
1 parent 5403b3e commit 720f495

File tree

7 files changed

+126
-0
lines changed

7 files changed

+126
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: argocd-image-updater-ssh-config
5+
data:
6+
config: |-
7+
Host *
8+
PubkeyAcceptedAlgorithms +ssh-rsa
9+
HostkeyAlgorithms +ssh-rsa
10+
---
11+
apiVersion: apps/v1
12+
kind: Deployment
13+
metadata:
14+
name: argocd-image-updater
15+
spec:
16+
selector:
17+
matchLabels:
18+
app.kubernetes.io/name: argocd-image-updater
19+
template:
20+
spec:
21+
containers:
22+
- name: argocd-image-updater
23+
volumeMounts:
24+
- mountPath: /app/config
25+
name: image-updater-conf
26+
- mountPath: /app/config/ssh
27+
name: ssh-known-hosts
28+
- mountPath: /app/.ssh
29+
name: ssh-config
30+
- mountPath: /tmp
31+
name: tmp
32+
- mountPath: /app/ssh-keys/id_rsa
33+
name: ssh-signing-key
34+
readOnly: true
35+
subPath: sshPrivateKey
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- command: kubectl -n argocd-image-updater-e2e apply -k .
5+
- command: sleep 5
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- command: kubectl -n argocd-image-updater-e2e delete -k .
5+
- command: sleep 5
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
This test case verifies the support for configuring ssh client via the config map `argocd-image-updater-ssh-config`.
2+
3+
This test case performs the following steps:
4+
* kustomize the default argocd-image-updater installation by adding custom ssh config data to the config map `argocd-image-updater-ssh-config`
5+
* install the customized argocd-image-updater to the test cluster
6+
* verify that the customized ssh config (config map and volume mount) are present
7+
* uninstall argocd-image-updater from the test cluster
8+
9+
To run this individual test case,
10+
11+
* make sure both docker daemon and k8s cluster is running
12+
* `cd $HOME/go/src/image-updater/test/e2e`
13+
* `SRC_DIR=$HOME/go/src/image-updater kubectl kuttl test --namespace argocd-image-updater-e2e --timeout 120 --test 103-ssh-client-config`
14+
15+
Test output:
16+
```bash
17+
harness.go:278: Successful connection to cluster at: https://0.0.0.0:58961
18+
harness.go:363: running tests
19+
harness.go:75: going to run test suite with timeout of 120 seconds for each step
20+
harness.go:375: testsuite: ./suite has 8 tests
21+
=== RUN kuttl/harness
22+
=== RUN kuttl/harness/103-ssh-client-config
23+
=== PAUSE kuttl/harness/103-ssh-client-config
24+
=== CONT kuttl/harness/103-ssh-client-config
25+
logger.go:42: 19:47:52 | 103-ssh-client-config/1-install | starting test step 1-install
26+
logger.go:42: 19:47:52 | 103-ssh-client-config/1-install | running command: [kubectl -n argocd-image-updater-e2e apply -k .]
27+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | serviceaccount/argocd-image-updater created
28+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | role.rbac.authorization.k8s.io/argocd-image-updater created
29+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | rolebinding.rbac.authorization.k8s.io/argocd-image-updater created
30+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | configmap/argocd-image-updater-config created
31+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | configmap/argocd-image-updater-ssh-config created
32+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | secret/argocd-image-updater-secret created
33+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | deployment.apps/argocd-image-updater created
34+
logger.go:42: 19:47:53 | 103-ssh-client-config/1-install | running command: [sleep 5]
35+
logger.go:42: 19:47:58 | 103-ssh-client-config/1-install | test step completed 1-install
36+
logger.go:42: 19:47:58 | 103-ssh-client-config/99-delete | starting test step 99-delete
37+
logger.go:42: 19:47:58 | 103-ssh-client-config/99-delete | running command: [kubectl -n argocd-image-updater-e2e delete -k .]
38+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | serviceaccount "argocd-image-updater" deleted
39+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | role.rbac.authorization.k8s.io "argocd-image-updater" deleted
40+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | rolebinding.rbac.authorization.k8s.io "argocd-image-updater" deleted
41+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | configmap "argocd-image-updater-config" deleted
42+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | configmap "argocd-image-updater-ssh-config" deleted
43+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | secret "argocd-image-updater-secret" deleted
44+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | deployment.apps "argocd-image-updater" deleted
45+
logger.go:42: 19:47:59 | 103-ssh-client-config/99-delete | running command: [sleep 5]
46+
logger.go:42: 19:48:04 | 103-ssh-client-config/99-delete | test step completed 99-delete
47+
logger.go:42: 19:48:04 | 103-ssh-client-config | skipping kubernetes event logging
48+
=== NAME kuttl
49+
harness.go:407: run tests finished
50+
harness.go:515: cleaning up
51+
harness.go:572: removing temp folder: ""
52+
--- PASS: kuttl (12.08s)
53+
--- PASS: kuttl/harness (0.00s)
54+
--- PASS: kuttl/harness/103-ssh-client-config (12.07s)
55+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"op": "replace",
4+
"path": "/subjects/0/namespace",
5+
"value": "argocd-image-updater-e2e"
6+
}
7+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Host *
2+
PubkeyAcceptedAlgorithms +ssh-rsa
3+
HostkeyAlgorithms +ssh-rsa
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
resources:
2+
- https://github.com/argoproj-labs/argocd-image-updater/manifests/base?ref=stable
3+
4+
configMapGenerator:
5+
- name: argocd-image-updater-ssh-config
6+
behavior: merge
7+
files:
8+
- config
9+
10+
patches:
11+
- path: clusterrolebinding.json
12+
target:
13+
group: rbac.authorization.k8s.io
14+
version: v1
15+
kind: ClusterRoleBinding
16+
name: argocd-image-updater

0 commit comments

Comments
 (0)