Skip to content

add support logs for namespace k8s.io - #1847

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
zhaojizhuang:lognerdctl
Jan 19, 2023
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
zhaojizhuang:lognerdctl

Conversation

@zhaojizhuang

Copy link
Copy Markdown
Contributor

Fixes: #1844
Support logs in namespace k8s.io

@zhaojizhuang

Copy link
Copy Markdown
Contributor Author

ping @AkihiroSuda

Comment thread pkg/logging/text_logger.go Resolved
Comment thread pkg/logging/text_logger.go Resolved
Comment thread go.mod Resolved
Comment thread cmd/nerdctl/logs.go Resolved
Comment thread pkg/logging/log_viewer.go Resolved
@zhaojizhuang
zhaojizhuang force-pushed the lognerdctl branch 2 times, most recently from 4ff631c to fdeec39 Compare January 16, 2023 06:38
@zhaojizhuang

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Comment thread pkg/logging/log_viewer.go Resolved
Comment thread pkg/logging/text_logger.go Resolved
@zhaojizhuang
zhaojizhuang force-pushed the lognerdctl branch 2 times, most recently from 64cd106 to 4f803f5 Compare January 16, 2023 11:48
Comment thread pkg/logging/cri_logger.go Resolved
Comment thread pkg/logging/log_viewer.go Resolved
Comment thread pkg/logging/log_viewer.go Resolved
@zhaojizhuang
zhaojizhuang force-pushed the lognerdctl branch 4 times, most recently from c8c8a03 to 837a68a Compare January 17, 2023 03:18
Comment thread cmd/nerdctl/logs.go Outdated
return "", fmt.Errorf("get extensions for container %s,failed: %#v", container.ID(), err)
}
metaData := extensions[k8slabels.ContainerMetadataExtension]
var meta containerstore.Metadata

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment thread pkg/api/types/containerd_types.go Outdated
type metadataInternal Metadata

// Metadata is the unversioned container metadata.
type Metadata struct {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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"

Comment thread pkg/api/types/containerd_types.go Resolved
Comment thread pkg/api/types/containerd_types.go Resolved
@@ -0,0 +1,76 @@
/*

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

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
Signed-off-by: zhaojizhuang <571130360@qq.com>

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

Comment thread cmd/nerdctl/logs.go Resolved
@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