Skip to content

Support Labels for networks and volumes#274

Merged
AkihiroSuda merged 1 commit into
containerd:masterfrom
fahedouch:labels
Jul 7, 2021
Merged

Support Labels for networks and volumes#274
AkihiroSuda merged 1 commit into
containerd:masterfrom
fahedouch:labels

Conversation

@fahedouch
Copy link
Copy Markdown
Member

@fahedouch fahedouch commented Jun 30, 2021

  • support labels for networks
  • support labels for volumes
  • support labels for compose resources (networks and volumes)
  • add labels to volume inspect elements
  • add labels to network inspect elements

related issue #258

@fahedouch fahedouch changed the title support Labels [WIP] support Labels Jun 30, 2021
@fahedouch fahedouch marked this pull request as draft June 30, 2021 21:16
Comment thread pkg/netutil/netutil_linux.go Outdated
@AkihiroSuda AkihiroSuda modified the milestones: v0.10.0, v0.11.0 Jun 30, 2021
@fahedouch fahedouch force-pushed the labels branch 7 times, most recently from ce16674 to 593bab6 Compare July 4, 2021 17:35
Comment thread pkg/mountutil/mountutil.go
// DataDirName is "_data"
const DataDirName = "_data"

const volumeFileName = "volume.json"
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.

const volumeJSONFileName, or volumeMetaFileName

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

labelsMap := strutil.ConvertKVStringsToMap(labels)

volumeOpts := make(map[string]interface{})
volumeOpts["nerdctlLabels"] = labelsMap
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.

Just labels is fine for volumes, as we own the entire JSON by ourselves

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.

And better to define a struct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed


func NerdctlLabels(b []byte) *map[string]string {
type nerdctlConfigList struct {
NerdctlLabels *map[string]string `json:"nerdctlLabels,omitempty"`
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.

same as above

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread pkg/netutil/netutil.go Outdated
type ConfigListTemplateOpts struct {
ID int
Name string // e.g. "nerdctl"
Labels string // e.g. `,{"group":"bigger"}`
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.

What does bigger mean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it was just an example, I changed to a more meaningful example

Comment thread pkg/netutil/netutil.go Outdated
type ConfigListTemplateOpts struct {
ID int
Name string // e.g. "nerdctl"
Labels string // e.g. `,{"group":"bigger"}`
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.

no , should be needed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

@fahedouch fahedouch force-pushed the labels branch 3 times, most recently from c3350ce to 56c294b Compare July 5, 2021 20:19
@fahedouch fahedouch changed the title [WIP] support Labels Support Labels Jul 5, 2021
@fahedouch fahedouch marked this pull request as ready for review July 5, 2021 20:25
Comment thread pkg/netutil/netutil_windows.go Outdated
Signed-off-by: fahed dorgaa <fahed.dorgaa@gmail.com>
Copy link
Copy Markdown
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 c481d03 into containerd:master Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request impact/changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants