Skip to content

Commit 2a84e5e

Browse files
committed
Fernet rotation kuttl tests
1 parent 97bc6aa commit 2a84e5e

File tree

11 files changed

+97
-0
lines changed

11 files changed

+97
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -euxo pipefail
3+
4+
alias openstack="oc exec -tn $NAMESPACE openstackclient -- openstack"
5+
6+
export OS_TOKEN=$(openstack token issue -f value -c id)
7+
8+
echo $OS_TOKEN > /tmp/temporary_test_token
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -euxo pipefail
3+
4+
export OS_TOKEN=$(cat /tmp/temporary_test_token)
5+
6+
alias openstack="oc exec -tn $NAMESPACE openstackclient -- env OS_TOKEN=$OS_TOKEN openstack --os-auth-type token "
7+
8+
openstack endpoint list > /dev/null
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../common/assert_sample_deployment.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../common/keystoneapi_deploy.yaml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# create a test token, save it in /tmp/
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
commands:
5+
- script: $KEYSTONE_KUTTL_DIR/../common/scripts/create_test_token.sh
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
annotations:
5+
openshift.io/scc: anyuid
6+
labels:
7+
app: openstackclient
8+
name: openstackclient
9+
spec:
10+
containers:
11+
- args:
12+
- --single-child
13+
- --
14+
- /bin/bash
15+
- -c
16+
- /bin/sleep infinity
17+
command:
18+
- /bin/dumb-init
19+
env:
20+
- name: OS_CLOUD
21+
value: default
22+
imagePullPolicy: IfNotPresent
23+
name: openstackclient
24+
resources: {}
25+
securityContext:
26+
capabilities:
27+
drop:
28+
- ALL
29+
runAsGroup: 42401
30+
runAsNonRoot: true
31+
runAsUser: 42401
32+
allowPrivilegeEscalation: false
33+
seccompProfile:
34+
type: RuntimeDefault
35+
terminationMessagePath: /dev/termination-log
36+
terminationMessagePolicy: File
37+
volumeMounts:
38+
- mountPath: /etc/openstack/clouds.yaml
39+
name: openstack-config
40+
subPath: clouds.yaml
41+
- mountPath: /etc/openstack/secure.yaml
42+
name: openstack-config-secret
43+
subPath: secure.yaml
44+
dnsPolicy: ClusterFirst
45+
enableServiceLinks: true
46+
volumes:
47+
- configMap:
48+
defaultMode: 420
49+
name: openstack-config
50+
name: openstack-config
51+
- name: openstack-config-secret
52+
secret:
53+
defaultMode: 420
54+
secretName: openstack-config-secret
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# validate that token saved in previous step works
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
namespaced: true
5+
commands:
6+
- script: $KEYSTONE_KUTTL_DIR/../common/scripts/validate_test_token.sh
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+
- script: |
5+
oc create -n $NAMESPACE job --from cronjob/keystone-fernet-cronjob rotation-job-test1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# check job executed successfully
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
namespaced: true
5+
commands:
6+
- script: |
7+
oc wait -n $NAMESPACE --for=condition=complete --timeout=30s job/rotation-job-test1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../common/cleanup-keystone.yaml

0 commit comments

Comments
 (0)