Skip to content

Commit

Permalink
Merge pull request #203 from yuxiangqian/master
Browse files Browse the repository at this point in the history
update to client-go
  • Loading branch information
k8s-ci-robot authored Dec 4, 2019
2 parents 9053318 + 728e29a commit 3ecc6d9
Show file tree
Hide file tree
Showing 1,128 changed files with 167,914 additions and 5,344 deletions.
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ approvers:
- jingxu97
- xing-yang
- wackxu
- yuxiangqian
18 changes: 7 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ require (
github.com/container-storage-interface/spec v1.1.0
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.3.1
github.com/golang/protobuf v1.3.2
github.com/google/go-cmp v0.3.1 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.6.1
github.com/kubernetes-csi/csi-test v2.0.0+incompatible
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2 // indirect
google.golang.org/grpc v1.19.1
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20190809220925-3ab596449d6f
k8s.io/apimachinery v0.0.0-20190809020650-423f5d784010
k8s.io/client-go v0.0.0-20190809221226-62f300f03a5f
k8s.io/klog v0.3.1
google.golang.org/grpc v1.23.0
k8s.io/api v0.0.0-20191122220107-b5267f2975e0
k8s.io/apimachinery v0.0.0-20191121175448-79c2a76c473a
k8s.io/client-go v0.0.0-20191122220542-ed16ecbdf3a0
k8s.io/code-generator v0.0.0-20191121015212-c4c8f8345c7e
k8s.io/klog v1.0.0
k8s.io/kubernetes v1.14.0
k8s.io/utils v0.0.0-20190809000727-6c36bc71fc4a // indirect
)
163 changes: 125 additions & 38 deletions go.sum

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions hack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Scripts User Guide

This README documents:
* What update-crd.sh and update-generated-code.sh do
* When and how to use them

## update-generated-code.sh

This is the script to update clientset/informers/listers and API deepcopy code using [code-generator](https://github.com/kubernetes/code-generator).

Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.

To run this script, simply run: ./hack/update-generated-code.sh from the project root directory.

## update-crd.sh

This is the script to update CRD yaml files under ./config/crd/ based on types.go file.

Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.

Follow these steps to update the CRD:

* Run ./hack/update-crd.sh from root directory, new yaml files should have been created under ./config/crd/

* Replace `api-approved.kubernetes.io` annotation value in all yaml files in the metadata section with your PR.
For example, `api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/YOUR-PULL-REQUEST-#"`

* Remove any metadata sections from the yaml file which does not belong to the generated type.
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.
```bash
./hack/update-crd.sh; git diff
+ metadata:
+ description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
```
22 changes: 22 additions & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// +build tools

/*
Copyright 2019 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.
*/

// This package contains code generation utilities
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools

import (
_ "k8s.io/code-generator"
)
45 changes: 45 additions & 0 deletions hack/update-crd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Copyright 2019 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.

#set -o errexit
set -o nounset
set -o pipefail

## find or download controller-gen
CONTROLLER_GEN=$(which controller-gen)

if [ "$CONTROLLER_GEN" = "" ]
then
TMP_DIR=$(mktemp -d);
cd $TMP_DIR;
go mod init tmp;
go get sigs.k8s.io/controller-tools/cmd/[email protected];
rm -rf $TMP_DIR;
CONTROLLER_GEN=$(which controller-gen)
fi

if [ "$CONTROLLER_GEN" = "" ]
then
echo "ERROR: failed to get controller-gen";
exit 1;
fi

SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)

$CONTROLLER_GEN crd:trivialVersions=true,preserveUnknownFields=false paths=${SCRIPT_ROOT}/pkg/apis/volumesnapshot/v1beta1

# To use your own boilerplate text use:
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
5 changes: 2 additions & 3 deletions hack/update-generated-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ set -o nounset
set -o pipefail

SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
#cd $ROOT
#SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..

CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}

# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
volumesnapshot:v1beta1 \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
Expand Down
20 changes: 18 additions & 2 deletions pkg/apis/volumesnapshot/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion 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.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/PuerkitoBio/purell/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/PuerkitoBio/purell/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/PuerkitoBio/purell/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3ecc6d9

Please sign in to comment.