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

Partial cherry-pick of #33182 #35203

Merged
merged 2 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4,362 changes: 4,362 additions & 0 deletions docs/api-reference/apps/v1alpha1/definitions.html

Large diffs are not rendered by default.

2,381 changes: 2,381 additions & 0 deletions docs/api-reference/apps/v1alpha1/operations.html

Large diffs are not rendered by default.

907 changes: 907 additions & 0 deletions docs/api-reference/authentication.k8s.io/v1beta1/definitions.html

Large diffs are not rendered by default.

565 changes: 565 additions & 0 deletions docs/api-reference/authentication.k8s.io/v1beta1/operations.html

Large diffs are not rendered by default.

997 changes: 997 additions & 0 deletions docs/api-reference/authorization.k8s.io/v1beta1/definitions.html

Large diffs are not rendered by default.

565 changes: 565 additions & 0 deletions docs/api-reference/authorization.k8s.io/v1beta1/operations.html

Large diffs are not rendered by default.

494 changes: 494 additions & 0 deletions docs/api-reference/batch/v2alpha1/definitions.html

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions docs/api-reference/batch/v2alpha1/operations.html

Large diffs are not rendered by default.

1,361 changes: 1,361 additions & 0 deletions docs/api-reference/policy/v1alpha1/definitions.html

Large diffs are not rendered by default.

2,381 changes: 2,381 additions & 0 deletions docs/api-reference/policy/v1alpha1/operations.html

Large diffs are not rendered by default.

1,731 changes: 1,731 additions & 0 deletions docs/api-reference/rbac.authorization.k8s.io/v1alpha1/definitions.html

Large diffs are not rendered by default.

5,860 changes: 5,860 additions & 0 deletions docs/api-reference/rbac.authorization.k8s.io/v1alpha1/operations.html

Large diffs are not rendered by default.

1,179 changes: 1,179 additions & 0 deletions docs/api-reference/storage.k8s.io/v1beta1/definitions.html

Large diffs are not rendered by default.

1,641 changes: 1,641 additions & 0 deletions docs/api-reference/storage.k8s.io/v1beta1/operations.html

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions hack/lib/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@ source "${KUBE_ROOT}/hack/lib/etcd.sh"

KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"

# list of all available group versions. This should be used when generated code
# or when starting an API server that you want to have everything.
# most preferred version for a group should appear first
KUBE_AVAILABLE_GROUP_VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS:-\
v1 \
apps/v1alpha1 \
authentication.k8s.io/v1beta1 \
authorization.k8s.io/v1beta1 \
autoscaling/v1 \
batch/v1 \
batch/v2alpha1 \
certificates.k8s.io/v1alpha1 \
extensions/v1beta1 \
imagepolicy.k8s.io/v1alpha1 \
policy/v1alpha1 \
rbac.authorization.k8s.io/v1alpha1 \
storage.k8s.io/v1beta1\
}"

# not all group versions are exposed by the server. This list contains those
# which are not available so we don't generate clients or swagger for them
KUBE_NONSERVER_GROUP_VERSIONS="
imagepolicy.k8s.io/v1alpha1
"

# This emulates "readlink -f" which is not available on MacOS X.
# Test:
# T=/tmp/$$.$RANDOM
Expand Down
7 changes: 5 additions & 2 deletions hack/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ kube::util::group-version-to-pkg-path() {
echo "api/unversioned"
;;
*.k8s.io)
echo "apis/${group_version%.k8s.io}"
echo "apis/${group_version%.*k8s.io}"
;;
*.k8s.io/*)
echo "apis/${group_version/.k8s.io/}"
echo "apis/${group_version/.*k8s.io/}"
;;
*)
echo "apis/${group_version%__internal}"
Expand Down Expand Up @@ -347,6 +347,9 @@ kube::util::gv-to-swagger-name() {
# VERSIONS: Array of group versions to include in swagger spec.
kube::util::fetch-swagger-spec() {
for ver in ${VERSIONS}; do
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${ver} "* ]]; then
continue
fi
# fetch the swagger spec for each group version.
if [[ ${ver} == "v1" ]]; then
SUBPATH="api"
Expand Down
15 changes: 11 additions & 4 deletions hack/update-api-reference-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ OUTPUT=${1:-${DEFAULT_OUTPUT}}

SWAGGER_SPEC_PATH="${REPO_DIR}/api/swagger-spec"

GROUP_VERSIONS=("v1" "extensions/v1beta1" "batch/v1" "autoscaling/v1" "certificates.k8s.io/v1alpha1")
ALL_GROUP_VERSIONS=(${KUBE_AVAILABLE_GROUP_VERSIONS})
INTERESTING_GROUP_VERSIONS=()
GV_DIRS=()
for gv in "${GROUP_VERSIONS[@]}"; do
GV_DIRS+=("${REPO_DIR}/pkg/$(kube::util::group-version-to-pkg-path "${gv}")")
for gv in "${ALL_GROUP_VERSIONS[@]}"; do
# skip groups that aren't being served, clients for these don't matter
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then
continue
fi

INTERESTING_GROUP_VERSIONS+=(${gv})
GV_DIRS+=("${REPO_DIR}/pkg/$(kube::util::group-version-to-pkg-path "${gv}")")
done

GROUP_VERSIONS="${GROUP_VERSIONS[@]}" GV_DIRS="${GV_DIRS[@]}" kube::swagger::gen_api_ref_docs "${SWAGGER_SPEC_PATH}" "${OUTPUT}"
GROUP_VERSIONS="${INTERESTING_GROUP_VERSIONS[@]}" GV_DIRS="${GV_DIRS[@]}" kube::swagger::gen_api_ref_docs "${SWAGGER_SPEC_PATH}" "${OUTPUT}"

# ex: ts=2 sw=2 et filetype=sh
3 changes: 2 additions & 1 deletion hack/update-generated-swagger-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ source "${KUBE_ROOT}/hack/lib/swagger.sh"

kube::golang::setup_env

GROUP_VERSIONS=(unversioned v1 authentication/v1beta1 authorization/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 apps/v1alpha1 policy/v1alpha1 rbac/v1alpha1 storage/v1beta1 certificates/v1alpha1)
GROUP_VERSIONS=(unversioned ${KUBE_AVAILABLE_GROUP_VERSIONS})

# To avoid compile errors, remove the currently existing files.
for group_version in "${GROUP_VERSIONS[@]}"; do
rm -f "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
Expand Down
4 changes: 1 addition & 3 deletions hack/update-swagger-spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ APISERVER_PID=$!
kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "

SWAGGER_API_PATH="${API_HOST}:${API_PORT}/swaggerapi/"
DEFAULT_GROUP_VERSIONS="v1 apps/v1alpha1 authentication.k8s.io/v1beta1 authorization.k8s.io/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 certificates.k8s.io/v1alpha1 policy/v1alpha1 rbac.authorization.k8s.io/v1alpha1 storage.k8s.io/v1beta1"
VERSIONS=${VERSIONS:-$DEFAULT_GROUP_VERSIONS}

kube::log::status "Updating " ${SWAGGER_ROOT_DIR}

SWAGGER_API_PATH="${SWAGGER_API_PATH}" SWAGGER_ROOT_DIR="${SWAGGER_ROOT_DIR}" VERSIONS="${VERSIONS}" kube::util::fetch-swagger-spec
SWAGGER_API_PATH="${SWAGGER_API_PATH}" SWAGGER_ROOT_DIR="${SWAGGER_ROOT_DIR}" VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS}" KUBE_NONSERVER_GROUP_VERSIONS="${KUBE_NONSERVER_GROUP_VERSIONS}" kube::util::fetch-swagger-spec

kube::log::status "SUCCESS"

Expand Down
70 changes: 70 additions & 0 deletions pkg/apis/imagepolicy/v1alpha1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
Copyright 2016 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh

// AUTO-GENERATED FUNCTIONS START HERE
var map_ImageReview = map[string]string{
"": "ImageReview checks if the set of images in a pod are allowed.",
"spec": "Spec holds information about the pod being evaluated",
"status": "Status is filled in by the backend and indicates whether the pod should be allowed.",
}

func (ImageReview) SwaggerDoc() map[string]string {
return map_ImageReview
}

var map_ImageReviewContainerSpec = map[string]string{
"": "ImageReviewContainerSpec is a description of a container within the pod creation request.",
"image": "This can be in the form image:tag or image@SHA:012345679abcdef.",
}

func (ImageReviewContainerSpec) SwaggerDoc() map[string]string {
return map_ImageReviewContainerSpec
}

var map_ImageReviewSpec = map[string]string{
"": "ImageReviewSpec is a description of the pod creation request.",
"containers": "Containers is a list of a subset of the information in each container of the Pod being created.",
"annotations": "Annotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern `*.image-policy.k8s.io/*`. It is up to each webhook backend to determine how to interpret these annotations, if at all.",
"namespace": "Namespace is the namespace the pod is being created in.",
}

func (ImageReviewSpec) SwaggerDoc() map[string]string {
return map_ImageReviewSpec
}

var map_ImageReviewStatus = map[string]string{
"": "ImageReviewStatus is the result of the token authentication request.",
"allowed": "Allowed indicates that all images were allowed to be run.",
"reason": "Reason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.",
}

func (ImageReviewStatus) SwaggerDoc() map[string]string {
return map_ImageReviewStatus
}

// AUTO-GENERATED FUNCTIONS END HERE