Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for confidential pods #1971

Merged
merged 7 commits into from
Oct 14, 2024

Conversation

arc9693
Copy link
Contributor

@arc9693 arc9693 commented Jul 10, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:
Kata-cc is a lightweight VM based runtime for containers. As of now, the azurefile-csi-driver’s persistent storage does not work for kata-cc or confidential pods. The file sharing between host and guest is disabled and therefore the SMB mount on host node does not propagate as expected for the pod.
The proposed changes enable the SMB mount inside the guest VM that wraps the confidential pod.

  • to enable Kata Confidential Container mount, you need to specify enableKataCCMount as true in storage class or PV:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: azurefile-csi
provisioner: file.csi.azure.com
allowVolumeExpansion: true
parameters:
  skuName: Premium_LRS
  enableKataCCMount: "true"
reclaimPolicy: Delete
volumeBindingMode: Immediate
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - mfsymlinks
  - cache=strict  # https://linux.die.net/man/8/mount.cifs
  - nosharesock  # reduce probability of reconnect race
  - actimeo=30  # reduce latency for metadata-heavy workload
  - nobrl  # disable sending byte range lock requests to the server and for applications which have challenges with posix locks

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
Copy link

linux-foundation-easycla bot commented Jul 10, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 10, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @arc9693!

It looks like this is your first PR to kubernetes-sigs/azurefile-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/azurefile-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 10, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @arc9693. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 10, 2024
@andyzhangx
Copy link
Member

@arc9693 thanks for the PR, can you sign the cla license first? thx

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 10, 2024
Copy link

@sprt sprt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @arc9693! I left a few comments 🙂

@andyzhangx Do note this is does NOT implement data or secret confidentiality at this point - this is for unblocking the initial use case where customers want to use non-confidential storage inside confidential pods.

pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/azure.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/utils.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 2, 2024
@arc9693 arc9693 changed the title [Draft] Add support for confidential pods Add support for confidential pods Aug 2, 2024
@arc9693 arc9693 marked this pull request as ready for review August 2, 2024 11:06
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 2, 2024
klog.V(2).Infof("NodeStageVolume: mount info for volume %s is already present on %s", volumeID, targetPath)
} else { // if not mounted, save mountInfo.json
mountFsType := cifs
ipAddr, err := net.ResolveIPAddr("ip", server)
Copy link
Contributor Author

@arc9693 arc9693 Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed as of now, because inside a kata-cc pod, the kata agent (using nix:mount rust crate) performs the CIFS mount and it fails with EHOSTUNREACH, even though a command line mount -t cifs succeeds on the same VM.
Kata-agent mount reference: https://github.com/microsoft/kata-containers/blob/386cab09d8c544097f47c60591b283cff2397439/src/agent/src/mount.rs#L107
nix:mount function reference: https://docs.rs/nix/latest/src/nix/mount/linux.rs.html#104-133

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 2, 2024
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
pkg/azurefile/nodeserver.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2024
@andyzhangx
Copy link
Member

/retest

1 similar comment
@arc9693
Copy link
Contributor Author

arc9693 commented Oct 10, 2024

/retest

@andyzhangx
Copy link
Member

could you fix the windows ut failure:

https://github.com/kubernetes-sigs/azurefile-csi-driver/actions/runs/11254288924/job/31298301887?pr=1971

    nodeserver.go:202: Unexpected call to *azurefile.MockDirectVolume.Remove([D:\a\azurefile-csi-driver\azurefile-csi-driver\pkg\azurefile\error_is_likely_target]) at D:/a/azurefile-csi-driver/azurefile-csi-driver/pkg/azurefile/nodeserver.go:202 because: there are no expected calls of the method "Remove" for that receiver
--- FAIL: TestNodeUnpublishVolume (0.00s)

    nodeserver.go:543: Unexpected call to *azurefile.MockDirectVolume.Remove([D:\a\azurefile-csi-driver\azurefile-csi-driver\pkg\azurefile\error_is_likely_target]) at D:/a/azurefile-csi-driver/azurefile-csi-driver/pkg/azurefile/nodeserver.go:543 because: there are no expected calls of the method "Remove" for that receiver
--- FAIL: TestNodeUnstageVolume (0.00s)

@andyzhangx
Copy link
Member

/retest

@andyzhangx
Copy link
Member

/retest

1 similar comment
@andyzhangx
Copy link
Member

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, arc9693

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 14, 2024
@andyzhangx andyzhangx merged commit d039d2b into kubernetes-sigs:master Oct 14, 2024
15 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants