forked from confidential-containers/trustee-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run an e2e test with ephemeral kind cluster. Usage: REGISTRY=<docker-registry> make e2e-test Signed-off-by: Leonardo Milleri <[email protected]>
- Loading branch information
Showing
22 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestSuite | ||
startKIND: true | ||
testDirs: | ||
- tests/e2e/ | ||
timeout: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: trustee-operator-controller-manager | ||
namespace: trustee-operator-system | ||
status: | ||
readyReplicas: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: ./install-operator.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: kbs-auth-public-key | ||
namespace: trustee-operator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: ./create-auth-secret.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: kbsres1 | ||
namespace: trustee-operator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: ./create-other-secret.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: kbs-config | ||
namespace: trustee-operator-system | ||
data: | ||
kbs-config.json: | | ||
{ | ||
"insecure_http" : true, | ||
"sockets": ["0.0.0.0:8080"], | ||
"auth_public_key": "/etc/auth-secret/publicKey", | ||
"attestation_token_config": { | ||
"attestation_token_type": "CoCo" | ||
}, | ||
"repository_config": { | ||
"type": "LocalFs", | ||
"dir_path": "/opt/confidential-containers/kbs/repository" | ||
}, | ||
"as_config": { | ||
"work_dir": "/opt/confidential-containers/attestation-service", | ||
"policy_engine": "opa", | ||
"attestation_token_broker": "Simple", | ||
"attestation_token_config": { | ||
"duration_min": 5 | ||
}, | ||
"rvps_config": { | ||
"store_type": "LocalJson", | ||
"store_config": { | ||
"file_path": "/opt/confidential-containers/rvps/reference-values/reference-values.json" | ||
} | ||
} | ||
}, | ||
"policy_engine_config": { | ||
"policy_path": "/opt/confidential-containers/opa/policy.rego" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: resource-policy | ||
namespace: trustee-operator-system | ||
data: | ||
policy.rego: | | ||
package policy | ||
default allow = false | ||
allow { | ||
input["tcb-status"]["sample.svn"] == "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: rvps-reference-values | ||
namespace: trustee-operator-system | ||
data: | ||
reference-values.json: | | ||
[ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: trustee-deployment | ||
namespace: trustee-operator-system | ||
status: | ||
readyReplicas: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: confidentialcontainers.org/v1alpha1 | ||
kind: KbsConfig | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: kbsconfig | ||
app.kubernetes.io/instance: kbsconfig-sample | ||
app.kubernetes.io/part-of: trustee-operator | ||
app.kubernetes.io/managed-by: kustomize | ||
app.kubernetes.io/created-by: trustee-operator | ||
name: kbsconfig-sample | ||
namespace: trustee-operator-system | ||
spec: | ||
kbsConfigMapName: kbs-config | ||
kbsAuthSecretName: kbs-auth-public-key | ||
kbsDeploymentType: AllInOneDeployment | ||
kbsRvpsRefValuesConfigMapName: rvps-reference-values | ||
kbsResourcePolicyConfigMapName: resource-policy | ||
kbsSecretResources: | ||
- "kbsres1" | ||
KbsEnvVars: | ||
RUST_LOG: debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: kbs-client | ||
namespace: trustee-operator-system | ||
status: | ||
containerStatuses: | ||
- ready: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: kbs-client | ||
namespace: trustee-operator-system | ||
spec: | ||
containers: | ||
- name: kbs-client | ||
image: quay.io/confidential-containers/kbs-client:v0.9.0 | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- sleep | ||
- "360000" | ||
env: | ||
- name: RUST_LOG | ||
value: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: trustee-secret | ||
namespace: trustee-operator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: ./get-secret.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
openssl genpkey -algorithm ed25519 > privateKey | ||
openssl pkey -in privateKey -pubout -out publicKey | ||
kubectl create secret generic kbs-auth-public-key --from-file=publicKey -n trustee-operator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
kubectl create secret generic kbsres1 --from-literal key1=res1val1 --from-literal key2=res1val2 -n trustee-operator-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
SECRET="$(kubectl exec -it -n trustee-operator-system kbs-client -- kbs-client --url http://kbs-service:8080 get-resource --path default/kbsres1/key1)" | ||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "Error when retrieving the secret" | ||
else | ||
echo "Attestation completed successfully: secret="$SECRET | ||
# this secret is created only to check the secret retrieval has been successful | ||
kubectl create secret generic trustee-secret --from-literal key1=$SECRET -n trustee-operator-system | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
KBS_IMAGE_NAME="${KBS_IMAGE_NAME:-quay.io/confidential-containers/trustee:290fd0eb64ab20f50efbd27cf80542851c0ee17f}" | ||
export IMG=${REGISTRY}/trustee-operator:test | ||
|
||
pushd ../../.. | ||
|
||
pushd config/manager | ||
kustomize edit set image controller=$IMG | ||
kustomize edit add patch --patch "- op: replace | ||
path: '/spec/template/spec/containers/0/env/1' | ||
value: | ||
name: KBS_IMAGE_NAME | ||
value: ${KBS_IMAGE_NAME}" --kind Deployment --name controller-manager | ||
popd | ||
make docker-build docker-push | ||
make build-installer | ||
kubectl apply -f dist/install.yaml | ||
|
||
popd |