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

new deploy API following Open API format #2564

Merged
merged 8 commits into from Mar 9, 2019
Merged

Conversation

kunmingg
Copy link
Contributor

@kunmingg kunmingg commented Feb 27, 2019

New deployment API supports 2 types of entries:

  • config entry
    each entry maps to a set of config files stored in source repo or Github which can fully define a deployment entry.
  • deployment entry
    each entry maps to a kubeflow instance on GCP which include resources like GKE, Endpoint, Storage, Service Account, IAM bindings. Deployment entry is created following definition in the corresponding config entry.

Goals of new API include simplify reuse configs and support configs customization.

This change is Reviewable

bootstrap/api/swagger.yaml Outdated Show resolved Hide resolved
definitions:
CreateDeployment:
type: "object"
properties:
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 the body of the request?

bootstrap/api/swagger.yaml Outdated Show resolved Hide resolved
bootstrap/api/swagger.yaml Outdated Show resolved Hide resolved
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/CreateDeployment"
Copy link
Contributor

Choose a reason for hiding this comment

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

Following K8s and GCP style can the body of the Create request just be the spec for the deployment?
i.e. a Create and Get request use the same object just with different fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps instead of Create we should just have an Update method which would create it if it doesn't exist?

schema:
$ref: "#/definitions/InvalidInput"
definitions:
CreateDeployment:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we follow the K8s resource model?
So maybe the Deployment should have fields
metadata
name
namespace
spec:
cluster
zone
....

type: "array"
items:
type: "string"
parameters:
Copy link
Contributor

Choose a reason for hiding this comment

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

Following K8s style should we add a status section and use conditions to report status?

$ref: "#/definitions/CreateDeployment"
responses:
200:
description: "successful operation"
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the goals of the deployment process is to split it into separate phases generate and apply so that people can manually edit the manifests after generate in order to customize them.

Any thought how we could handle that?

One option would be to create custom verbs e.g generate & apply. But that goes against the K8s idea of having a common resource model with common verbs.

A second option would be to have a field in the spec that specifies the desiredState for the deployment. Allowed values could be something like "configured" "deployed"

The flow could then be something like

  1. Call create with desiredState: configured
  2. This creates the manifests and pushes them to source repo
  3. User modifies the manifests
  4. User calls Update setting the desiredState to deployed

description: "Invalid input"
schema:
$ref: "#/definitions/ErrorMessage"
/projects/{project}/configs/{config}/version/{version}/file:
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the version resource for?

Is it just fetching the config?

If users want to fetch the config why don't they talk to underlying storage (e.g source repo directly)? Is this just a helper API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helper API provide read / write of single config file in underlying storage:

  1. as of today for source repo there are not such API available.
  2. existing edit UI is confusing because it aimed to solve more complicated day-to-day dev use case.
  3. If suggest user change config directly with underlying storage, user experience becomes:
    Create config entry in UI -> setup git and git clone -> edit config -> git push -> apply in UI

With this API we can have experience:
Create config entry in UI -> edit config file in UI -> apply in UI
Then we provide whole experience within UI, would be much easier for usage like editing GCP options

put:
tags:
- "config"
description: "Update kubeflow config entry file"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a put operation on config?

If people want to update the config couldn't they do this directly by modifying the file; e.g. in the source repo?

properties:
metadata:
$ref: "#/definitions/DeploymentMetadata"
extraComponents:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should KfConfig have a spec and status and follow the K8s resource model?

Status could provide information about things like version; e.g. if the underlying source has changed this could be reported via status.

Also it allows us to think of the resource as a controller where spec describes desired state and status provides actual state.

type: "array"
items:
$ref: "#/definitions/DeploymentMetadata"
KfConfigFile:
Copy link
Contributor

Choose a reason for hiding this comment

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

Per comment above what's this for?

description: "Deployment name"
required: true
schema:
$ref: "#/definitions/KfDeployment"
Copy link
Contributor

Choose a reason for hiding this comment

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

How does kfDeployment relate to the Config?

Is KfDeployment just a pointer to the config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Relation between kfDeployment and KfConfig is like
relation between notebook instance and notebook image:
User can spawn up kfDeployment from existing KfConfig entries.

Copy link
Contributor

@jlewi jlewi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 15 unresolved discussions (waiting on @abhi-g, @ellis-bigelow, and @kunmingg)


bootstrap/api/swagger.yaml, line 77 at r2 (raw file):

Previously, kunmingg (Kunming Qu) wrote…

This helper API provide read / write of single config file in underlying storage:

  1. as of today for source repo there are not such API available.
  2. existing edit UI is confusing because it aimed to solve more complicated day-to-day dev use case.
  3. If suggest user change config directly with underlying storage, user experience becomes:
    Create config entry in UI -> setup git and git clone -> edit config -> git push -> apply in UI

With this API we can have experience:
Create config entry in UI -> edit config file in UI -> apply in UI
Then we provide whole experience within UI, would be much easier for usage like editing GCP options

Is version referring to a git version?

Should the API not expose the version? The user just fetches and/or uploads a file (or tarball) containing the file contains.

The implementation is responsible for committing this to a source repo if that is the desired state.


bootstrap/api/swagger.yaml, line 184 at r2 (raw file):

Previously, kunmingg (Kunming Qu) wrote…

Relation between kfDeployment and KfConfig is like
relation between notebook instance and notebook image:
User can spawn up kfDeployment from existing KfConfig entries.

Does KfConfig refer to a KfApp?

Specifically does it refer to the set of files that would be in the KfApp dir?


bootstrap/api/swagger.yaml, line 269 at r2 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Should KfConfig have a spec and status and follow the K8s resource model?

Status could provide information about things like version; e.g. if the underlying source has changed this could be reported via status.

Also it allows us to think of the resource as a controller where spec describes desired state and status provides actual state.

Thoughts?


bootstrap/api/swagger.yaml, line 12 at r3 (raw file):

    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
basePath: "/kfctl/v1"

How difficult would be it to generate documentation for the API?

I find it a lot hard to evaluate the API based on the YAMl file. Generated docs might help.


bootstrap/api/swagger.yaml, line 26 at r3 (raw file):

      tags:
        - "configEntry"
      summary: "Create a new kubeflow config entry on source repo"

What is a ConfigEntry? Is a ConfigEntry the entire contents of ${KFAPP}?


bootstrap/api/swagger.yaml, line 124 at r3 (raw file):

    get:
      tags:
        - "configFile"

Why get/set individual files?

Why not upload a complete bundle corresponding to the KFAPP?

If we need a different API just to support some use cases in the UI (e.g. editing certain files) maybe we should do that as part of adding that functionality to the web app and mark it as an internal API.

@jlewi
Copy link
Contributor

jlewi commented Mar 7, 2019

@kunmingg Thanks. Could you take a look at some of my previous comments such as adding a spec and status.

If your blocked on getting started on implementation I think we can go ahead and merge this.

We will likely need to make some revisions in the future anyway after circulating it more broadly.

I think it would help to actually generate the API documentation (we could do that in a follow on PR) but that is probably a lot more readable then the swagger spec.

/lgtm
/approve
/hold

Copy link
Contributor Author

@kunmingg kunmingg left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 15 unresolved discussions (waiting on @abhi-g, @ellis-bigelow, @jlewi, and @kunmingg)


bootstrap/api/swagger.yaml, line 76 at r1 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Following K8s style should we add a status section and use conditions to report status?

Done.


bootstrap/api/swagger.yaml, line 77 at r2 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Is version referring to a git version?

Should the API not expose the version? The user just fetches and/or uploads a file (or tarball) containing the file contains.

The implementation is responsible for committing this to a source repo if that is the desired state.

version is git version, currently we provide single file read / write, as whole config files set might be pretty large and increase flaky to download/upload + git operations.


bootstrap/api/swagger.yaml, line 184 at r2 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Does KfConfig refer to a KfApp?

Specifically does it refer to the set of files that would be in the KfApp dir?

One KfConfig refers to a set of config files (DM + ksonnet) on source repo


bootstrap/api/swagger.yaml, line 269 at r2 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Thoughts?

Will update


bootstrap/api/swagger.yaml, line 26 at r3 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

What is a ConfigEntry? Is a ConfigEntry the entire contents of ${KFAPP}?

One config entry is 1 KfConfig


bootstrap/api/swagger.yaml, line 124 at r3 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

Why get/set individual files?

Why not upload a complete bundle corresponding to the KFAPP?

If we need a different API just to support some use cases in the UI (e.g. editing certain files) maybe we should do that as part of adding that functionality to the web app and mark it as an internal API.

Sure, can do it.

@k8s-ci-robot k8s-ci-robot removed the lgtm label Mar 7, 2019
Copy link
Contributor

@jlewi jlewi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 15 unresolved discussions (waiting on @abhi-g, @ellis-bigelow, @jlewi, and @kunmingg)

a discussion (no related file):
The docs page really helps can you add link to that either in the .yaml file or in a README.



bootstrap/api/swagger.yaml, line 53 at r1 (raw file):

Previously, jlewi (Jeremy Lewi) wrote…

is this the body of the request?

Why are email, zone part of the metadata as opposed to being in the deployment spec?

And shouldn't the deploymentSpec have a link to the config it is using?

@jlewi
Copy link
Contributor

jlewi commented Mar 8, 2019

Discussed with Kunming. We'll submit as is and iterate in follow on PRs

Some open questions

  1. I'm not sure email should be a query parameter.

    • I think it might be better to make it part of the KfConfig; e.g. have a YAML file somewhere with users/groups to be granted permission
    • For purposes of auditing the email query arg isn't good because it can't be audited.
    • Audit logs will automatically be generated for all actions based on the access token used.
  2. Will move namespace into the KfConfig app.

@jlewi
Copy link
Contributor

jlewi commented Mar 8, 2019

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlewi

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

@kunmingg
Copy link
Contributor Author

kunmingg commented Mar 9, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot merged commit 6fa88b7 into kubeflow:master Mar 9, 2019
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
* new deploy API following Open API format

* start

* split deployment APIs based on 2 types of objects: config and deployment

* remove host

* modify definitions following comments; add description for experimental APIs

* add delete methods; unify response code

* change following comments

* resolve review feedback; move email to query
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 12, 2021
* new deploy API following Open API format

* start

* split deployment APIs based on 2 types of objects: config and deployment

* remove host

* modify definitions following comments; add description for experimental APIs

* add delete methods; unify response code

* change following comments

* resolve review feedback; move email to query
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.

None yet

4 participants