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

azurefile: kata/kata-cc: add kata node conditional #2346

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

arc9693
Copy link
Contributor

@arc9693 arc9693 commented Jan 17, 2025

What type of PR is this?
/kind feature

What this PR does / why we need it:
New Volumes: AzureFile CSI volumes created after enabling ConfPods are functional and shared across new Confidential and Non confidential Pods as expected.
Existing Volumes: Volumes created earlier for runc or Kata containers cannot be leveraged by Confidential Pods.

  • This PR adds support for reusing volumes created with runc or kata runtime for kata-cc runtime pods
  • This PR removes storage class parameter check enableKataCCMount and instead relies on node labels to get the info
  • This PR adds support for an additional runtime - kata - which is similar to kata-cc as it creates vm isolated pods.

Which issue(s) this PR fixes:

Fixes #
Related ADO bugs: https://microsoft.visualstudio.com/OS/_workitems/edit/55326325/, https://microsoft.visualstudio.com/OS/_workitems/edit/56384073/

Requirements:

Special notes for your reviewer:

Release note:

- adds support for migration of volumes from non-conf to conf pods
- adds support for kata-sandboxing using cifs mounts inside VMs

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 17, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: arc9693
Once this PR has been reviewed and has the lgtm label, please assign andyzhangx for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 17, 2025
@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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 17, 2025
@arc9693 arc9693 force-pushed the archana1/removeparam branch from b602c0f to aab21e8 Compare January 17, 2025 12:03
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 17, 2025
@arc9693
Copy link
Contributor Author

arc9693 commented Jan 22, 2025

To do for ready to be reviewed:

  • Remove storage class param for enableKataCCMount everywhere
  • Update examples and yaml configs, and built driver
  • Update and Check tests

@arc9693 arc9693 changed the title azurefile: kata-cc: add confidential node conditional [WIP] azurefile: kata-cc: add confidential node conditional Feb 26, 2025
@sprt
Copy link

sprt commented Feb 26, 2025

Also to support vanilla Kata

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2025
@arc9693 arc9693 force-pushed the archana1/removeparam branch from aab21e8 to 6ff0679 Compare March 13, 2025 09:21
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 13, 2025
@arc9693 arc9693 marked this pull request as ready for review March 13, 2025 09:36
@k8s-ci-robot k8s-ci-robot requested a review from ZeroMagic March 13, 2025 09:37
@arc9693 arc9693 changed the title [WIP] azurefile: kata-cc: add confidential node conditional azurefile: kata/kata-cc: add katanode conditional Mar 13, 2025
@arc9693 arc9693 changed the title azurefile: kata/kata-cc: add katanode conditional azurefile: kata/kata-cc: add kata node conditional Mar 13, 2025
@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 Mar 13, 2025
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

@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 Mar 13, 2025
@arc9693 arc9693 force-pushed the archana1/removeparam branch from a7aee7d to bebaae9 Compare March 19, 2025 13:46
@k8s-ci-robot
Copy link
Contributor

@arc9693: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-azurefile-csi-driver-e2e-capz bebaae9 link true /test pull-azurefile-csi-driver-e2e-capz

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

}

func isKataNode(ctx context.Context, nodeID string, kubeClient clientset.Interface) bool {
kataVMIsolationLabel, kataRuntimeLabel, err := getNodeInfoFromLabels(ctx, nodeID, kubeClient)
Copy link
Member

Choose a reason for hiding this comment

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

if nodeID == "" {
// driver controller
return false
}

Copy link
Member

Choose a reason for hiding this comment

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

thus in driver controller pod, it does not need to get node labels since nodeID is empty

func TestGetNodeInfoFromLabels(t *testing.T) {
ctx := context.TODO()

// Test case where kubeClient is nil
Copy link
Member

Choose a reason for hiding this comment

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

could you write unit test like this?

func TestIsSupportedShareNamePrefix(t *testing.T) {
tests := []struct {
prefix string
expectedResult bool
}{
{
prefix: "",
expectedResult: true,
},
{
prefix: "ext3",
expectedResult: true,
},
{
prefix: "ext-2",
expectedResult: true,
},
{
prefix: "-xfs",
expectedResult: false,
},
{
prefix: "Absdf",
expectedResult: false,
},
{
prefix: "tooooooooooooooooooooooooolong",
expectedResult: false,
},
{
prefix: "+invalid",
expectedResult: false,
},
{
prefix: " invalidspace",
expectedResult: false,
},
}
for _, test := range tests {
result := isSupportedShareNamePrefix(test.prefix)
if result != test.expectedResult {
t.Errorf("isSupportedShareNamePrefix(%s) returned with %v, not equal to %v", test.prefix, result, test.expectedResult)
}
}

}

func TestIsKataNode(t *testing.T) {
ctx := context.TODO()
Copy link
Member

Choose a reason for hiding this comment

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

could you write unit test like this?

func TestIsSupportedShareNamePrefix(t *testing.T) {
tests := []struct {
prefix string
expectedResult bool
}{
{
prefix: "",
expectedResult: true,
},
{
prefix: "ext3",
expectedResult: true,
},
{
prefix: "ext-2",
expectedResult: true,
},
{
prefix: "-xfs",
expectedResult: false,
},
{
prefix: "Absdf",
expectedResult: false,
},
{
prefix: "tooooooooooooooooooooooooolong",
expectedResult: false,
},
{
prefix: "+invalid",
expectedResult: false,
},
{
prefix: " invalidspace",
expectedResult: false,
},
}
for _, test := range tests {
result := isSupportedShareNamePrefix(test.prefix)
if result != test.expectedResult {
t.Errorf("isSupportedShareNamePrefix(%s) returned with %v, not equal to %v", test.prefix, result, test.expectedResult)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants