-
Notifications
You must be signed in to change notification settings - Fork 196
Conversation
lib/common.bash
Outdated
) | ||
if [[ -z "${measurement}" ]]; then return 1; fi | ||
echo ${measurement} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No newline at EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments.
There may be some more code that could be shared with the non-tee tests, but I'm not sure it's worth getting into that given the impending merge and certain organizational issues with the tests.
I'm not very familiar with the stuff in .ci
. Hopefully somoene else can help review those changes.
We will also need a new case in tests_runner.sh
in the operator repo.
lib/common.bash
Outdated
# Delete all data with 'id = 10' | ||
mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${kbs_db_host} -D ${KBS_DB} <<EOF | ||
DELETE FROM secrets WHERE id = 10; | ||
DELETE FROM keysets WHERE id = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't really have anything relating to keyses in the code anymore. I guess deleting them is fine as a precaution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/common.bash
Outdated
|
||
NAME="${name}" IMAGE="${image}" RUNTIMECLASS="${RUNTIMECLASS}" \ | ||
KBS_URI="${kbs_ip}:44444" \ | ||
POLICY="${policy}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the policy
and kbs_uri
via annoation is not supported for SNP. The annotations will just be ignored so it isn't too bad, but this function isn't quite as general as it might seem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
docker-compose \ | ||
cpuid | ||
pip install sev-snp-measure | ||
"${TESTS_REPO_DIR}/.ci/install_yq.sh" >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all of these are required currently. I don't think we use cpuid
yet, for instance, since we don't calculate launch measurement. On the other hand maybe we should make these deps generic and move them to the common file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of maintaining the packages to be installed in the script that needs them. I added these packages in anticipation for when attestation tests would be added, but for now I've trimmed them down to what's required.
lib/common.bash
Outdated
# Extract name from the file name | ||
local name=$(basename "${service_yaml%.*}") | ||
|
||
# Default policy is 3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for SEV. SNP policies have different layout, but they don't get set here anyway (see below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved by other fix from above.
6de094d
to
b258a59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one little note.
Also, I think the lib code is probably in the wrong place, but I'm not sure what the optimal location is.
local initrd_path="$(esudo /opt/confidential-containers/bin/kata-runtime \ | ||
--config ${SEV_CONFIG} kata-env --json | jq -r .Initrd.Path)" | ||
# Set the annotations for the simple-kbs URI and policy in the encrypted service yaml | ||
encrypted_yaml_set_kbs_annotations() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be used for unencrypted images as well. It might be best to just have a yaml generation function for SEV and one for SNP. That is currently the fundamental difference in what annotations are available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any annotations we need to apply for the unencrypted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The policy annotation is totally separate from whether the image is encrypted or not. The policy enables SEV-ES. It is totally valid to use -ES with an unencrypted image. The KBS URI isn't directly tied to encryption either, actually. You need to set that for signed images as well. So none of the annotations are directly related to whether the image is encrypted. That is determined by the format of the image itself. SEV and SNP do have different annotations as of today, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Check it out now. I think this way might be better. Created a k8s_yaml_set_annotation
method in common.bash and removed the specific method from sev.bats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New approach is good.
b258a59
to
4f77038
Compare
4f77038
to
af9a990
Compare
ec9ff8b
to
a08386a
Compare
/test |
f093a53
to
a77e884
Compare
510d263
to
d1ff5fe
Compare
/test-sev |
/test |
1 similar comment
/test |
df90192
to
86c6947
Compare
common methods from sev.bats moved into common.bash service.yaml.in generalized Signed-Off-By: Ryan Savino <[email protected]> Signed-Off-By: Unmesh Deodhar <[email protected]>
27920f1
to
2afc4b9
Compare
Thanks @wainersm for the review. I have addressed all your comments. Please let me know if this looks good now. |
/test |
2afc4b9
to
3ca8bed
Compare
@@ -50,7 +50,7 @@ create_test_pod() { | |||
|
|||
echo "Create the test sandbox" | |||
echo "Pod config is: $pod_config" | |||
kubernetes_create_cc_pod $pod_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @UnmeshDeodhar , I prefer the other way around: change the name of the functions that you are introducing on this PR to Kubernetes_
, and leave the existing non-snp tests untouched. I want to avoid any regressions on the exsiting tests at this point :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed all the functions back to kubernetes_*
.ci/install_qemu_experimental.sh
Outdated
@@ -26,7 +27,11 @@ qemu_experimental_latest_build_url="${jenkins_url}/job/qemu-experimental-nightly | |||
bindir="${DESTDIR:-}/usr/bin" | |||
libexecdir="${DESTDIR:-}/usr/libexec/" | |||
|
|||
QEMU_PATH="/opt/kata/bin/qemu-system-x86_64-experimental" | |||
if [ "${KATA_BUILD_QEMU_TYPE}" == "snp" ]; then | |||
QEMU_PATH="/opt/confidential-containers/bin/qemu-system-x86_64-snp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a VM where I ran this script I got the qemu for snp installed with another name:
$ crudini --get /opt/confidential-containers/share/defaults/kata-containers/configuration-qemu-snp.toml hypervisor.qemu path
"/opt/confidential-containers/bin/qemu-system-x86_64-snp-experimental"
$ ls /opt/confidential-containers/bin/
containerd-shim-kata-v2 kata-collect-data.sh kata-monitor kata-runtime qemu-system-x86_64-snp-experimental
Maybe some code on this install_qemu_experimental.sh script is bogus?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @wainersm.
I have removed the bogus code in build_qemu_experimental.sh
3ca8bed
to
7c24bef
Compare
945d408
to
6487c74
Compare
added makefile target as well Fixes: kata-containers#5593 Signed-Off-By: Ryan Savino <[email protected]> Signed-Off-By: Unmesh Deodhar <[email protected]>
Fixes: kata-containers#5593 Signed-off-by: Unmesh Deodhar <[email protected]>
Fixes: kata-containers#5593 Signed-Off-By: Unmesh Deodhar <[email protected]>
SNP requires generic OVMF. Thus adding a code that builds generic OVMF. Fixes: kata-containers#5593 Signed-off-by: Unmesh Deodhar <[email protected]>
Using pod annotation instead of changing the config file. Fixes: kata-containers#5593 Signed-Off-By: Unmesh Deodhar <[email protected]>
Renaming k8s_* functions to kubernetes_* to match the rest of the functions. Fixes: kata-containers#5593 Signed-Off-By: Unmesh Deodhar <[email protected]>
6487c74
to
280e0f2
Compare
/test |
1 similar comment
/test |
Last week there was some discussion about organizing this PR in a way that is easier to review or possibly splitting it into multiple. At this point I'm not really sure what would be most efficient, but let me make a few notes to help anyone who looks at this.
|
I see that in http://jenkins.katacontainers.io/job/tests-CCv0-ubuntu-20.04_snp-x86_64-CC_SNP_CRI_CONTAINERD_K8S-PR/64/consoleFull the SNP test introduced on this PR ran fine:
BTW, that job was manually created just to test this PR. It will be automatically created again once we get kata-containers/ci#547 merged (which depends on this PR). One last thing before we merge this.... the TDX job failed. @fidencio could you please tell us the failure is related with this PR (or not)? |
/test-tdx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UnmeshDeodhar @ryansavino I think it can be merged now. Any improvement and fixes made to follow up PRs. Thanks!
Fixes: #5593
added makefile target as well
moved common functions out of sev.bats
few minor fixes in separate commits
Signed-Off-By: Ryan Savino [email protected]