This repository was archived by the owner on Jul 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +56
-1
lines changed Expand file tree Collapse file tree 3 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ TOOLS_DIR := hack/tools
19
19
CONTROLLER_GEN_BIN := bin/controller-gen
20
20
CONTROLLER_GEN := $(TOOLS_DIR ) /$(CONTROLLER_GEN_BIN )
21
21
22
+ # Allow overriding manifest generation destination directory
23
+ MANIFEST_ROOT ?= "config"
24
+ CRD_ROOT ?= "$(MANIFEST_ROOT ) /crd/bases"
25
+ WEBHOOK_ROOT ?= "$(MANIFEST_ROOT ) /webhook"
26
+ RBAC_ROOT ?= "$(MANIFEST_ROOT ) /rbac"
27
+
22
28
# Active module mode, as we use go modules to manage dependencies
23
29
export GO111MODULE =on
24
30
@@ -54,7 +60,7 @@ deploy: manifests
54
60
# Generate manifests e.g. CRD, RBAC etc.
55
61
.PHONY : manifests
56
62
manifests : $(CONTROLLER_GEN )
57
- $(CONTROLLER_GEN ) $(CRD_OPTIONS ) rbac:roleName=manager-role webhook paths=" ./..." output:crd:artifacts:config=config/crd/bases
63
+ $(CONTROLLER_GEN ) $(CRD_OPTIONS ) rbac:roleName=manager-role webhook paths=" ./..." output:crd:dir= $( CRD_ROOT ) output:webhook:dir= $( WEBHOOK_ROOT ) output:rbac:dir= $( RBAC_ROOT )
58
64
59
65
# Run go fmt against code
60
66
.PHONY : fmt
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ outputs=()
38
38
39
39
# run all verify scripts, optionally skipping any of them
40
40
41
+ if [[ " ${VERIFY_MANIFESTS:- true} " == " true" ]]; then
42
+ echo " [*] Verifying manifests..."
43
+ out=$( hack/verify-manifests.sh 2>&1 )
44
+ failure $? " verify-manifests.sh" " ${out} "
45
+ cd " ${REPO_PATH} "
46
+ fi
47
+
41
48
if [[ " ${VERIFY_WHITESPACE:- true} " == " true" ]]; then
42
49
echo " [*] Verifying whitespace..."
43
50
out=$( hack/verify-whitespace.sh 2>&1 )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # Copyright 2019 The Kubernetes Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ set -o errexit
17
+ set -o nounset
18
+ set -o pipefail
19
+
20
+ REPO_ROOT=$( dirname " ${BASH_SOURCE[0]} " ) /..
21
+ DIFFROOT=" ${REPO_ROOT} /config"
22
+ TMP_ROOT=" ${REPO_ROOT} /_tmp"
23
+
24
+
25
+ cleanup () {
26
+ rm -rf " ${TMP_ROOT} "
27
+ }
28
+ trap " cleanup" EXIT SIGINT
29
+ cleanup
30
+
31
+ MANIFEST_ROOT=$TMP_ROOT make manifests
32
+
33
+ echo " diffing ${DIFFROOT} against freshly generated manifests"
34
+ ret=0
35
+ git diff --no-index --diff-filter=MD --stat ${TMP_ROOT} ${DIFFROOT} || ret=$?
36
+ if [[ $ret -eq 0 ]]
37
+ then
38
+ echo " Manifests in ${DIFFROOT} are up to date."
39
+ else
40
+ echo " Manifests in ${DIFFROOT} are out of date. Please run \` make manifests\` "
41
+ exit 1
42
+ fi
You can’t perform that action at this time.
0 commit comments