mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-05 07:26:55 +00:00
NK17: Fixed code generation, updated README.md
This commit is contained in:
parent
b93fb184cc
commit
84cd3677ab
2 changed files with 48 additions and 11 deletions
34
README.md
34
README.md
|
@ -9,4 +9,38 @@ A Kubernetes native policy engine
|
|||
|
||||
# Installation
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You need to have go and dep utils installed on your machine.
|
||||
Ensure that GOPATH environment variable is set to desired location.
|
||||
Code generation for CRD controller uses kubernetes/hack as a dependency, so before use code generation, execute:
|
||||
|
||||
`go get k8s.io/kubernetes/hack`
|
||||
|
||||
## You can `go get`
|
||||
|
||||
Due to the repository privacy, you should to add SSH key to your github user to clone repository using `go get` command.
|
||||
Using `go get` you receive correct repository location ad $GOHOME/go/src which is needed to restore dependencies.
|
||||
Configure SSH key due to this article: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
|
||||
|
||||
After SSH key configured, you must tell git to use SSH. To do it use next command:
|
||||
|
||||
`git config --global url.git@github.com:.insteadOf https://github.com/`
|
||||
|
||||
After this is done, use next command to clone the repo:
|
||||
|
||||
`go get github.com/nirmata/kube-policy`
|
||||
|
||||
## Or `git clone`
|
||||
|
||||
If you don't want to use SSH, you just can clone repo with git, but ensure that repo will be inside this path: $GOPATH/src/.
|
||||
|
||||
`git clone https://github.com/nirmata/kube-policy.git $GOPATH/src/nirmata/kube-policy`
|
||||
|
||||
## Restore dependencies
|
||||
|
||||
Navigate to kube-policy project dir and execute:
|
||||
`dep restore`
|
||||
This will install necessary dependencies described in README.md
|
||||
|
||||
# Contributing
|
||||
|
|
|
@ -3,16 +3,19 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||
CODEGEN_PKG=${SCRIPT_ROOT}/vendor/k8s.io/code-generator
|
||||
# get nirmata root
|
||||
NIRMATA_DIR=$(dirname ${BASH_SOURCE})/..
|
||||
NIRMATA_ROOT=$(readlink -f ${NIRMATA_DIR})
|
||||
|
||||
# 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" \
|
||||
github.com/nirmata/kube-policy/pkg/client github.com/nirmata/kube-policy/pkg/apis \
|
||||
policy:v1alpha1
|
||||
# get relative path to code generation script
|
||||
CODEGEN_PKG=${NIRMATA_DIR}/vendor/k8s.io/code-generator
|
||||
|
||||
# To use your own boilerplate text use:
|
||||
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
|
||||
# get relative path of nirmata
|
||||
NIRMATA_PKG=${NIRMATA_ROOT#"${GOPATH}/src/"}
|
||||
|
||||
# perform code generation
|
||||
${CODEGEN_PKG}/generate-groups.sh \
|
||||
"deepcopy,client,informer,lister" \
|
||||
${NIRMATA_PKG}/pkg/client \
|
||||
${NIRMATA_PKG}/pkg/apis \
|
||||
policy:v1alpha1
|
||||
|
|
Loading…
Add table
Reference in a new issue