Skip to content

Conversation

zhaojizhuang
Copy link
Contributor

Fixes: #1844
Support logs in namespace k8s.io

@zhaojizhuang
Copy link
Contributor Author

ping @AkihiroSuda

@zhaojizhuang zhaojizhuang force-pushed the lognerdctl branch 2 times, most recently from 4ff631c to fdeec39 Compare January 16, 2023 06:38
@zhaojizhuang
Copy link
Contributor Author

Can we drop this dependency by copying containerd/pkg/cri/store/container/metadata.go?

one question left, yes we can drop this dependency by copying containerd/pkg/cri/store/container/metadata.go,
but copyping these codes, may cause more upgrade problems, compared with referencing through go mod.

What's your idea?@AkihiroSuda

@AkihiroSuda
Copy link
Member

Can we drop this dependency by copying containerd/pkg/cri/store/container/metadata.go?

one question left, yes we can drop this dependency by copying containerd/pkg/cri/store/container/metadata.go, but copyping these codes, may cause more upgrade problems, compared with referencing through go mod.

What's your idea?@AkihiroSuda

Maybe we should just refactor containerd/pkg/cri/store/container to minimize its dependencies, and then we can avoid copypasta

@zhaojizhuang
Copy link
Contributor Author

Can we drop this dependency by copying containerd/pkg/cri/store/container/metadata.go?

one question left, yes we can drop this dependency by copying containerd/pkg/cri/store/container/metadata.go, but copyping these codes, may cause more upgrade problems, compared with referencing through go mod.
What's your idea?@AkihiroSuda

Maybe we should just refactor containerd/pkg/cri/store/container to minimize its dependencies, and then we can avoid copypasta

agree, so, lets create a another issue to refactor containerd/pkg/cri/store/container
and any other issue about this PR?

@zhaojizhuang zhaojizhuang force-pushed the lognerdctl branch 2 times, most recently from 64cd106 to 4f803f5 Compare January 16, 2023 11:48
@zhaojizhuang zhaojizhuang force-pushed the lognerdctl branch 4 times, most recently from c8c8a03 to 837a68a Compare January 17, 2023 03:18
return "", fmt.Errorf("get extensions for container %s,failed: %#v", container.ID(), err)
}
metaData := extensions[k8slabels.ContainerMetadataExtension]
var meta containerstore.Metadata
Copy link
Member

Choose a reason for hiding this comment

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

Probably we just need this to avoid importing the CRI deps

type CRIContainerVersionedMetadata struct {
  Version string
  Metadata CRIContainerMetadata
}
type CRIContainerMetadata struct {
  LogPath string
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like a good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

type metadataInternal Metadata

// Metadata is the unversioned container metadata.
type Metadata struct {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type Metadata struct {
type CRIContainerMetadata struct {

Copy link
Member

Choose a reason for hiding this comment

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

Or split this to a new package like pkg/api/types/critypes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

create a new package "github.com/containerd/nerdctl/pkg/api/types/cri"

@@ -0,0 +1,76 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

containerd_types.go

cri_types.go might be more descriptive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Please make sure to make struct names descriptive
https://github.com/containerd/nerdctl/pull/1847/files#r1071829430

LGTM other than that, thanks!

@zhaojizhuang zhaojizhuang force-pushed the lognerdctl branch 2 times, most recently from 646c770 to 4684a3c Compare January 17, 2023 09:29
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit 744ab88 into containerd:main Jan 19, 2023
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.

Support logs in namespace k8s.io

3 participants