Skip to content

Commit 3ecc6d9

Browse files
authored
Merge pull request #203 from yuxiangqian/master
update to client-go
2 parents 9053318 + 728e29a commit 3ecc6d9

File tree

1,128 files changed

+167914
-5344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,128 files changed

+167914
-5344
lines changed

OWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ approvers:
44
- jingxu97
55
- xing-yang
66
- wackxu
7+
- yuxiangqian

go.mod

+7-11
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@ require (
66
github.com/container-storage-interface/spec v1.1.0
77
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
88
github.com/golang/mock v1.2.0
9-
github.com/golang/protobuf v1.3.1
9+
github.com/golang/protobuf v1.3.2
1010
github.com/google/go-cmp v0.3.1 // indirect
1111
github.com/googleapis/gnostic v0.2.0 // indirect
12-
github.com/hashicorp/golang-lru v0.5.1 // indirect
1312
github.com/imdario/mergo v0.3.7 // indirect
1413
github.com/kubernetes-csi/csi-lib-utils v0.6.1
1514
github.com/kubernetes-csi/csi-test v2.0.0+incompatible
16-
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
17-
google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2 // indirect
18-
google.golang.org/grpc v1.19.1
19-
gopkg.in/inf.v0 v0.9.1 // indirect
20-
k8s.io/api v0.0.0-20190809220925-3ab596449d6f
21-
k8s.io/apimachinery v0.0.0-20190809020650-423f5d784010
22-
k8s.io/client-go v0.0.0-20190809221226-62f300f03a5f
23-
k8s.io/klog v0.3.1
15+
google.golang.org/grpc v1.23.0
16+
k8s.io/api v0.0.0-20191122220107-b5267f2975e0
17+
k8s.io/apimachinery v0.0.0-20191121175448-79c2a76c473a
18+
k8s.io/client-go v0.0.0-20191122220542-ed16ecbdf3a0
19+
k8s.io/code-generator v0.0.0-20191121015212-c4c8f8345c7e
20+
k8s.io/klog v1.0.0
2421
k8s.io/kubernetes v1.14.0
25-
k8s.io/utils v0.0.0-20190809000727-6c36bc71fc4a // indirect
2622
)

go.sum

+125-38
Large diffs are not rendered by default.

hack/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Scripts User Guide
2+
3+
This README documents:
4+
* What update-crd.sh and update-generated-code.sh do
5+
* When and how to use them
6+
7+
## update-generated-code.sh
8+
9+
This is the script to update clientset/informers/listers and API deepcopy code using [code-generator](https://github.com/kubernetes/code-generator).
10+
11+
Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.
12+
13+
To run this script, simply run: ./hack/update-generated-code.sh from the project root directory.
14+
15+
## update-crd.sh
16+
17+
This is the script to update CRD yaml files under ./config/crd/ based on types.go file.
18+
19+
Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.
20+
21+
Follow these steps to update the CRD:
22+
23+
* Run ./hack/update-crd.sh from root directory, new yaml files should have been created under ./config/crd/
24+
25+
* Replace `api-approved.kubernetes.io` annotation value in all yaml files in the metadata section with your PR.
26+
For example, `api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/YOUR-PULL-REQUEST-#"`
27+
28+
* Remove any metadata sections from the yaml file which does not belong to the generated type.
29+
For example, the following command will add a metadata section for a nested object, remove any newly added metadata sections. TODO(xiangqian): this is to make sure the generated CRD is compatible with apiextensions.k8s.io/v1. Once controller-gen supports generating CRD with apiextensions.k8s.io/v1, switch to use the correct version of controller-gen and remove the last step from this README.
30+
```bash
31+
./hack/update-crd.sh; git diff
32+
+ metadata:
33+
+ description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
34+
```

hack/tools.go

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// +build tools
2+
3+
/*
4+
Copyright 2019 The Kubernetes Authors.
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
// This package contains code generation utilities
17+
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
18+
package tools
19+
20+
import (
21+
_ "k8s.io/code-generator"
22+
)

hack/update-crd.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
#set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
## find or download controller-gen
22+
CONTROLLER_GEN=$(which controller-gen)
23+
24+
if [ "$CONTROLLER_GEN" = "" ]
25+
then
26+
TMP_DIR=$(mktemp -d);
27+
cd $TMP_DIR;
28+
go mod init tmp;
29+
go get sigs.k8s.io/controller-tools/cmd/[email protected];
30+
rm -rf $TMP_DIR;
31+
CONTROLLER_GEN=$(which controller-gen)
32+
fi
33+
34+
if [ "$CONTROLLER_GEN" = "" ]
35+
then
36+
echo "ERROR: failed to get controller-gen";
37+
exit 1;
38+
fi
39+
40+
SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
41+
42+
$CONTROLLER_GEN crd:trivialVersions=true,preserveUnknownFields=false paths=${SCRIPT_ROOT}/pkg/apis/volumesnapshot/v1beta1
43+
44+
# To use your own boilerplate text use:
45+
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt

hack/update-generated-code.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ set -o nounset
1919
set -o pipefail
2020

2121
SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
22-
#cd $ROOT
23-
#SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
22+
2423
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
2524

2625
# generate the code with:
2726
# --output-base because this script should also be able to run inside the vendor dir of
2827
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
2928
# instead of the $GOPATH directly. For normal projects this can be dropped.
30-
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
29+
bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
3130
github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
3231
volumesnapshot:v1beta1 \
3332
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt

pkg/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go

+18-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/clientset/versioned/clientset.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/clientset/versioned/fake/clientset_generated.go

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/clientset/versioned/typed/volumesnapshot/v1beta1/volumesnapshot_client.go

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/informers/externalversions/volumesnapshot/interface.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/PuerkitoBio/purell/.gitignore

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/PuerkitoBio/purell/.travis.yml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/PuerkitoBio/purell/LICENSE

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)