forked from GoogleContainerTools/kpt-config-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.reconcilermanager
48 lines (44 loc) · 1.6 KB
/
Makefile.reconcilermanager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# Generate DeepCopy and runtime.Object implementation methods.
generate: controller-gen
$(CONTROLLER_GEN) \
object:headerFile="hack/boilerplate.txt" \
paths="./pkg/api/configsync/v1alpha1" \
paths="./pkg/api/configsync/v1beta1" \
paths="./pkg/api/configmanagement/v1"
# Generate configsync CRDs
configsync-crds: controller-gen
$(CONTROLLER_GEN) \
crd \
crd:trivialVersions=true \
paths="./pkg/api/configsync/v1alpha1" \
paths="./pkg/api/configsync/v1beta1" \
output:artifacts:config=manifests \
&& mv manifests/configsync.gke.io_reposyncs.yaml manifests/patch/reposync-crd.yaml \
&& mv manifests/configsync.gke.io_rootsyncs.yaml manifests/patch/rootsync-crd.yaml; \
kustomize build ./manifests/patch -o ./manifests; \
mv ./manifests/*customresourcedefinition_rootsyncs* ./manifests/rootsync-crd.yaml; \
mv ./manifests/*customresourcedefinition_reposyncs* ./manifests/reposync-crd.yaml; \
rm ./manifests/patch/reposync-crd.yaml; \
rm ./manifests/patch/rootsync-crd.yaml; \
# find or download controller-gen
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go install sigs.k8s.io/controller-tools/cmd/[email protected] ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif