Skip to content

Commit 0111984

Browse files
authored
Merge pull request #80 from astoycos/fix-codegen
Fix codegen
2 parents 4713a66 + 5115949 commit 0111984

30 files changed

+97
-192
lines changed

Makefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Get the current working directory for this code
2+
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
3+
14
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
25
ifeq (,$(shell go env GOBIN))
36
GOBIN=$(shell go env GOPATH)/bin
@@ -28,7 +31,7 @@ CLIENTSET_PKG_NAME ?= clientset
2831
API_PKG ?= sigs.k8s.io/network-policy-api
2932
API_GROUP_NAME ?= policy.networking.k8s.io
3033
API_DIR ?= ${API_PKG}/apis/v1alpha1
31-
OUTPUT_PKG ?= sigs.k8s.io/network-policy-api/client
34+
OUTPUT_PKG ?= sigs.k8s.io/network-policy-api/pkg/client
3235
COMMON_FLAGS ?= --go-header-file $(shell pwd)/hack/boilerplate.go.txt
3336

3437
.PHONY: manifests
@@ -44,7 +47,19 @@ vet: ## Run go vet against code.
4447
go vet ./...
4548

4649
.PHONY: generate
47-
generate: generate-deepcopy generate-typed-clients generate-typed-listers generate-typed-informers
50+
generate: generate-setup generate-deepcopy generate-typed-clients generate-typed-listers generate-typed-informers generate-cleanup
51+
52+
.PHONY: generate-setup
53+
generate-setup:
54+
# Even when modules are enabled, the code-generator tools always write to
55+
# a traditional GOPATH directory, so fake on up to point to the current
56+
# workspace.
57+
mkdir -p "${GOPATH}/src/sigs.k8s.io"
58+
ln -sf "${ROOT_DIR}" "${GOPATH}/src/sigs.k8s.io/network-policy-api"
59+
60+
.PHONY: generate-cleanup
61+
generate-cleanup:
62+
rm -rf "${GOPATH}/src/sigs.k8s.io"
4863

4964
.PHONY: generate-deepcopy
5065
generate-deepcopy: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

apis/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
)
2525

2626
// +genclient
27+
// +genclient:nonNamespaced
2728
// +kubebuilder:object:root=true
2829
// +kubebuilder:subresource:status
2930
// +kubebuilder:resource:shortName=anp,scope=Cluster

apis/v1alpha1/baselineadminnetworkpolicy_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
)
2121

2222
// +genclient
23+
// +genclient:nonNamespaced
2324
// +kubebuilder:object:root=true
2425
// +kubebuilder:subresource:status
2526
// +kubebuilder:resource:shortName=banp,scope=Cluster

hack/verify-codegen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -o pipefail
2020

2121
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
2222

23-
make -C "$SCRIPT_ROOT" generate
23+
make -C "$SCRIPT_ROOT" generate-deepcopy generate-typed-clients generate-typed-listers generate-typed-informers
2424

2525
if git status -s 2>&1 | grep -E -q '^\s+[MADRCU]'
2626
then

client/clientset/versioned/clientset.go renamed to pkg/client/clientset/versioned/clientset.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)