Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge e0e7f05 into 7effd62
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed May 7, 2020
2 parents 7effd62 + e0e7f05 commit b5a2cac
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 89 deletions.
54 changes: 54 additions & 0 deletions bin/gen-kube
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

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

GO111MODULE=${GO111MODULE:-on} #Always on, so it works also inside GOPATH
GIT_ROOT=${GIT_ROOT:-$(git rev-parse --show-toplevel)}
PROJECT=${PROJECT:-quarks-operator}

# The groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2"
GROUP_VERSIONS="${GROUP_VERSIONS:-boshdeployment:v1alpha1 quarksstatefulset:v1alpha1 quarkssecret:v1alpha1}"

if [ -z ${GIT_ROOT+x} ] || [ ! -d "$GIT_ROOT" ]; then
echo "Git root not detected. Please set GIT_ROOT to point to the repository you want to update the version groups."
exit 1
fi

echo "Git root $GIT_ROOT ($PROJECT)"

cd "$GIT_ROOT"

if [ -z ${CODEGEN_PKG+x} ] || [ ! -d "$CODEGEN_PKG" ]; then
go mod vendor
fi

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

if [ -z ${CODEGEN_PKG+x} ]; then
echo "code-generator not found. Please run go mod vendor manually"
exit 1
fi

CODEGEN_VERSION=$(go list -u -m all | grep 'k8s.io/code-generator' | awk '{print $2}')

echo
echo "Using code-generator in $CODEGEN_PKG version $CODEGEN_VERSION"
echo
echo "WARNING: using codegen version referenced in quarks-utils go.mod"
echo " to pin to another version, set it in quarks-utils go.mod (and not in $PROJECT!)"
echo
echo "Generating group versions $GROUP_VERSIONS"

[ ! -d "codegen" ] && mkdir codegen

env GO111MODULE="$GO111MODULE" bash "${CODEGEN_PKG}/generate-groups.sh" "deepcopy,client,lister" \
code.cloudfoundry.org/${PROJECT}/pkg/kube/client \
code.cloudfoundry.org/${PROJECT}/pkg/kube/apis \
"${GROUP_VERSIONS}" \
--output-base "${GIT_ROOT}/codegen" \
--go-header-file "${GIT_ROOT}/gen/header.go.txt"

cp -rf ${GIT_ROOT}/codegen/code.cloudfoundry.org/${PROJECT}/pkg ${GIT_ROOT}
rm -rf ${GIT_ROOT}/codegen
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module code.cloudfoundry.org/quarks-utils
go 1.13

require (
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/go-logr/zapr v0.1.1
github.com/google/go-cmp v0.3.1 // indirect
github.com/imdario/mergo v0.3.8 // indirect
Expand All @@ -17,12 +16,10 @@ require (
github.com/spf13/viper v1.4.0
go.uber.org/zap v1.10.0
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
k8s.io/api v0.18.2
k8s.io/apiextensions-apiserver v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
k8s.io/code-generator v0.18.2
sigs.k8s.io/controller-runtime v0.6.0
sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca // indirect
sigs.k8s.io/testing_frameworks v0.1.2 // indirect
)

0 comments on commit b5a2cac

Please sign in to comment.