-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.rhpam
100 lines (78 loc) · 4.39 KB
/
Makefile.rhpam
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
include Makefile
VERSION = $(shell go run version/getrhpamversion.go)
CHANNELS = 7.x
DEFAULT_CHANNEL = 7.x
BUNDLE_CHANNELS = --channels=$(CHANNELS)
BUNDLE_DEFAULT_CHANNEL = --default-channel=$(DEFAULT_CHANNEL)
IMAGE_TAG_BASE = registry.stage.redhat.io/rhpam-7/rhpam-kogito-rhel8-operator
# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
# You can enable this value if you would like to use SHA Based Digests
# To enable set flag to true
USE_IMAGE_DIGESTS ?= false
ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif
# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
# These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)
CEKIT_CMD := cekit -v --redhat ${cekit_option}
all: generate manifests container-build
echo "calling RHPAM all......................................"
##@ Development
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
echo "calling RHPAM manifests......................................"
./hack/kogito-module-api.sh --disable
$(CONTROLLER_GEN) crd paths="./apis/rhpam/..." output:crd:artifacts:config=config/crd/rhpam/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./controllers/rhpam" output:rbac:artifacts:config=config/rbac/rhpam
$(CONTROLLER_GEN) webhook paths="./..."
./hack/kogito-module-api.sh --enable
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
echo "calling RHPAM generate......................................"
./hack/kogito-module-api.sh --disable
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths=./...
./hack/kogito-module-api.sh --enable
##@ Build
container-build: ## Build the container image
echo "calling RHPAM container-build......................................"
cekit -v --descriptor rhpam-image.yaml build $(BUILDER)
$(BUILDER) tag rhpam-7/rhpam-kogito-operator ${IMG}
.PHONY: container-build-osbs
container-build-osbs:
echo "calling RHPAM container-build-osbs......................................"
$(CEKIT_CMD) --descriptor rhpam-image-prod.yaml build osbs --assume-yes
container-push: ## Push the container image
$(BUILDER) push ${IMG}
container-prod-build: ## prod build
$(CEKIT_CMD) --descriptor=rhpam-image-prod.yaml build $(BUILDER)
.PHONY: bundle-prod-build
bundle-prod-build: bundle
$(CEKIT_CMD) --descriptor=rhpam-image-bundle.yaml build $(BUILDER)
##@ Deployment
bundle: manifests generate kustomize install-operator-sdk olm-manifests ## Generate bundle manifests and metadata, then validate generated files.
echo "calling RHPAM bundle......................................"
sed -i "s/newTag: */newTag: ${VERSION}/g" ./config/manager/rhpam/kustomization.yaml
./hack/kogito-module-api.sh --disable
operator-sdk generate kustomize manifests --apis-dir=apis/rhpam --input-dir=./config/manifests/rhpam --output-dir=./config/manifests/rhpam --package=rhpam-kogito-operator -q
cd config/manager/rhpam && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests/rhpam | operator-sdk generate bundle --package=rhpam-kogito-operator --output-dir=bundle/rhpam $(BUNDLE_GEN_FLAGS)
operator-sdk bundle validate ./bundle/rhpam
./hack/kogito-module-api.sh --enable
./hack/rhpam/rhpam-update-bundle.sh ${IMG}
generate-installer: generate manifests kustomize
echo "calling RHPAM generate-installer......................................"
cd config/manager/rhpam && $(KUSTOMIZE) edit set image controller=$(IMG)
sed -i "s/rhel8:.*/rhel8:${VERSION}/g" ./config/manager/rhpam/manager.yaml
$(KUSTOMIZE) build config/default/rhpam > rhpam-operator.yaml
.PHONY: deploy-operator-on-ocp
image ?= $2
deploy-operator-on-ocp:
./hack/rhpam/rhpam-deploy-operator-on-ocp.sh $(image)
olm-manifests:
./hack/rhpam/rhpam-create-olm-manifests.sh
generate-profiling-installer:
echo "calling RHPAM generate-profiling-installer......................................"