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

use containerd/containerd/api module #3526

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

Conversation

akhilerm
Copy link

@akhilerm akhilerm commented May 4, 2024

  • use containerd/containerd/api module instead of having a copy in third_party
  • use containerd/errdefs module instead of keeping a local copy

@k8s-ci-robot
Copy link
Collaborator

Hi @akhilerm. Thanks for your PR.

I'm waiting for a google 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.

@bobbypage
Copy link
Collaborator

/ok-to-test

@bobbypage
Copy link
Collaborator

Very exciting to see this happen!

@bobbypage bobbypage marked this pull request as ready for review May 4, 2024 03:41
@akhilerm
Copy link
Author

akhilerm commented May 4, 2024

@bobbypage Can you approve the github action workflows also?

@dims
Copy link
Collaborator

dims commented May 4, 2024

/ok-to-test

@akhilerm
Copy link
Author

akhilerm commented May 7, 2024

/cc @bobbypage @dims for review

go.mod Outdated
@@ -1,73 +1,74 @@
module github.com/google/cadvisor

go 1.19
go 1.22.0

replace golang.org/x/net => golang.org/x/net v0.7.0
Copy link
Author

Choose a reason for hiding this comment

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

@bobbypage Shouldnt this be removed? I am not sure why the version was pinned. Also v0.23.0 fixes CVE-2023-45288

@akhilerm
Copy link
Author

/hold
will merge once containerd/containerd/api v1.8.0 is released

@akhilerm
Copy link
Author

@bobbypage Can you approve the workflow. I have rebased against the latest master branch

@iwankgb
Copy link
Collaborator

iwankgb commented Jun 22, 2024

@akhilerm, you have conflicts against master.

@akhilerm
Copy link
Author

rebased against master and pushed the changes.

@akhilerm
Copy link
Author

The pull-cadvisor-e2e job is failing due to env setup error

/retest pull-cadvisor-e2e

@k8s-ci-robot
Copy link
Collaborator

@akhilerm: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test pull-cadvisor-e2e

Use /test all to run all jobs.

In response to this:

The pull-cadvisor-e2e job is failing due to env setup error

/retest pull-cadvisor-e2e

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.

@akhilerm
Copy link
Author

/test pull-cadvisor-e2e

1 similar comment
@akhilerm
Copy link
Author

/test pull-cadvisor-e2e

Copy link
Collaborator

@iwankgb iwankgb left a comment

Choose a reason for hiding this comment

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

Just two minor comments :)

@@ -33,7 +33,7 @@ import (
"context"
"time"

"github.com/gogo/protobuf/types"
anypb "google.golang.org/protobuf/types/known/anypb"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this alias necessary?

Copy link
Author

Choose a reason for hiding this comment

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

FIxed.

Comment on lines +47 to +75
// Copied from https://github.com/containerd/containerd/blob/main/pkg/protobuf/any.go
// FromAny converts typeurl.Any to github.com/containerd/containerd/protobuf/types.Any.
//
// TODO: vendor these functions once they are moved to github.com/containerd/typeurl.
//
// Currently they are copied over so as not to introduce a dependency on containerd/containerd again
func FromAny(from typeurl.Any) *anypb.Any {
if from == nil {
return nil
}

if pbany, ok := from.(*anypb.Any); ok {
return pbany
}

return &anypb.Any{
TypeUrl: from.GetTypeUrl(),
Value: from.GetValue(),
}
}

// MarshalAnyToProto converts an arbitrary interface to github.com/containerd/containerd/protobuf/types.Any.
func MarshalAnyToProto(from interface{}) (*anypb.Any, error) {
anyType, err := typeurl.MarshalAny(from)
if err != nil {
return nil, err
}
return FromAny(anyType), nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can these two functions be unexported, please?

Copy link
Author

Choose a reason for hiding this comment

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

There is a PR in containerd/typeurl#45, so that these funcs can be vendored and used instead of copying it over here.

cmd/go.mod Outdated
@@ -44,6 +44,8 @@ require (
github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect
github.com/cilium/ebpf v0.7.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/containerd/api v1.8.0-rc.2 // indirect
Copy link
Collaborator

Choose a reason for hiding this comment

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

This PR shall not be merged with RC version.

Copy link
Author

Choose a reason for hiding this comment

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

This PR was raised so as to test the containerd/api module compatiblity with cadvisor. I am updating as each rc version releases so that we know there are no breaking changes.

PR needs to be merged only after containerd/api v1.8.0 is released.

More discussion on the same is happening on this thread https://kubernetes.slack.com/archives/CHGFYJVAN/p1714733633634819

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that API v1.7.19 has been tagged; the v1.8.0-rc is the API version from the main branch (containerd v2.0-dev), so depending on what's needed, maybe the v1.7.19 version is an option?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. Thats a better option. Will update to api/v1.7.19

Copy link
Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the "indirect" here stuck on 1.8; could be either go modules's tendency to not downgrade once it's there, or could there be something else in the dependency tree pushing it up? 🤔

(Sorry, maybe you already noticed that, but just in case 🙈 🫶 )

Copy link
Author

Choose a reason for hiding this comment

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

My bad. Hadnt checked the new diff before pushing. Thought tidy will downgrade it automatically. It was because of this

could be either go modules's tendency to not downgrade once it's there

running just a go mod tidy will not downgrade, had to remove and run the tidy again so as to bring in 1.7.19 as indirect dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that fooled me many times; if a dependency version (based on the dependency tree "minimum version selection") either becomes lower, or even is no longer a dependency, then go modules thinks it was a manual override / upgrade.

That sometimes makes sense (if you indeed updated the version because you wanted a newer version) but sometimes you don't, and just remove all indirects to force it re-resolving the minimum versions can help find those.

- use containerd/api v1.8.0-rc.2 instead of relying on third_party directory
- remove script to copy /api from containerd/containerd

Signed-off-by: Akhil Mohan <[email protected]>
Signed-off-by: Akhil Mohan <[email protected]>
@akhilerm
Copy link
Author

/hold

for containerd/typeurl#45 to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants