Make kubectl explain work for Pinniped aggregated APIs

- Change update-codegen.sh script to also generated openapi code for the
  aggregated API types
- Update both aggregated API servers' configuration to make them serve
  the openapi docs for the aggregated APIs
- Add new integration test which runs `kubectl explain` for all Pinniped
  API resources, and all fields and subfields of those resources
- Update some the comments on the API structs
- Change some names of the tmpl files to make the filename better match
  the struct names
This commit is contained in:
Ryan Richard
2022-08-30 12:11:17 -07:00
parent 1c296e5c4c
commit af01c3aeb6
174 changed files with 173901 additions and 2071 deletions

View File

@@ -128,18 +128,31 @@ echo "generating API-related code for our public API groups..."
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-api > |"
)
# Generate API-related code for our internal API groups
# Generate API-related code for our internal API groups.
# Note that OPENAPI_EXTRA_PACKAGES can be set to generate openapi docs for other k8s APIs that our types depend upon
# aside from the default k8s packages that are already added automatically by the generate-internal-groups.sh script
# (meta/v1, runtime, and version). E.g. TokenCredentialRequestSpec uses corev1.TypedLocalObjectReference, so we
# add core/v1 when running codegen for the Concierge aggregated APIs here.
echo "generating API-related code for our internal API groups..."
(cd apis &&
bash "${GOPATH}/src/k8s.io/code-generator/generate-internal-groups.sh" \
"deepcopy,defaulter,conversion" \
OPENAPI_EXTRA_PACKAGES="k8s.io/api/core/v1" \
bash -x "${GOPATH}/src/k8s.io/code-generator/generate-internal-groups.sh" \
"deepcopy,defaulter,conversion,openapi" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/client/concierge" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"concierge/login:v1alpha1 concierge/identity:v1alpha1 supervisor/clientsecret:v1alpha1" \
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-int-api > |"
"concierge/login:v1alpha1 concierge/identity:v1alpha1" \
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-concierge-int-api > |"
)
(cd apis &&
bash "${GOPATH}/src/k8s.io/code-generator/generate-internal-groups.sh" \
"deepcopy,defaulter,conversion,openapi" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/client/supervisor" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"supervisor/clientsecret:v1alpha1" \
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-supervisor-int-api > |"
)
# Tidy up the .../apis module
echo "tidying ${OUTPUT_DIR}/apis/go.mod..."
@@ -153,7 +166,7 @@ echo "generating client code for our public API groups..."
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/client/concierge" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"concierge/config:v1alpha1 concierge/authentication:v1alpha1 concierge/login:v1alpha1 concierge/identity:v1alpha1" \
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-client > |"
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-concierge-client > |"
)
(cd client &&
bash "${GOPATH}/src/k8s.io/code-generator/generate-groups.sh" \
@@ -161,7 +174,7 @@ echo "generating client code for our public API groups..."
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/client/supervisor" \
"${BASE_PKG}/generated/${KUBE_MINOR_VERSION}/apis" \
"supervisor/config:v1alpha1 supervisor/idp:v1alpha1 supervisor/clientsecret:v1alpha1" \
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-client > |"
--go-header-file "${ROOT}/hack/boilerplate.go.txt" -v "$debug_level" 2>&1 | sed "s|^|gen-supervisor-client > |"
)
# Tidy up the .../client module