Skip to content

Commit 5eac361

Browse files
committed
kuttl integration test
Run an e2e test with ephemeral kind cluster. Usage: REGISTRY=<docker-registry> make e2e-test Signed-off-by: Leonardo Milleri <[email protected]>
1 parent 3331769 commit 5eac361

22 files changed

+214
-0
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
172172
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
173173
$(KUSTOMIZE) build config/default > dist/install.yaml
174174

175+
# Run sample attestation in a kind cluster
176+
# pre-requirements: k8s kuttl plugin installed
177+
# you can change the trustee image by defining the env variable KBS_IMAGE_NAME
178+
# Usage: REGISTRY=<user-registry> KBS_IMAGE_NAME=<trustee-image> make e2e-test
179+
.PHONY: e2e-test
180+
e2e-test:
181+
@[ "${REGISTRY}" ] || ( echo ">> REGISTRY is not set. Usage: REGISTRY=<user-registry> make e2e-test"; exit 1 )
182+
kubectl kuttl test
183+
175184
##@ Build Dependencies
176185

177186
## Location to install dependencies to

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,18 @@ which provide a reconcile function responsible for synchronizing resources until
312312

313313
**NOTE:** You can also run this in one step by running: `make install run`
314314

315+
### Integration tests
316+
317+
An attestation with the sample-attester is performed in an ephemeral kind cluster
318+
Pre-requirements:
319+
- k8s kuttl plugin installed
320+
321+
Optional: set the env variable KBS_IMAGE_NAME to override the default trustee image
322+
323+
```sh
324+
REGISTRY=<docker-registry> make e2e-test
325+
```
326+
315327
### Modifying the API definitions
316328

317329
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:

kuttl-test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestSuite
3+
startKIND: true
4+
testDirs:
5+
- tests/e2e/
6+
timeout: 120
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: trustee-operator-controller-manager
5+
namespace: trustee-operator-system
6+
status:
7+
readyReplicas: 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- command: ./install-operator.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: kbs-auth-public-key
5+
namespace: trustee-operator-system
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- command: ./create-auth-secret.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: kbsres1
5+
namespace: trustee-operator-system
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- command: ./create-other-secret.sh
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: kbs-config
5+
namespace: trustee-operator-system
6+
data:
7+
kbs-config.json: |
8+
{
9+
"insecure_http" : true,
10+
"sockets": ["0.0.0.0:8080"],
11+
"auth_public_key": "/etc/auth-secret/publicKey",
12+
"attestation_token_config": {
13+
"attestation_token_type": "CoCo"
14+
},
15+
"repository_config": {
16+
"type": "LocalFs",
17+
"dir_path": "/opt/confidential-containers/kbs/repository"
18+
},
19+
"as_config": {
20+
"work_dir": "/opt/confidential-containers/attestation-service",
21+
"policy_engine": "opa",
22+
"attestation_token_broker": "Simple",
23+
"attestation_token_config": {
24+
"duration_min": 5
25+
},
26+
"rvps_config": {
27+
"store_type": "LocalJson",
28+
"store_config": {
29+
"file_path": "/opt/confidential-containers/rvps/reference-values/reference-values.json"
30+
}
31+
}
32+
},
33+
"policy_engine_config": {
34+
"policy_path": "/opt/confidential-containers/opa/policy.rego"
35+
}
36+
}

0 commit comments

Comments
 (0)