Skip to content

Conversation

jshachm
Copy link

@jshachm jshachm commented Jun 11, 2018

- What I did
Before this patch, docker daemon doesn't pass any annotations
to OCI runtime spec.However annotations can be useful espacially
for Runtime (Virtual Machine): kata/runv/gvisor and so on.

It's not good enough to pass all labels as annotations for there
will be some labels hold just for images.So we just need to paas two
kinds of annotations from upper cluster like kubernets:

First is user specific annotations which with prefix of annotations.
The other is labels for docker used which is marked as internal.

Signed-off-by: Haomin caihaomin@huawei.com

- How I did it

@miaoyq, I pick up from #36181, and look into what kubernetes has done with annotations.
We try to separate label into different types and decide which can be paas through to runtime.

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

for k, v := range c.Config.Labels {
logrus.Info(k)
if oldValue, ok := s.Annotations[k]; ok {
return nil, fmt.Errorf("Key %q already exisit in Annotations, the new value will be ignored,"+
Copy link
Contributor

Choose a reason for hiding this comment

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

This function have only one return value, why we return 2 values here, am I missing sth?

Copy link
Author

Choose a reason for hiding this comment

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

func returns spec and error

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

@arm64b I think we are talking about

func (daemon *Daemon) createSpec(c *container.Container) (retSpec *specs.Spec, err error) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, you are right 😄

}
}
}

return &s, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

seems the code base of this RP is out of date

Copy link
Author

Choose a reason for hiding this comment

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

I check the mainline and I think it's up to date... ^_^

Before this patch, docker daemon doesn't pass any annotations
to OCI runtime spec.However annotations can be useful espacially
for Runtime (Virtual Machine): kata/runv/gvisor and so on.

It's not good enough to pass all labels as annotations for there
will be some labels hold just for images.So we just need to paas two
kinds of annotations from upper cluster like kubernets:

First is user specific annotations which with prefix of `annotations.`
The other is labels for docker used which is marked as internal.

Signed-off-by: Haomin <caihaomin@huawei.com>
@jshachm jshachm force-pushed the label-to-annotations branch from 52d67b3 to e3e292f Compare June 13, 2018 01:06
@jshachm
Copy link
Author

jshachm commented Jun 13, 2018

ping @justincormack @thaJeztah @AkihiroSuda

What do you think about the new way to pass through annotations

@thaJeztah
Copy link
Member

Still hesitant to conflate labels and annotations through the same API

I want to bring this up again in a maintainers meeting, but that won't be this week due to DockerCon

@jshachm
Copy link
Author

jshachm commented Jun 14, 2018

@thaJeztah Thx very much! Passing annotation using flag label is a compromise. It will be great if docker will support a flag like annotation.

\cc @WeiZhang555 @bergwolf @egernst @gnawux @sameo

@@ -34,6 +34,21 @@ var (
deviceCgroupRuleRegex = regexp.MustCompile("^([acb]) ([0-9]+|\\*):([0-9]+|\\*) ([rwm]{1,3})$")
)

// These values are copy from k8s.io/kubernets/pkg/kubelet/dockershim types
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/copy/copied/ or s/copy/taken/

s.Annotations[key] = v
}

// interl labels for docker
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/interl/internal/

logrus.Info(k)
if oldValue, ok := s.Annotations[k]; ok {
return nil, fmt.Errorf("Key %q already exisit in Annotations, the new value will be ignored,"+
"oldvalue is %q, new value is %q", k, oldValue, v)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/oldvalue/old value/

@cpuguy83
Copy link
Member

cpuguy83 commented Mar 2, 2020

I think it would be great to have a generic way to pass configuration down to a runtime, however it should be explicit rather than implicit (maybe some daemon level config, maybe a dedicated field).

Because this doesn't quite seem like the right approach and this has gone stale, I'm going to close, but this is not an outright rejection of the idea behind this.

@cpuguy83 cpuguy83 closed this Mar 2, 2020
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.

8 participants