Skip to content

Commit 9709f3b

Browse files
author
Per Goncalves da Silva
committed
Enable cgo for controller-gen calls
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 6aed67c commit 9709f3b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,19 @@ tidy: #HELP Update dependencies.
119119
.PHONY: manifests
120120
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
121121
KUSTOMIZE_RBAC_DIR := config/base/rbac
122+
123+
# Needed because otherwise we exclude Go all files in vendor/github.com/proglottis/gpgme and fail
124+
CGO_ENABLED_CTRL_GEN := CGO_ENABLED=1 $(CONTROLLER_GEN)
122125
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
123126
# To generate the manifests used and do not use catalogd directory
124-
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
125-
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
127+
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CGO_ENABLED_CTRL_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
128+
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CGO_ENABLED_CTRL_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
126129
# To generate the manifests for catalogd
127130
$(MAKE) -C catalogd generate
128131

129132
.PHONY: generate
130133
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
131-
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
134+
$(CGO_ENABLED_CTRL_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
132135

133136
.PHONY: verify
134137
verify: tidy fmt generate manifests crd-ref-docs #HELP Verify all generated code is up-to-date.

catalogd/Makefile

+6-4
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ clean: ## Remove binaries and test artifacts
6262
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
6363
KUSTOMIZE_RBAC_DIR := config/base/rbac
6464
KUSTOMIZE_WEBHOOKS_DIR := config/base/manager/webhook
65+
# Needed because otherwise we exclude Go all files in vendor/github.com/proglottis/gpgme and fail
66+
CGO_ENABLED_CTRL_GEN := CGO_ENABLED=1 $(CONTROLLER_GEN)
6567
generate: $(CONTROLLER_GEN) ## Generate code and manifests.
66-
$(CONTROLLER_GEN) object:headerFile="../hack/boilerplate.go.txt" paths="./..."
67-
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./api/..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
68-
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/..." output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
69-
rm -f $(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/..." output:webhook:artifacts:config=$(KUSTOMIZE_WEBHOOKS_DIR)
68+
$(CGO_ENABLED_CTRL_GEN) object:headerFile="../hack/boilerplate.go.txt" paths="./..."
69+
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CGO_ENABLED_CTRL_GEN) crd paths="./api/..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
70+
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CGO_ENABLED_CTRL_GEN) rbac:roleName=manager-role paths="./internal/..." output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
71+
rm -f $(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CGO_ENABLED_CTRL_GEN) webhook paths="./internal/..." output:webhook:artifacts:config=$(KUSTOMIZE_WEBHOOKS_DIR)
7072

7173
##@ Build
7274

0 commit comments

Comments
 (0)