forked from antrea-io/antrea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add `// +genclient` mark so we can use *-gen tools to generate client codes automatically. Signed-off-by: Lan Luo <[email protected]>
- Loading branch information
1 parent
c21d88a
commit 906463c
Showing
58 changed files
with
4,800 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,9 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize | |
kustomize: ## Download kustomize locally if necessary. | ||
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected]) | ||
|
||
codegen: | ||
./hack/update-codegen.sh | ||
|
||
# go-get-tool will 'go get' any package $2 and install it to $1. | ||
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
define go-get-tool | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// +k8s:deepcopy-gen=package | ||
|
||
// Package v1 is the v1alpha1 version of the API. | ||
// +groupName=multicluster.crd.antrea.io | ||
package v1alpha1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects. | ||
var SchemeGroupVersion = GroupVersion | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2021 Antrea 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
GOPATH=`go env GOPATH` | ||
ANTREA_PKG="antrea.io/antrea" | ||
|
||
cd multicluster | ||
rm -rf pkg/client/{clientset,informers,listers} | ||
|
||
$GOPATH/bin/client-gen \ | ||
--clientset-name versioned \ | ||
--input-base "${ANTREA_PKG}/multicluster/apis" \ | ||
--input "multicluster/v1alpha1" \ | ||
--output-package "${ANTREA_PKG}/multicluster/pkg/client/clientset" \ | ||
--go-header-file hack/boilerplate.go.txt | ||
|
||
# Generate listers with K8s codegen tools. | ||
$GOPATH/bin/lister-gen \ | ||
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ | ||
--output-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ | ||
--go-header-file hack/boilerplate.go.txt | ||
|
||
|
||
# Generate informers with K8s codegen tools. | ||
$GOPATH/bin/informer-gen \ | ||
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ | ||
--versioned-clientset-package "${ANTREA_PKG}/multicluster/pkg/client/clientset/versioned" \ | ||
--listers-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \ | ||
--output-package "${ANTREA_PKG}/multicluster/pkg/client/informers" \ | ||
--go-header-file hack/boilerplate.go.txt | ||
|
||
$GOPATH/bin/deepcopy-gen \ | ||
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \ | ||
-O zz_generated.deepcopy \ | ||
--go-header-file hack/boilerplate.go.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2021 Antrea 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" | ||
IMAGE_NAME="antrea/codegen:kubernetes-1.21.0" | ||
|
||
function docker_run() { | ||
docker pull ${IMAGE_NAME} | ||
docker run --rm \ | ||
-w /go/src/antrea.io/antrea \ | ||
-v ${ANTREA_ROOT}:/go/src/antrea.io/antrea \ | ||
"${IMAGE_NAME}" "$@" | ||
} | ||
|
||
docker_run multicluster/hack/update-codegen-dockerized.sh |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
multicluster/pkg/client/clientset/versioned/fake/clientset_generated.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.