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

Generating API reference docs for federation apiserver #31759

Merged
merged 3 commits into from
Aug 31, 2016

Conversation

nikhiljindal
Copy link
Contributor

@nikhiljindal nikhiljindal commented Aug 31, 2016

Fixes #30541

Adding a script update-federation-api-reference-docs.sh similar to the existing update-api-reference-docs.sh for kube-apiserver. Have moved the common parts to hack/lib/swagger.sh.
The new script will produce API reference docs for federation-apiserver.

Next step will be to surface these docs at kubernetes.io.

cc @kubernetes/sig-cluster-federation @kubernetes/sig-api-machinery @caesarxuchao


This change is Reviewable

@nikhiljindal nikhiljindal added this to the v1.4 milestone Aug 31, 2016
@nikhiljindal nikhiljindal added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. area/cluster-federation release-note-none Denotes a PR that doesn't merit a release note. labels Aug 31, 2016
@k8s-github-robot k8s-github-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 31, 2016
@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@nikhiljindal
Copy link
Contributor Author

@k8s-bot ok to test

@@ -3,6 +3,10 @@
"apiVersion": "",
"basePath": "https://10.10.10.10:6443",
"resourcePath": "/api",
"info": {
Copy link
Member

Choose a reason for hiding this comment

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

What is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These got added as a result of #30914.

These fields are part of the spec, go-restful might have recently added support for it.

@caesarxuchao
Copy link
Member

Review status: 0 of 22 files reviewed at latest revision, 5 unresolved discussions.


hack/update-api-reference-docs.sh, line 38 [r2] (raw file):

GROUP_VERSIONS=("v1" "extensions/v1beta1" "batch/v1" "autoscaling/v1" "certificates/v1alpha1")
GV_DIRS=()

This looks to be copied from the original code, but I think using kube::util::group-version-to-pkg-path will make it cleaner.


hack/update-federation-api-reference-docs.sh, line 40 [r2] (raw file):

GROUP_VERSIONS=("federation/v1beta1" "v1" "extensions/v1beta1")
GV_DIRS=()
for gv in "${GROUP_VERSIONS[@]}"; do

Same here, using kube::util::group-version-to-pkg-path seems better.


hack/lib/swagger.sh, line 79 [r2] (raw file):

  echo "Generating API reference docs for group versions: ${GROUP_VERSIONS[@]}, at dirs: ${GV_DIRS[@]}"
  GROUP_VERSIONS=(${GROUP_VERSIONS[@]})
  GV_DIRS=(${GV_DIRS[@]})

Are these two lines redundant?


Comments from Reviewable

@caesarxuchao
Copy link
Member

Just some minor comments and a question on what the generated code is.


Review status: 0 of 22 files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@madhusudancs
Copy link
Contributor

A few minor comments, but looks good otherwise. I will however let @caesarxuchao to add the LGTM label.


Reviewed 2 of 14 files at r1.
Review status: 2 of 22 files reviewed at latest revision, 11 unresolved discussions.


federation/apis/swagger-spec/apis.json, line 6 [r1] (raw file):

  "basePath": "https://10.10.10.10:6443",
  "resourcePath": "/apis",
  "info": {

Same as @caesarxuchao's previous comment.


federation/apis/swagger-spec/extensions.json, line 6 [r1] (raw file):

  "basePath": "https://10.10.10.10:6443",
  "resourcePath": "/apis/extensions",
  "info": {

Same as above.


federation/apis/swagger-spec/extensions_v1beta1.json, line 6 [r1] (raw file):

  "basePath": "https://10.10.10.10:6443",
  "resourcePath": "/apis/extensions/v1beta1",
  "info": {

Same as above.


federation/apis/swagger-spec/extensions_v1beta1.json, line 2858 [r1] (raw file):

      "description": "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine"
     },
     "quobyte": {

A little curious about why this is here.


federation/apis/swagger-spec/federation.json, line 6 [r1] (raw file):

  "basePath": "https://10.10.10.10:6443",
  "resourcePath": "/apis/federation",
  "info": {

Same comment as above and in all the many following occurrences.


hack/update-federation-generated-swagger-docs.sh, line 3 [r1] (raw file):

#!/bin/bash

# Copyright 2015 The Kubernetes Authors.

2016?


Comments from Reviewable

@madhusudancs
Copy link
Contributor

madhusudancs commented Aug 31, 2016

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/federation/v1beta1/operations.html

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/federation/v1beta1/definitions.html

I see a stray *versioned.Event here. What is that supposed to be?

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/extensions/v1beta1/operations.html

Articles preceding "Ingress" are all incorrect. For example, create a Ingress should be create an Ingress. Is there a way to fix that?

Do we allow reading the scale subresource in federation? If not we should remove it from this doc here.

Also, the headings for Scale subresources should be fixed. This is also a problem in Kubernetes reference docs, not specific to Federation. For example, read scale of the specified Scale should be read scale of the specified ReplicaSet. I am still not sure if that is correct. I don't know what it means to read "the scale" of a ReplicaSet, but I also don't know what's the correct formation.

Watch documentation ordering is pretty weird. (Also applies to Kubernetes). Any why we list watch in the end and everything else with the corresponding resources?

@nikhiljindal
Copy link
Contributor Author

Review status: 2 of 22 files reviewed at latest revision, 11 unresolved discussions.


federation/apis/swagger-spec/extensions_v1beta1.json, line 2858 [r1] (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

A little curious about why this is here.

This must have been recently added to the PodTemplateSpec. Its here because ReplicaSetSpec includes PodTemplateSpec.

hack/update-api-reference-docs.sh, line 38 [r2] (raw file):

Previously, caesarxuchao (Chao Xu) wrote…

This looks to be copied from the original code, but I think using kube::util::group-version-to-pkg-path will make it cleaner.

Done

hack/update-federation-api-reference-docs.sh, line 40 [r2] (raw file):

Previously, caesarxuchao (Chao Xu) wrote…

Same here, using kube::util::group-version-to-pkg-path seems better.

Done

hack/update-federation-generated-swagger-docs.sh, line 3 [r1] (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

2016?

Fixed

hack/lib/swagger.sh, line 79 [r2] (raw file):

Previously, caesarxuchao (Chao Xu) wrote…

Are these two lines redundant?

No. Without these GROUP_VERSIONS is a single string "v1 extensions/v1beta1". This command turns it into an array.

Comments from Reviewable

@ghost ghost added kind/documentation Categorizes issue or PR as related to documentation. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Aug 31, 2016
@nikhiljindal
Copy link
Contributor Author

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/federation/v1beta1/operations.html

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/federation/v1beta1/definitions.html
I see a stray *versioned.Event here. What is that supposed to be?

https://htmlpreview.github.io/?https://raw.githubusercontent.com/nikhiljindal/kubernetes/fedSwaggerDoc/federation/docs/api-reference/extensions/v1beta1/operations.html

Articles preceding "Ingress" are all incorrect. For example, create a Ingress should be create an Ingress. Is there a way to fix that?

Yes it is possible to fix it. That doc is generated here:

doc := "create a " + kind

Do we allow reading the scale subresource in federation? If not we should remove it from this doc here.

Yes, we support replicasets/scale:

"replicasets/scale": replicaSetStorage.Scale,

Also, the headings for Scale subresources should be fixed. This is also a problem in Kubernetes reference docs, not specific to Federation. For example, read scale of the specified Scale should be read scale of the specified ReplicaSet. I am still not sure if that is correct. I don't know what it means to read "the scale" of a ReplicaSet, but I also don't know what's the correct formation.

Watch documentation ordering is pretty weird. (Also applies to Kubernetes). Any why we list watch in the end and everything else with the corresponding resources?

@nikhiljindal
Copy link
Contributor Author

Pushed a new commit as per comments, PTAL.

@madhusudancs
Copy link
Contributor

Review status: 2 of 22 files reviewed at latest revision, 11 unresolved discussions.


federation/apis/swagger-spec/extensions_v1beta1.json, line 2858 [r1] (raw file):

Previously, nikhiljindal (Nikhil Jindal) wrote…

This must have been recently added to the PodTemplateSpec. Its here because ReplicaSetSpec includes PodTemplateSpec.

Makes sense.

Also, sorry I did not see this file's path correctly. Reviewable kind of makes it hard. I can't see the full path of the file I am reviewing until I hover on it. So I did not see this was in the federation directory. I was wondering why such a change was not already applied before when someone made the API change in Kubernetes. Now that I see federation/... in the path, it makes sense.


Comments from Reviewable

@madhusudancs
Copy link
Contributor

Articles preceding "Ingress" are all incorrect. For example, create a Ingress should be create an Ingress. Is there a way to fix that?

Yes it is possible to fix it. That doc is generated here:

doc := "create a " + kind

Fixing it there would change it for all the resources unless we actually semi-smart article detector right? My question was more on the lines of fixing it only for Ingress.

Do we allow reading the scale subresource in federation? If not we should remove it from this doc here.

Yes, we support replicasets/scale:

"replicasets/scale": replicaSetStorage.Scale,

Cool! Thanks for confirming.

@nikhiljindal
Copy link
Contributor Author

Articles preceding "Ingress" are all incorrect. For example, create a Ingress should be create an Ingress. Is there a way to fix that?

Yes it is possible to fix it. That doc is generated here:

doc := "create a " + kind

Fixing it there would change it for all the resources unless we actually semi-smart article detector right? My question was more on the lines of fixing it only for Ingress.

Yes, need to use an article detector. Other option will be to add an if there hardcoding ingress :)
But thats the place to set it appropriately.

@caesarxuchao
Copy link
Member

Thank you both! LGTM.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 31, 2016
@nikhiljindal
Copy link
Contributor Author

Squashed the last commit, thanks!

@nikhiljindal nikhiljindal added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Aug 31, 2016
@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

GCE e2e build/test passed for commit 633c549.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

GCE e2e build/test passed for commit 633c549.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 199338a into kubernetes:master Aug 31, 2016
@nikhiljindal
Copy link
Contributor Author

Sent kubernetes/website#1143 to import these docs on k8s.io

k8s-github-robot pushed a commit that referenced this pull request Sep 16, 2016
Automatic merge from submit-queue

Adding a README for federation API ref docs

The API ref docs were added in #31759

README makes it easy to link to all other API-ref docs.

This is similar to the existing docs/api-reference/README.md for kubernetes.

cc @kubernetes/sig-cluster-federation @caesarxuchao
eparis pushed a commit to eparis/kubernetes that referenced this pull request Sep 17, 2016
Automatic merge from submit-queue

Adding a README for federation API ref docs

The API ref docs were added in kubernetes#31759

README makes it easy to link to all other API-ref docs.

This is similar to the existing docs/api-reference/README.md for kubernetes.

cc @kubernetes/sig-cluster-federation @caesarxuchao
(cherry picked from commit e10b061)
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
Automatic merge from submit-queue

Adding a README for federation API ref docs

The API ref docs were added in kubernetes#31759

README makes it easy to link to all other API-ref docs.

This is similar to the existing docs/api-reference/README.md for kubernetes.

cc @kubernetes/sig-cluster-federation @caesarxuchao
(cherry picked from commit e10b061)
perotinus pushed a commit to kubernetes-retired/cluster-registry that referenced this pull request Sep 2, 2017
Automatic merge from submit-queue

Adding a README for federation API ref docs

The API ref docs were added in kubernetes/kubernetes#31759

README makes it easy to link to all other API-ref docs.

This is similar to the existing docs/api-reference/README.md for kubernetes.

cc @kubernetes/sig-cluster-federation @caesarxuchao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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.

6 participants