Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node-api staging repo w/ RuntimeClass API #67791

Merged
merged 4 commits into from Dec 20, 2018

Conversation

tallclair
Copy link
Member

@tallclair tallclair commented Aug 24, 2018

  1. Introduce a new staging repo: k8s.io/node-api to house the node.k8s.io api group.
  2. Adds (but doesn't implement) the RuntimeClass API proposed in https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md

For kubernetes/enhancements#585

Special notes for your reviewer:

Depends on kubernetes/org#38

This is intended to be an out-of tree CRD, consumed by core-components. There isn't much precedent for this, so please take a close look at the api machinery pieces.

Release note:
Covered by #67737

NONE

/sig node
/kind api-change
/priority important-soon
/milestone v1.13

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 24, 2018
@tallclair
Copy link
Member Author

/assign @dchen1107
/assign @thockin

/hold
(for kubernetes/org#38)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 24, 2018
*/

// +k8s:deepcopy-gen=package
// +k8s:openapi-gen=true
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE TO REVIEWERS:

Should this be here? It looks like it causes an entry in k8s.io/kubernetes/pkg/generated/openapi to be generated, but I think this is supposed to be completely out of tree?

@tallclair
Copy link
Member Author

/cc @saad-ali @jsafrane
Similar problem to the CSI drivers, inspired/copied from #67716

@thockin
Copy link
Member

thockin commented Aug 24, 2018

Are we converged on the decision for CSI (and this by extension)?

@tallclair
Copy link
Member Author

My interpretation of this comment from @liggitt was that we don't have any choice but to use a staging repo:

The issue is k/k vendoring an independent repo that depends on apimachinery. That cycle makes it impossible to change apimachinery in any way the external dependency would have to react to

Even if we use a dynamic client, we still want to be able to use the typed APIs in the Kubelet, so I don't think we can avoid vendoring the node-api from Kubelet?

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

I only reviewed API

# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we be doing this in transit from staging -> own repo?

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 don't know the answer to that, but I think this is the way all our other staging repos currently do it.

// RuntimeClassSpec is a specification of a RuntimeClass.
type RuntimeClassSpec struct {
// RuntimeHandler specifies the underlying runtime the CRI calls to handle pod and/or container
// creation. The possible values are specific to a given configuration & CRI implementation.
Copy link
Member

Choose a reason for hiding this comment

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

Are we speccing the format of this string? e.g. containerd.io/containerd or cri-o.io/cri-o ?

Copy link
Member Author

Choose a reason for hiding this comment

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

For now I'm using the same validation as for the ObjectMeta name (DNS 1123 subdomain). We might want to expand that to allow paths later, but it's easier to start with tighter validation. I'll add this to the comment.

I don't think there's any reason to namespace the runtime handler. This field is only ever interpreted by the runtime, and the expectation is that the admin set it up to map to a specific config that the runtime understands. If we prefixed it with containerd.io, it would be up to containerd to then strip out that prefix (and I guess reject any request that didn't have that prefix).

Copy link
Member

Choose a reason for hiding this comment

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

I am confused. If a node supports multiple runtimes (or even if a cluster does), those runtimes need to self identify, right? Is that this string?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIUC, what you're getting at is discovery? I.e. once we have scheduling support for RuntimeClass, how do nodes broadcast the runtimes they support, and how does the the cluster match that to a RuntimeClass.

I think it's an open question of whether nodes would "broadcast" supported RuntimeHandlers, or RuntimeClasses (or whether discovery should be supported at all).

Even if nodes did broadcast supported RuntimeHandlers, I think it's debateable whether 2 different CRI implementations configured with the same RuntimeHandler should be treated separately, or as 2 valid implementations of the same handler.

Given these open questions, I'd prefer to punt on this until we actually have a design for this feature.

Copy link
Member

Choose a reason for hiding this comment

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

We spoke offline. here's my proposed comments:

RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node configuration & CRI implementation.  It is assumed that all handlers are available and equivalent on every node.

If this is not specified, a default will be chosen by the implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 1, 2018
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

We spoke off-PR. This is just a case of needing to be clearer about the scope and meaning I think.

// RuntimeClassSpec is a specification of a RuntimeClass.
type RuntimeClassSpec struct {
// RuntimeHandler specifies the underlying runtime the CRI calls to handle pod and/or container
// creation. The possible values are specific to a given configuration & CRI implementation.
Copy link
Member

Choose a reason for hiding this comment

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

We spoke offline. here's my proposed comments:

RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node configuration & CRI implementation.  It is assumed that all handlers are available and equivalent on every node.

If this is not specified, a default will be chosen by the implementation.

// creation. The possible values are specific to a given configuration & CRI implementation.
// The empty string is equivalent to the default behavior.
// +optional
RuntimeHandler string `json:"runtimeHandler,omitempty" protobuf:"bytes,1,opt,name=runtimeHandler"`
Copy link
Member

Choose a reason for hiding this comment

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

optionals should be pointers.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@thockin
Copy link
Member

thockin commented Sep 5, 2018

API is approved.

Ping me when it is otherwise LGTM'ed

@thockin
Copy link
Member

thockin commented Sep 5, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tallclair, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2018
@tallclair
Copy link
Member Author

/assign @dchen1107
For lgtm

k8s-github-robot pushed a commit that referenced this pull request Sep 5, 2018
Automatic merge from submit-queue (batch tested with PRs 68161, 68023, 67909, 67955, 67731). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Dynamic RuntimeClass implementation

**What this PR does / why we need it**:

Implement RuntimeClass using the dynamic client to break the dependency on #67791

Once (if) #67791 merges, I will migrate to the typed client.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
For kubernetes/enhancements#585

**Release note**:
Covered by #67737
```release-note
NONE
```

/sig node
/kind feature
/priority important-soon
/milestone v1.12
@nikhita
Copy link
Member

nikhita commented Nov 26, 2018

Can you also add this repo to hack/import-restrictions.yaml and in staging/README.md?

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 27, 2018
@tallclair
Copy link
Member Author

@nikhita done

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 27, 2018
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 27, 2018
@nikhita
Copy link
Member

nikhita commented Nov 30, 2018

@tallclair Looks like this PR needs another rebase. :/

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2018
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// RuntimeClass defines a class of runtime supported in the cluster.
Copy link
Member

Choose a reason for hiding this comment

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

Can we make the comments here clearer? I assume runtime means container runtime, but not everyone will have the context to realize that?

Copy link
Member

Choose a reason for hiding this comment

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

Can you document the actors that will read and/or write this object?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Spec RuntimeClassSpec `json:"spec" protobuf:"bytes,2,name=spec"`
}

// RuntimeClassSpec is a specification of a RuntimeClass.
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this comment more helpful? What sorts of things about RuntimeClasses need to be specified? Why would I want to specify them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// RuntimeClassSpec is a specification of a RuntimeClass.
type RuntimeClassSpec struct {
// RuntimeHandler specifies the underlying runtime and configuration that the
// CRI implementation will use to handle pods of this class. The possible
Copy link
Member

Choose a reason for hiding this comment

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

Can we spell out CRI at least once? Can we say what the relationship between this object and CRI is?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


// RuntimeClassSpec is a specification of a RuntimeClass.
type RuntimeClassSpec struct {
// RuntimeHandler specifies the underlying runtime and configuration that the
Copy link
Member

Choose a reason for hiding this comment

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

Can we give an example of what people might put in this string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// assumed that all handlers are available on every node, and handlers of the
// same name are equivalent on every node.
// If this is not specified, a default will be chosen by the implementation.
// +optional
Copy link
Member

Choose a reason for hiding this comment

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

This is optional, when should I specify it?

Is it OK for a user to provide this string with an empty value ("")?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 18, 2018
@dchen1107
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 19, 2018
@tallclair
Copy link
Member Author

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet