Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 16 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
all: build
.PHONY: all

# IMPORTANT: Awkward though it is to read, this dependency chain needs to be
# defined *before* we include the build-machinery-go rules. That's because
# we need to install vendored CRDs and generate our own CRDs *before* we
# update bindata to include them. (Dependencies seem to run in the order they
# are defined, with subsequent definitions appended iff not already in the
# chain.)
update: update-vendored-crds update-codegen-crds update-bindata generate
.PHONY: update

# Include the library makefile
include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
golang.mk \
Expand Down Expand Up @@ -76,45 +85,18 @@ $(call build-image,ocp-cloud-credential-operator,$(IMAGE_REGISTRY)/$(IMAGE_REPO)
# $2 - apis
# $3 - manifests
# $4 - output
$(call add-crd-gen,cloudcredential-manifests,./pkg/apis/cloudcredential/v1,./manifests,./manifests)
$(call add-crd-gen,cloudcredential-bindata,./pkg/apis/cloudcredential/v1,./bindata/bootstrap,./bindata/bootstrap)

update: update-codegen update-bindata generate
.PHONY: update
$(call add-crd-gen,cloudcredential-manifests,./pkg/apis/cloudcredential/v1,./manifests/generated,./manifests/generated)
$(call add-crd-gen,cloudcredential-bindata,./pkg/apis/cloudcredential/v1,./bindata/bootstrap/generated,./bindata/bootstrap/generated)

generate:
go generate ${GO_TEST_PACKAGES}
.PHONY: generate

# TODO: consider migrating to the openshift/api codegen tool
# https://github.com/openshift/api/tree/master/tools/codegen
#
# update-codegen-crds-cloudcredential-manifests and
# update-codegen-crds-cloudcredential-bindata make targets override
# "update-codegen-crds-*" targets created by the above invocations of
# "add-crd-gen".
#
# We copy the cloud credential operator config CRD from the
# openshift/api repository (via the vendor dir) and since
# openshift/api now utilizes a different codegen utility than
# build-machinery-go, running the schemapatch code generator against
# the copied manifest results in a different formatting. This results
# in a diff which causes our verify target to fail so we ensure the
# copied manifests remain unchanged by copying the CRDs once more
# after generating CRDs as a workaround.
update-codegen-crds-cloudcredential-manifests: ensure-controller-gen ensure-yq ensure-yaml-patch
$(run-crd-gen,./pkg/apis/cloudcredential/v1,./manifests)
$(MAKE) update-vendored-crds

update-codegen-crds-cloudcredential-bindata: ensure-controller-gen ensure-yq ensure-yaml-patch
$(run-crd-gen,./pkg/apis/cloudcredential/v1,./bindata/bootstrap)
$(MAKE) update-vendored-crds

update-vendored-crds:
# copy config CRD from openshift/api
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/00-config-custresdef.yaml
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/imported/00-config-custresdef.yaml
# ...and into where we generate bindata from
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/cloudcredential_v1_operator_config_custresdef.yaml
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/imported/cloudcredential_v1_operator_config_custresdef.yaml
.PHONY: update-vendored-crds

update-codegen: update-codegen-crds
Expand All @@ -128,8 +110,8 @@ verify-codegen: verify-codegen-crds
.PHONY: verify-codegen

verify-vendored-crds:
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/00-config-custresdef.yaml
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/cloudcredential_v1_operator_config_custresdef.yaml
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/imported/00-config-custresdef.yaml
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/imported/cloudcredential_v1_operator_config_custresdef.yaml
.PHONY: verify-vendored-crds

clean:
Expand All @@ -142,7 +124,7 @@ run: build

# Install CRDs into a cluster
install: update-codegen
kubectl apply -f manifests/00-crd.yaml
kubectl apply -f manifests/generated/00-crd.yaml

# TODO targets for backward compatibility while we make the shift in CI
test-no-gen: test
Expand Down
File renamed without changes.
42 changes: 23 additions & 19 deletions pkg/assets/bootstrap/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/cmd/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ spec:
credentialsMode: "{{ .CredentialsMode }}"`))

renderAssets = []string{
"bootstrap/cloudcredential_v1_operator_config_custresdef.yaml",
"bootstrap/cloudcredential_v1_credentialsrequest_crd.yaml",
"bootstrap/imported/cloudcredential_v1_operator_config_custresdef.yaml",
"bootstrap/generated/cloudcredential_v1_credentialsrequest_crd.yaml",
"bootstrap/namespace.yaml",
}

Expand Down