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

To support new changes for Windows HostProcess Pod for K8S v1.28 and containerd 1.7 #5528

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

NamanAg30
Copy link
Contributor

@NamanAg30 NamanAg30 commented Sep 26, 2023

The patch is required to handle following cases:-
1.To handle WindowsHostProcessContainer for k8s 1.28 and and make required adjustment in antrea-windows-containerd.yaml for containerd 1.7.
2.To change commands to clean containerd environment on jumper node from ci/jenkins.sh (since on new tested we only have docker runtime)

@rajnkamr rajnkamr added this to the Antrea v1.14 release milestone Sep 26, 2023
@NamanAg30 NamanAg30 force-pushed the updatek8sandcontainerd branch 4 times, most recently from 0b65bb8 to f6434f5 Compare September 27, 2023 16:27
@NamanAg30 NamanAg30 marked this pull request as ready for review September 27, 2023 16:28
wenyingd
wenyingd previously approved these changes Sep 28, 2023
Copy link
Contributor

@wenyingd wenyingd left a comment

Choose a reason for hiding this comment

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

LGTM

@XinShuYang
Copy link
Contributor

/test-windows-all

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM

@rajnkamr rajnkamr added the area/OS/windows Issues or PRs related to the Windows operating system. label Oct 5, 2023
@NamanAg30 NamanAg30 force-pushed the updatek8sandcontainerd branch 2 times, most recently from c60c29c to 25a3d6d Compare October 7, 2023 19:00
@XinShuYang
Copy link
Contributor

/test-windows-all

@XinShuYang
Copy link
Contributor

LGTM, did all CI tests pass on the 1.28 testbed? @NamanAg30

@NamanAg30 NamanAg30 force-pushed the updatek8sandcontainerd branch 3 times, most recently from f3b4a3a to eab7706 Compare October 9, 2023 10:44
antoninbas
antoninbas previously approved these changes Oct 9, 2023
test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved
wenyingd
wenyingd previously approved these changes Oct 26, 2023
Copy link
Contributor

@wenyingd wenyingd left a comment

Choose a reason for hiding this comment

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

LGTM.

We can optimize the usage of antctl from Node ssh to Pod operations in a separate change.

cp $mountPath/var/run/secrets/kubernetes.io/serviceaccount/ca.crt C:/var/run/secrets/kubernetes.io/serviceaccount
cp $mountPath/var/run/secrets/kubernetes.io/serviceaccount/token C:/var/run/secrets/kubernetes.io/serviceaccount

# From containerd version 1.7 onwards, the servcieaccount directory, the ca.cert and token files will automatically be created.
Copy link
Member

Choose a reason for hiding this comment

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

why the new code use a different indent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated, thanks.

test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved
test/e2e/framework.go Outdated Show resolved Hide resolved

# From containerd version 1.7 onwards, the servcieaccount directory, the ca.cert and token files will automatically be created.
$serviceAccountPath = "C:\var\run\secrets\kubernetes.io\serviceaccount"
if (-Not $(Test-Path $serviceAccountPath)) {
Copy link
Member

Choose a reason for hiding this comment

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

I understand this is better, but will the original code fail if the path exists?

Does the PR fix anything or just improve code? This is important to understand what's the compatibility of previous Antrea releases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it will fail in containerd 1.7. If the path exists, related files can not be modified.

Copy link
Member

Choose a reason for hiding this comment

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

Then how does it fix it if the PR just skips creating the path when it exists. The related files still cannot be modified, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

So basically there are three cases:

  1. If paths exist and files are unchanged, the agent skips copying files.
  2. If paths don't exist, the agent copies files to the destination.
  3. If paths exist and files have been modified, there is no way to modify the file, and the pod is expected to crash. The user should clean up the related paths by themselves.

Previously, the agent always copied related files, regardless of their existence, which could lead to agent crashes due to authorization issues. This PR fixes the case 1.

After discussing with Wenying, now I know that these 3 cases only can happen with containerd 1.6. For contianerd 1.7 since the destination and source path is the same path so we can just skip coping files, the code change in this PR is only to make it compatible for containerd1.6. @tnqn

Copy link
Contributor

Choose a reason for hiding this comment

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

According to this link (https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/), with containerd versions <=1.6, the ca file and token of the service account only exists inside containers, but antrea-agent needs files under path "c:\var\run\secrets\kubernetes.io\serviceaccount" to create kubeClient, so we should copy the files to the target path. However, since containerd 1.7, containerd would automatically place the files under path "c:\var\run\secrets\kubernetes.io\serviceaccount" ( it is supposed to be 3 links to the same file), so we don't perform "copy" actions.

So the change here is to be consistent of the previous versions.

test/e2e/framework.go Outdated Show resolved Hide resolved
@XinShuYang
Copy link
Contributor

/test-windows-containerd-conformance

@XinShuYang XinShuYang requested a review from tnqn October 26, 2023 08:32
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

Code LGTM, but the commit title and body aren't following the convention. I will edit it when merging it, please format it correctly for future PRs.

@XinShuYang
Copy link
Contributor

/test-windows-containerd-e2e

Copy link
Contributor

@wenyingd wenyingd left a comment

Choose a reason for hiding this comment

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

LGTM

@XinShuYang
Copy link
Contributor

/test-windows-containerd-e2e

…ins.sh w.r.t new k8s and containerd version

Upgrade StartKubelet script and ci test script for k8s 1.28 version and antrea-windows-containerd.yaml for containerd 1.7 version.

Signed-off-by: Naman Agarwal <naman.agarwal75@gmail.com>
Signed-off-by: Shuyang Xin <gavinx@vmware.com>
@XinShuYang
Copy link
Contributor

This change is only for checksum update and code rebase.

@XinShuYang
Copy link
Contributor

/test-windows-containerd-e2e
/test-windows-containerd-conformance

@XinShuYang
Copy link
Contributor

/test-windows-containerd-e2e

@tnqn
Copy link
Member

tnqn commented Oct 27, 2023

/skip-all

1 similar comment
@tnqn
Copy link
Member

tnqn commented Oct 27, 2023

/skip-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes. area/OS/windows Issues or PRs related to the Windows operating system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants