Skip to content

Conversation

@vbatts
Copy link
Member

@vbatts vbatts commented Sep 11, 2015

To have a less source based, and more consumable example of structures,
this is an initial pass at protobuf structures for the structures in config.go

There is some exercise needed in platform specific structures.

For the sake of example, the Makefile defaults to outputing golang
source, but has a 'c' target (make c) for C source as well.

Signed-off-by: Vincent Batts [email protected]

@vbatts
Copy link
Member Author

vbatts commented Sep 11, 2015

@mrunalp
Copy link
Contributor

mrunalp commented Sep 11, 2015

👍 We should probably create a branch to flesh this out and see if it meets all our requirements.

@vbatts
Copy link
Member Author

vbatts commented Sep 11, 2015

fair. I'm still working through it, but figured to get the conversation
started.

On Fri, Sep 11, 2015 at 1:13 PM, Mrunal Patel [email protected]
wrote:

[image: 👍] We should probably create a branch to flesh this out and
see if it meets all our requirements.


Reply to this email directly or view it on GitHub
#179 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

One thing to consider with required fields is that it might be almost impossible to make it optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

are you saying to start with preferring optional?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

@crosbymichael
Copy link
Member

Ya, we could do a branch on the repo to figure this out if that makes it easier.

@vbatts
Copy link
Member Author

vbatts commented Sep 11, 2015

@vishh updated the field rules

@vbatts
Copy link
Member Author

vbatts commented Sep 11, 2015

So, I've stubbed out the [platform dependent] User, in the best pattern I can derive from the guidelines and references. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this going to give us per-platform namespacing inside User? E.g.

"user": {
  "linux": {
    "uid": 0,
    "gid": 0,
   }
}

That's the pattern we use in other sections of the existing config (e.g. for linux.capabilities), but it seems excessive here. However, the benefits of a protobuf-based schema may warrant a few warts in the associated JSON structure.

Copy link
Member Author

Choose a reason for hiding this comment

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

not namespacing, just platform dependent user attributes.

Copy link
Contributor

Choose a reason for hiding this comment

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

On Fri, Sep 11, 2015 at 12:58:22PM -0700, Vincent Batts wrote:

  • // LinuxUserFields are to be used when Type is LINUX
  • optional linuxUserFields LinuxUserFields = 2;

not namespacing, just platform dependent user attributes.

Generated Go (from b5433ce) has:

// User specifies user information for the process.
type User struct {
// Type so that receivers of this message can switch for the fields expected
Type *PlatformType protobuf:"varint,1,opt,enum=oci.PlatformType,def=1" json:"Type,omitempty"
// LinuxUserFields are to be used when Type is LINUX
LinuxUserFields *LinuxUserFields protobuf:"bytes,2,opt" json:"LinuxUserFields,omitempty"
XXX_unrecognized []byte json:"-"
}

Which looks like it's going to lead to a an explicit “LinuxUserFields”
level to me. And again, I'm not against a bit of wordiness in support
of spec that can autogenerate bindings in a number of languages, but
that explicit platform level is not how we handle user entries now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Any primitive might be useful here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vishh ah that sounds like what I'm looking for, but that's in proto3. I'm dealing with proto2 :-\

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm playing with permutations of extensions right now

Copy link
Member Author

Choose a reason for hiding this comment

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

@wking general adoption

Copy link
Contributor

Choose a reason for hiding this comment

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

On Mon, Sep 14, 2015 at 10:06:25AM -0700, Vincent Batts wrote:

@wking general adoption

Does protobuf-version adoption really matter? If we're just using it
for code-generation, it seems like you'd only need a few folks running
the protobuf-to-$X translators. Everyone else can just consume that
generated code, without interacting with protobuf at all.

Copy link
Member Author

@vbatts vbatts Sep 14, 2015 via email

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

On Mon, Sep 14, 2015 at 12:04:48PM -0700, Vincent Batts wrote:

I don't intend on commiting the generated code.

No need to commit it, just ship it with release tarballs.

@vbatts
Copy link
Member Author

vbatts commented Sep 11, 2015

Alrighty, y'all. A couple of concessions, but is pretty much lined up for an initial review.

proto/Makefile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

‘defualt’ → ‘default’ ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

If any of these fields are required to be set, can we explicitly state that in the comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. That relationship is a bit cloudied by the required, optional, repeated field rules.

To have a less source based, and more consumable example of structures,
this is an initial pass at protobuf structures for the structures in config.go

There is some exercise needed in platform specific structures.

For the sake of example, the Makefile defaults to outputing golang
source, but has a 'c' target (`make c`) for C source as well.

Signed-off-by: Vincent Batts <[email protected]>
This User structure does not map to the cleanliness of the current go
structure, but will allow the definition to be all in one place,
regardless of the host that is doing the compilation.

Switching field rules to `optional` for now. Per vish and the docs,
https://developers.google.com/protocol-buffers/docs/proto?csw=1#specifying-field-rules
"! Required Is Forever"

Also add a `make py` and `make all` target.

Signed-off-by: Vincent Batts <[email protected]>
There are a couple of concessions, but is pretty much lined up.

Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Let the user decide the value.

opencontainers#179 (comment)

Signed-off-by: Vincent Batts <[email protected]>
@vbatts
Copy link
Member Author

vbatts commented Sep 14, 2015

updated for comments.

Also, I'll have to close this PR and open another to put these changes against a branch besides master. Not sure where/what we want that branch to be. dev? protobuf?

@mrunalp
Copy link
Contributor

mrunalp commented Sep 14, 2015

@vbatts Maybe just call it protobuf.

@vbatts
Copy link
Member Author

vbatts commented Sep 14, 2015

@vishh so, i just pushed an iteration of User as an extension. The godoc is here. LMKWYT

@vbatts
Copy link
Member Author

vbatts commented Sep 14, 2015

moving this PR over to #185

@vbatts vbatts closed this Sep 14, 2015
vbatts added a commit to vbatts/oci-runtime-spec that referenced this pull request Sep 15, 2015
Let the user decide the value.

opencontainers#179 (comment)

Signed-off-by: Vincent Batts <[email protected]>
vbatts added a commit to vbatts/oci-runtime-spec that referenced this pull request Sep 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants