Skip to content

Commit bbd0e0f

Browse files
authored
Merge pull request #6 from mikenairn/add_kuadrant_dependenices
Add kuadrant dependencies to OLM installation
2 parents 6cd65c8 + e3fa1c0 commit bbd0e0f

28 files changed

+868
-14
lines changed

Makefile

+93-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# To re-generate a bundle for another specific version without changing the standard setup, you can:
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
VERSION ?= 0.0.1
6+
VERSION ?= 0.0.0
77

88
# CHANNELS define the bundle channels used in the bundle.
99
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -24,19 +24,31 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
2424
endif
2525
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2626

27+
# Address of the container registry
28+
REGISTRY = quay.io
29+
30+
# Organization in container registry
31+
ORG ?= kuadrant
32+
2733
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
2834
# This variable is used to construct full image tags for bundle and catalog images.
2935
#
3036
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
3137
# quay.io/kuadrant/kuadrant-operator-bundle:$VERSION and quay.io/kuadrant/kuadrant-operator-catalog:$VERSION.
32-
IMAGE_TAG_BASE ?= quay.io/kuadrant/kuadrant-operator
38+
IMAGE_TAG_BASE ?= $(REGISTRY)/$(ORG)/kuadrant-operator
39+
40+
ifeq (0.0.0,$(VERSION))
41+
IMAGE_TAG = latest
42+
else
43+
IMAGE_TAG = v$(VERSION)
44+
endif
3345

3446
# BUNDLE_IMG defines the image:tag used for the bundle.
3547
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
36-
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
48+
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:$(IMAGE_TAG)
3749

3850
# Image URL to use all building/pushing image targets
39-
IMG ?= quay.io/kuadrant/kuadrant-operator:latest
51+
IMG ?= $(IMAGE_TAG_BASE):$(IMAGE_TAG)
4052
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
4153
ENVTEST_K8S_VERSION = 1.22
4254

@@ -53,6 +65,42 @@ endif
5365
SHELL = /usr/bin/env bash -o pipefail
5466
.SHELLFLAGS = -ec
5567

68+
# Kuadrant component versions
69+
## kuadrant controller
70+
#ToDo Pin this version once we have an initial release of the controller
71+
KUADRANT_CONTROLLER_VERSION ?= latest
72+
ifeq (latest,$(KUADRANT_CONTROLLER_VERSION))
73+
KUADRANT_CONTROLLER_GITREF = main
74+
else
75+
KUADRANT_CONTROLLER_GITREF = $(KUADRANT_CONTROLLER_VERSION)
76+
endif
77+
## authorino
78+
#ToDo Pin this version once we have an initial release of authorino
79+
AUTHORINO_OPERATOR_VERSION ?= latest
80+
ifeq (latest,$(AUTHORINO_OPERATOR_VERSION))
81+
AUTHORINO_OPERATOR_BUNDLE_VERSION = 0.0.0
82+
AUTHORINO_OPERATOR_BUNDLE_IMG_TAG = latest
83+
AUTHORINO_OPERATOR_GITREF = main
84+
else
85+
AUTHORINO_OPERATOR_BUNDLE_VERSION = ${AUTHORINO_OPERATOR_VERSION}
86+
AUTHORINO_OPERATOR_BUNDLE_IMG_TAG = v$(AUTHORINO_OPERATOR_BUNDLE_VERSION)
87+
AUTHORINO_OPERATOR_GITREF = v$(AUTHORINO_OPERATOR_BUNDLE_VERSION)
88+
endif
89+
AUTHORINO_OPERATOR_BUNDLE_IMG ?= quay.io/kuadrant/authorino-operator-bundle:$(AUTHORINO_OPERATOR_BUNDLE_IMG_TAG)
90+
## limitador
91+
#ToDo Pin this version once we have an initial release of limitador
92+
LIMITADOR_OPERATOR_VERSION ?= latest
93+
ifeq (latest,$(LIMITADOR_OPERATOR_VERSION))
94+
LIMITADOR_OPERATOR_BUNDLE_VERSION = 0.0.0
95+
LIMITADOR_OPERATOR_BUNDLE_IMG_TAG = latest
96+
LIMITADOR_OPERATOR_GITREF = main
97+
else
98+
LIMITADOR_OPERATOR_BUNDLE_VERSION = $(LIMITADOR_OPERATOR_VERSION)
99+
LIMITADOR_OPERATOR_BUNDLE_IMG_TAG = v$(LIMITADOR_OPERATOR_BUNDLE_VERSION)
100+
LIMITADOR_OPERATOR_GITREF = v$(LIMITADOR_OPERATOR_BUNDLE_VERSION)
101+
endif
102+
LIMITADOR_OPERATOR_BUNDLE_IMG ?= quay.io/kuadrant/limitador-operator-bundle:$(LIMITADOR_OPERATOR_BUNDLE_IMG_TAG)
103+
56104
all: build
57105

58106
##@ General
@@ -73,9 +121,24 @@ help: ## Display this help.
73121

74122
##@ Development
75123

76-
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
124+
manifests: controller-gen dependencies-manifests ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
77125
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
78126

127+
.PHONY: dependencies-manifests
128+
dependencies-manifests: export KUADRANT_CONTROLLER_GITREF := $(KUADRANT_CONTROLLER_GITREF)
129+
dependencies-manifests: export AUTHORINO_OPERATOR_GITREF := $(AUTHORINO_OPERATOR_GITREF)
130+
dependencies-manifests: export LIMITADOR_OPERATOR_GITREF := $(LIMITADOR_OPERATOR_GITREF)
131+
dependencies-manifests: ## Update kuadrant dependencies manifests.
132+
envsubst \
133+
< config/dependencies/controller/kustomization.template.yaml \
134+
> config/dependencies/controller/kustomization.yaml
135+
envsubst \
136+
< config/dependencies/authorino/kustomization.template.yaml \
137+
> config/dependencies/authorino/kustomization.yaml
138+
envsubst \
139+
< config/dependencies/limitador/kustomization.template.yaml \
140+
> config/dependencies/limitador/kustomization.yaml
141+
79142
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
80143
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
81144

@@ -96,7 +159,7 @@ build: generate fmt vet ## Build manager binary.
96159
run: manifests generate fmt vet ## Run a controller from your host.
97160
go run ./main.go
98161

99-
docker-build: test ## Build docker image with the manager.
162+
docker-build: ## Build docker image with the manager.
100163
docker build -t ${IMG} .
101164

102165
docker-push: ## Push docker image with the manager.
@@ -112,11 +175,24 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
112175

113176
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
114177
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
115-
$(KUSTOMIZE) build config/default | kubectl apply -f -
178+
$(KUSTOMIZE) build config/deploy | kubectl apply -f -
116179

117180
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
118-
$(KUSTOMIZE) build config/default | kubectl delete -f -
181+
$(KUSTOMIZE) build config/deploy | kubectl delete -f -
119182

183+
.PHONY: install-olm
184+
install-olm:
185+
$(OPERATOR_SDK) olm install
186+
187+
.PHONY: uninstall-olm
188+
uninstall-olm:
189+
$(OPERATOR_SDK) olm uninstall
190+
191+
deploy-olm: ## Deploy controller to the K8s cluster specified in ~/.kube/config using OLM catalog image.
192+
$(KUSTOMIZE) build config/deploy/olm | kubectl apply -f -
193+
194+
undeploy-olm: ## Undeploy controller from the K8s cluster specified in ~/.kube/config using OLM catalog image.
195+
$(KUSTOMIZE) build config/deploy/olm | kubectl delete -f -
120196

121197
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
122198
controller-gen: ## Download controller-gen locally if necessary.
@@ -149,8 +225,14 @@ OPERATOR_SDK_VERSION = v1.15.0
149225
operator-sdk: ## Download operator-sdk locally if necessary.
150226
./utils/install-operator-sdk.sh $(OPERATOR_SDK) $(OPERATOR_SDK_VERSION)
151227

228+
.PHONY: bundle-dependencies
229+
bundle-dependencies: export AUTHORINO_OPERATOR_BUNDLE_VERSION := $(AUTHORINO_OPERATOR_BUNDLE_VERSION)
230+
bundle-dependencies: export LIMITADOR_OPERATOR_BUNDLE_VERSION := $(LIMITADOR_OPERATOR_BUNDLE_VERSION)
231+
bundle-dependencies: ## Generate bundle dependencies file.
232+
./utils/generate-dependencies-yaml.sh > bundle/metadata/dependencies.yaml
233+
152234
.PHONY: bundle
153-
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
235+
bundle: manifests kustomize operator-sdk bundle-dependencies ## Generate bundle manifests and metadata, then validate generated files.
154236
$(OPERATOR_SDK) generate kustomize manifests -q
155237
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
156238
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
@@ -183,10 +265,10 @@ endif
183265

184266
# 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).
185267
# These images MUST exist in a registry and be pull-able.
186-
BUNDLE_IMGS ?= $(BUNDLE_IMG)
268+
BUNDLE_IMGS ?= $(BUNDLE_IMG),$(LIMITADOR_OPERATOR_BUNDLE_IMG),$(AUTHORINO_OPERATOR_BUNDLE_IMG)
187269

188270
# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
189-
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION)
271+
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:$(IMAGE_TAG)
190272

191273
# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
192274
ifneq ($(origin CATALOG_BASE_IMG), undefined)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# kuadrant-operator
1+
# kuadrant-operator
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: kuadrant
7+
control-plane: controller-manager
8+
name: kuadrant-controller-manager-metrics-service
9+
spec:
10+
ports:
11+
- name: https
12+
port: 8443
13+
targetPort: https
14+
selector:
15+
app: kuadrant
16+
control-plane: controller-manager
17+
status:
18+
loadBalancer: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
data:
3+
controller_manager_config.yaml: |
4+
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
5+
kind: ControllerManagerConfig
6+
health:
7+
healthProbeBindAddress: :8081
8+
metrics:
9+
bindAddress: 127.0.0.1:8080
10+
webhook:
11+
port: 9443
12+
leaderElection:
13+
leaderElect: true
14+
resourceName: e358d637.kuadrant.io
15+
kind: ConfigMap
16+
metadata:
17+
labels:
18+
app: kuadrant
19+
name: kuadrant-manager-config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: kuadrant
7+
name: kuadrant-metrics-reader
8+
rules:
9+
- nonResourceURLs:
10+
- /metrics
11+
verbs:
12+
- get

0 commit comments

Comments
 (0)