Updated explanation of how to generate code in sample-apiserver

This commit is contained in:
Mike Spreitzer 2019-05-16 02:30:43 -04:00
parent 18b7fda68d
commit 9a4081faf7

View File

@ -24,19 +24,26 @@ HEAD of this repo will match HEAD of k8s.io/apiserver, k8s.io/apimachinery, and
`sample-apiserver` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/sample-apiserver. `sample-apiserver` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/sample-apiserver.
Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here. Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here.
## Fetch Dependencies
Using `godep` will work.
Using Go modules (`GO111MODULE=on`) will enable `go build` to work,
without putting dependencies anywhere obvious.
## Normal Build and Deploy ## Normal Build and Deploy
### Changes to the Types ### Changes to the Types
If you change the API object type definitions in any of the If you change the API object type definitions in any of the
`pkg/apis/.../types.go` files then you will need to update the files `pkg/apis/.../types.go` files then you will need to update the files
generated from the type definitions. There is no convenient script to generated from the type definitions. To do this, invoke
do this in the context of `$GOPATH/src/k8s.io/sample-apiserver`. `hack/update-codegen.sh` with `sample-apiserver` as your current
However, if you have fetched the whole `k8s.io/kubernetes` repository working directory; the script takes no arguments. But this requires
then there _is_ a convenient script that you can use. With certain dependencies to appear on your `$GOPATH` or in a local
`$GOPATH/src/k8s.io/kubernetes/staging/src/k8s.io/sample-apiserver` as `vendor` directory. If you used Go modules then issue the command `go
your current working directory, invoke `hack/update-codegen.sh`; the mod vendor` before `hack/update-codegen.sh`, to first create a local
script takes no arguments. `vendor` directory with the needed dependencies.
### Build the Binary ### Build the Binary