Skip to content

Commit

Permalink
Rename _examples to examples
Browse files Browse the repository at this point in the history
The alternative to this would be to special-case code-generator.  Since
it legit wants codegen, it seems wrong to make it be _examples (which tools
should ignore).

Make examples an "internal module" so the main go.mod for
k8s.io/code-generator does not get too polluted.
  • Loading branch information
thockin committed Jan 25, 2021
1 parent 1b07b0d commit 876c9f0
Show file tree
Hide file tree
Showing 401 changed files with 3,624 additions and 1,757 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ zz_generated_*_test.go
!staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go
!staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go
# low-change blueprint in code-generator to notice changes
!staging/src/k8s.io/code-generator/_examples/apiserver/openapi/zz_generated.openapi.go
!staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go
# low-change sample-apiserver spec to be compilable when published
!staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go

Expand Down
6 changes: 3 additions & 3 deletions api/api-rules/codegen_violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw
API rule violation: names_match,k8s.io/code-generator/_examples/apiserver/apis/example/v1,TestTypeStatus,Blah
API rule violation: names_match,k8s.io/code-generator/_examples/apiserver/apis/example2/v1,TestTypeStatus,Blah
API rule violation: names_match,k8s.io/code-generator/_examples/apiserver/apis/example3.io/v1,TestTypeStatus,Blah
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example/v1,TestTypeStatus,Blah
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example2/v1,TestTypeStatus,Blah
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example3.io/v1,TestTypeStatus,Blah
6 changes: 6 additions & 0 deletions build/kazel_generated.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ tags_values_pkgs = {"openapi-gen": {
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1",
"staging/src/k8s.io/client-go/pkg/version",
"staging/src/k8s.io/cloud-provider/config/v1alpha1",
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example/v1",
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example2/v1",
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io/v1",
"staging/src/k8s.io/controller-manager/config/v1alpha1",
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1",
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",
Expand Down Expand Up @@ -186,6 +189,9 @@ tags_pkgs_values = {"openapi-gen": {
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1": ["true"],
"staging/src/k8s.io/client-go/pkg/version": ["true"],
"staging/src/k8s.io/cloud-provider/config/v1alpha1": ["true"],
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example/v1": ["true"],
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example2/v1": ["true"],
"staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io/v1": ["true"],
"staging/src/k8s.io/controller-manager/config/v1alpha1": ["true"],
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1": ["true"],
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1": ["true"],
Expand Down
2 changes: 1 addition & 1 deletion build/root/Makefile.generated_files
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ SAMPLEAPISERVER_OPENAPI_TAG_FILES := $(filter $(APIMACHINERY_DEFAULT_TAG_FILES)
KUBE_OPENAPI_OUTPUT_PKG := pkg/generated/openapi
AGGREGATOR_OPENAPI_OUTPUT_PKG := staging/src/k8s.io/kube-aggregator/pkg/generated/openapi
APIEXTENSIONS_OPENAPI_OUTPUT_PKG := staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi
CODEGEN_OPENAPI_OUTPUT_PKG := staging/src/k8s.io/code-generator/_examples/apiserver/openapi
CODEGEN_OPENAPI_OUTPUT_PKG := staging/src/k8s.io/code-generator/examples/apiserver/openapi
SAMPLEAPISERVER_OPENAPI_OUTPUT_PKG := staging/src/k8s.io/sample-apiserver/pkg/generated/openapi

OPENAPI_TARGETS := KUBE AGGREGATOR APIEXTENSIONS CODEGEN SAMPLEAPISERVER
Expand Down
10 changes: 10 additions & 0 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ staging/src/k8s.io/code-generator/cmd/client-gen/types
staging/src/k8s.io/code-generator/cmd/conversion-gen/generators
staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf
staging/src/k8s.io/code-generator/cmd/lister-gen/generators
staging/src/k8s.io/code-generator/examples/HyphenGroup/apis/example/v1
staging/src/k8s.io/code-generator/examples/MixedCase/apis/example/v1
staging/src/k8s.io/code-generator/examples/apiserver/apis/example
staging/src/k8s.io/code-generator/examples/apiserver/apis/example/v1
staging/src/k8s.io/code-generator/examples/apiserver/apis/example2
staging/src/k8s.io/code-generator/examples/apiserver/apis/example2/v1
staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io
staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io/v1
staging/src/k8s.io/code-generator/examples/crd/apis/example/v1
staging/src/k8s.io/code-generator/examples/crd/apis/example2/v1
staging/src/k8s.io/component-base/cli/flag
staging/src/k8s.io/component-base/config/v1alpha1
staging/src/k8s.io/component-base/featuregate
Expand Down
1 change: 1 addition & 0 deletions hack/update-internal-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
# decoupled from their parent modules.
MODULES=(
hack/tools
staging/src/k8s.io/code-generator/examples
)

# Explicitly opt into go modules, even though we're inside a GOPATH directory
Expand Down
4 changes: 2 additions & 2 deletions hack/verify-generated-files-remake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ make generated_files >/dev/null
X="$(newer openapi "${STAMP}")"
if [[ -z "${X}" || ${X} != "./pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/code-generator/_examples/apiserver/openapi/zz_generated.openapi.go
./staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go
./staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go" ]]; then
echo "Wrong generated openapi files changed after touching src file:"
Expand Down Expand Up @@ -346,7 +346,7 @@ make generated_files UPDATE_API_KNOWN_VIOLATIONS=true >/dev/null
X="$(newer openapi "${STAMP}")"
if [[ -z "${X}" || ${X} != "./pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/code-generator/_examples/apiserver/openapi/zz_generated.openapi.go
./staging/src/k8s.io/code-generator/examples/apiserver/openapi/zz_generated.openapi.go
./staging/src/k8s.io/kube-aggregator/pkg/generated/openapi/zz_generated.openapi.go
./staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go" ]]; then
echo "Wrong generated openapi files changed after updating violation files:"
Expand Down
2 changes: 1 addition & 1 deletion staging/publishing/import-restrictions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

- baseImportPath: "./vendor/k8s.io/code-generator/"
ignoredSubTrees:
- "./vendor/k8s.io/code-generator/_test"
- "./vendor/k8s.io/code-generator/examples"
allowedImports:
- k8s.io/gengo
- k8s.io/code-generator
Expand Down
28 changes: 28 additions & 0 deletions staging/src/k8s.io/code-generator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ filegroup(
"//staging/src/k8s.io/code-generator/cmd/prerelease-lifecycle-gen:all-srcs",
"//staging/src/k8s.io/code-generator/cmd/register-gen:all-srcs",
"//staging/src/k8s.io/code-generator/cmd/set-gen:all-srcs",
"//staging/src/k8s.io/code-generator/examples/HyphenGroup/apis/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/HyphenGroup/clientset/versioned:all-srcs",
"//staging/src/k8s.io/code-generator/examples/HyphenGroup/informers/externalversions:all-srcs",
"//staging/src/k8s.io/code-generator/examples/HyphenGroup/listers/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/MixedCase/apis/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/MixedCase/clientset/versioned:all-srcs",
"//staging/src/k8s.io/code-generator/examples/MixedCase/informers/externalversions:all-srcs",
"//staging/src/k8s.io/code-generator/examples/MixedCase/listers/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/apis/example:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/apis/example2:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/apis/example3.io:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/clientset/internalversion:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/clientset/versioned:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/informers/externalversions:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/informers/internalversion:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example/internalversion:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example2/internalversion:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example2/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example3.io/internalversion:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/listers/example3.io/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/apiserver/openapi:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/apis/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/apis/example2/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/clientset/versioned:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/informers/externalversions:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/listers/example/v1:all-srcs",
"//staging/src/k8s.io/code-generator/examples/crd/listers/example2/v1:all-srcs",
"//staging/src/k8s.io/code-generator/hack:all-srcs",
"//staging/src/k8s.io/code-generator/pkg/namer:all-srcs",
"//staging/src/k8s.io/code-generator/pkg/util:all-srcs",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 876c9f0

Please sign in to comment.