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

[WIP] add nerdctl ci minimal support #3408

Closed
wants to merge 1 commit into from

Conversation

yankay
Copy link
Member

@yankay yankay commented Nov 1, 2023

Add basic ci to test that kind can create clusters with nerdctl , and using the docker provider.

The issue: #2317 (comment)

The PR is wating: containerd/nerdctl#2600

@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 Nov 1, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yankay
Once this PR has been reviewed and has the lgtm label, please assign bentheelder for approval. For more information see the Kubernetes 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 1, 2023
@yankay yankay force-pushed the support-nerdctl branch 9 times, most recently from 86687ec to 5e3bffe Compare November 1, 2023 06:47
Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

looking at the existing workflows it seems acceptable to test providers, but unclear whether wrapping CLI tools like nerdctl should be tested.

it's always better to log an issue and discuss the proposal there, before sending the PR.

my vote for this change is +0.

run: |
sudo systemctl is-active --quiet docker.service || systemctl stop docker.service
sudo apt-get remove -y docker-ce docker-ce-cli docker-buildx-plugin podman
sudo curl -sSL https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz|sudo tar -xvz -C /usr/local/bin
Copy link
Member

Choose a reason for hiding this comment

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

You want to wait for nerdctl v1.7
(ETA: by the end of this week)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @AkihiroSuda

it's waiting for the nerdctl v1.7.

Copy link
Member

Choose a reason for hiding this comment

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

sudo systemctl is-active --quiet docker.service || systemctl stop docker.service
sudo apt-get remove -y docker-ce docker-ce-cli docker-buildx-plugin podman
sudo curl -sSL https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz|sudo tar -xvz -C /usr/local/bin
sudo ln -s /usr/local/bin/nerdctl /usr/local/bin/docker
Copy link
Member

Choose a reason for hiding this comment

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

kind should support a custom Docker path via $DOCKER

Copy link
Member Author

@yankay yankay Nov 1, 2023

Choose a reason for hiding this comment

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

I want to make kind support the custom binary name in the next .

The kind is hardcoded docker in the provider. for example:
https://github.com/kubernetes-sigs/kind/blob/v0.20.0/pkg/cluster/internal/providers/docker/provision.go#L314

So it use the symbolic link now.

jobs:
nerdctl:
name: Nerdctl
runs-on: ubuntu-20.04
Copy link
Member

Choose a reason for hiding this comment

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

Why not 22.04 ?

Copy link
Member Author

@yankay yankay Nov 1, 2023

Choose a reason for hiding this comment

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

I'll try to upgrade them at #3409
If it merged, it'll be updated

ipFamily: [ipv4, ipv6]
deployment: [singleNode, multiNode]
exclude:
- ipFamily: ipv6
Copy link
Member

Choose a reason for hiding this comment

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

Can we support rootless too?

Copy link
Member Author

@yankay yankay Nov 1, 2023

Choose a reason for hiding this comment

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

Thanks @AkihiroSuda

The rootless mode support has been added to the 'work items' at : #2317 (comment)

Could I provide it in another PR, so that this PR will not be too large ?

@yankay
Copy link
Member Author

yankay commented Nov 1, 2023

looking at the existing workflows it seems acceptable to test providers, but unclear whether wrapping CLI tools like nerdctl should be tested.

it's always better to log an issue and discuss the proposal there, before sending the PR.

my vote for this change is +0.

Thanks @neolit123 for the PR review. :-)

I've log the issue at the #2317 (comment) to proposal.
So we can disscuss there.

Best Regards.

@yankay yankay force-pushed the support-nerdctl branch 2 times, most recently from 0e6de8a to e0caaad Compare November 1, 2023 11:45
@yankay yankay marked this pull request as draft November 1, 2023 11:46
@AkihiroSuda
Copy link
Member

// DetectNodeProvider allows callers to autodetect the node provider
// *without* fallback to the default.
//
// Pass the returned ProviderOption to NewProvider to pass the auto-detect Docker
// or Podman option explicitly (in the future there will be more options)
//
// NOTE: The kind *cli* also checks `KIND_EXPERIMENTAL_PROVIDER` for "podman" or
// "docker" currently and does not auto-detect / respects this if set.
//
// This will be replaced with some other mechanism in the future (likely when
// podman support is GA), in the meantime though your tool may wish to match this.
//
// In the future when this is not considered experimental,
// that logic will be in a public API as well.
func DetectNodeProvider() (ProviderOption, error) {
// auto-detect based on each node provider's IsAvailable() function
if docker.IsAvailable() {
return ProviderWithDocker(), nil
}
if podman.IsAvailable() {
return ProviderWithPodman(), nil
}
return nil, errors.WithStack(NoNodeProviderDetectedError)
}

// IsAvailable checks if docker is available in the system
func IsAvailable() bool {
cmd := exec.Command("docker", "-v")
lines, err := exec.OutputLines(cmd)
if err != nil || len(lines) != 1 {
return false
}
return strings.HasPrefix(lines[0], "Docker version")
}

This check has to be modified, otherwise it choose Podman, not nerdctl

@yankay yankay force-pushed the support-nerdctl branch 10 times, most recently from 861cf9e to 29abd18 Compare November 17, 2023 07:28
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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/test-infra repository.

@yankay
Copy link
Member Author

yankay commented Feb 27, 2024

close by #3429

@yankay yankay closed this Feb 27, 2024
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

None yet

4 participants