From f6642a4490ca6be5f9f126f0022b78fdebb6eb3b Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 15 Jan 2021 17:21:41 +0000
Subject: [PATCH] Separate out Makefile contents into individual directories
WIP
---
install/operator/kustomize/.gitignore | 3 +
install/operator/kustomize/Makefile | 196 +++------------
install/operator/kustomize/app/Makefile | 13 +
install/operator/kustomize/bases/crd/Makefile | 10 +
.../kustomize/bases/deployment/Makefile | 37 +++
.../operator/kustomize/bases/grant/Makefile | 41 ++++
.../kustomize/bases/jaeger-crd/Makefile | 14 ++
.../bases/jaeger-crd/kustomization.yaml | 2 +
.../operator/kustomize/bases/role/Makefile | 31 +++
install/operator/kustomize/dev/app/Makefile | 13 +
.../operator/kustomize/dev/operator/Makefile | 22 ++
install/operator/kustomize/release/Makefile | 44 ++++
install/operator/kustomize/release/release.sh | 227 ++++++++++++++++++
13 files changed, 486 insertions(+), 167 deletions(-)
create mode 100644 install/operator/kustomize/.gitignore
create mode 100644 install/operator/kustomize/app/Makefile
create mode 100644 install/operator/kustomize/bases/crd/Makefile
create mode 100644 install/operator/kustomize/bases/deployment/Makefile
create mode 100644 install/operator/kustomize/bases/grant/Makefile
create mode 100644 install/operator/kustomize/bases/jaeger-crd/Makefile
create mode 100644 install/operator/kustomize/bases/jaeger-crd/kustomization.yaml
create mode 100644 install/operator/kustomize/bases/role/Makefile
create mode 100644 install/operator/kustomize/dev/app/Makefile
create mode 100644 install/operator/kustomize/dev/operator/Makefile
create mode 100644 install/operator/kustomize/release/Makefile
create mode 100755 install/operator/kustomize/release/release.sh
diff --git a/install/operator/kustomize/.gitignore b/install/operator/kustomize/.gitignore
new file mode 100644
index 00000000000..441d6bcab07
--- /dev/null
+++ b/install/operator/kustomize/.gitignore
@@ -0,0 +1,3 @@
+**/*.yml
+release/syndesis
+release/*.tar.gz
diff --git a/install/operator/kustomize/Makefile b/install/operator/kustomize/Makefile
index 9cce138f00d..94e89bd0aad 100644
--- a/install/operator/kustomize/Makefile
+++ b/install/operator/kustomize/Makefile
@@ -1,189 +1,38 @@
-
#
-# Paths
+# Make Options
#
-ROOT := ..
-ASSETS := $(ROOT)/pkg/generator/assets
-
-# Resources that provide foundational base
-BASES := ./bases
-CRD := $(BASES)/crd/syndesis-crd.yml
-DEPLOYMENT := $(BASES)/deployment/deployment.yml
-GRANT := $(BASES)/grant/grant.yml
-GRANT_JAEGER := $(BASES)/grant/grant-jaeger.yml
-GRANT_KAFKA := $(BASES)/grant/grant-kafka.yml
-GRANT_OLM := $(BASES)/grant/grant-olm.yml
-GRANT_PUBLIC_API := $(BASES)/grant/grant-public-api.yml
-ROLE := $(BASES)/role/role.yml
-ROLE_JAEGER := $(BASES)/role/cluster-role-jaeger.yml
-ROLE_KAFKA := $(BASES)/role/cluster-role-kafka.yml
-ROLE_PUBLIC_API := $(BASES)/role/cluster-role-public-api.yml
-ROLE_OLM := $(BASES)/role/cluster-role-olm.yml
-OPERATOR_INSTALL := $(BASES)/deployment/operator-install.yml
-
-# Resources that overlay the bases
-ADDONS := ./addons
-CR := ./app/syndesis-cr.yml
-JAEGER_CRD := ./setup-jaeger/jaeger-crd.yml
-
-DEV := ./dev
-PATCH_ANNOTATION_SRC := $(DEV)/operator/annotation-patch.yaml
-PATCH_ANNOTATION_TGT := $(DEV)/operator/annotation-patch.yml
-PATCH_ENV_VAR_SRC := $(DEV)/operator/env-var-patch.yaml
-PATCH_ENV_VAR_TGT := $(DEV)/operator/env-var-patch.yml
-PATCH_IMG_STREAM_SRC := $(DEV)/operator/image-stream-patch.yaml
-PATCH_IMG_STREAM_TGT := $(DEV)/operator/image-stream-patch.yml
+MK_OPTIONS := -s
#
# Vars
#
-DB_IMAGE := centos/postgresql-10-centos7
DEV_IMAGE := syndesis-operator
ROLENAME := syndesis-operator
#
# Vars that can be overridden by external env vars
#
+DB_IMAGE ?= centos/postgresql-10-centos7
IMAGE ?= docker.io/syndesis/syndesis-operator
NAMESPACE ?= syndesis
KUBE_USER ?= developer
TAG ?= latest
-.PHONY: kustomize sync-crd sync-jaeger-crd sync-role sync-grant sync-operator-install sync-deployment sync-cr setup setup-jaeger operator app
+.PHONY: kustomize setup setup-jaeger operator app product
kubectl:
ifeq (, $(shell which kubectl))
$(error "No kubectl found in PATH. Please install and re-run")
endif
-#
-# Copy the go template from the src directory
-#
-sync-crd:
- cp $(ASSETS)/install/cluster/syndesis.yml $(CRD)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Delete any line beginning with '{{'
-# - Delete any empty lines and comments
-#
-sync-jaeger-crd: sync-crd
- cp $(ASSETS)/install/cluster/jaeger.yml.tmpl $(JAEGER_CRD)
- sed -i '/^{{\|^#\|^$$/d' $(JAEGER_CRD)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Convert go-style array to yaml format, ie. remove '-' & double space
-# - Replace Kind & Role placeholders
-#
-sync-role:
- cp $(ASSETS)/install/role.yml.tmpl $(ROLE)
- sed -i 's/{{.Kind}}/Role/' $(ROLE)
- sed -i 's/{{.Role}}/$(ROLENAME)/' $(ROLE)
- sed -i 's/- kind:/kind:/' $(ROLE)
- sed -i 's/^ //' $(ROLE)
- cp $(ASSETS)/install/cluster_role_jaeger.yml.tmpl $(ROLE_JAEGER)
- sed -i '/^{{\|^#\|^$$/d' $(ROLE_JAEGER)
- cp $(ASSETS)/install/cluster_role_kafka.yml.tmpl $(ROLE_KAFKA)
- cp $(ASSETS)/install/cluster_role_olm.yml.tmpl $(ROLE_OLM)
- sed -i '/^{{\|^$$/d' $(ROLE_OLM)
- sed -i 's/^- /\n---\n/' $(ROLE_OLM)
- sed -i 's/^ //' $(ROLE_OLM)
- sed -i '/{{- if\|{{- end/d' $(ROLE_OLM)
- cp $(ASSETS)/install/cluster_role_public_api.yml.tmpl $(ROLE_PUBLIC_API)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Replace Kind, Role, User, Namespace placeholders
-# - Delete any if & end codeword lines
-#
-sync-grant:
- cp $(ASSETS)/install/grant/grant_role.yml.tmpl $(GRANT)
- sed -i 's/{{ .Kind }}/Role/' $(GRANT)
- sed -i 's/{{ .Role }}/$(ROLENAME)/' $(GRANT)
- sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT)
- sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT)
- sed -i '/{{- if\|{{- end/d' $(GRANT)
- cp $(ASSETS)/install/grant/grant_cluster_role_jaeger.yml.tmpl $(GRANT_JAEGER)
- sed -i '/^{{\|^$$/d' $(GRANT_JAEGER)
- sed -i 's/^- /\n---\n/' $(GRANT_JAEGER)
- sed -i 's/^ //' $(GRANT_JAEGER)
- sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT_JAEGER)
- sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT_JAEGER)
- cp $(ASSETS)/install/grant/grant_cluster_role_kafka.yml.tmpl $(GRANT_KAFKA)
- sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT_KAFKA)
- cp $(ASSETS)/install/grant/grant_cluster_role_olm.yml.tmpl $(GRANT_OLM)
- sed -i '/^{{\|^$$/d' $(GRANT_OLM)
- sed -i 's/^- /\n---\n/' $(GRANT_OLM)
- sed -i 's/^ //' $(GRANT_OLM)
- sed -i 's/{{ .Role }}/$(ROLENAME)/' $(GRANT_OLM)
- sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT_OLM)
- cp $(ASSETS)/install/grant/grant_cluster_role_public_api.yml.tmpl $(GRANT_PUBLIC_API)
- sed -i 's/{{.Namespace}}/$(NAMESPACE)/' $(GRANT_PUBLIC_API)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Delete any line beginning with '{{'
-# - Delete any empty lines
-# - Convert go-style array '- xxx' to yaml format: '---\n' & remove double-spaces at start of lines
-# - Replace Role, Namespace, Tag, Image placeholders
-# - Delete DevSupport conditional, ImageStreamTag line, else and end codewords
-#
-sync-operator-install:
- cp $(ASSETS)/install/operator_install.yml.tmpl $(OPERATOR_INSTALL)
- sed -i '/^{{\|^$$/d' $(OPERATOR_INSTALL)
- sed -i 's/^- /\n---\n/' $(OPERATOR_INSTALL)
- sed -i 's/^ //' $(OPERATOR_INSTALL)
- sed -i 's/{{ .Role }}/$(ROLENAME)/' $(OPERATOR_INSTALL)
- sed -i 's/{{.Namespace}}/$(NAMESPACE)/' $(OPERATOR_INSTALL)
- sed -i 's/{{.Tag}}/$(TAG)/' $(OPERATOR_INSTALL)
- sed -i 's_{{.Image}}_$(IMAGE)_' $(OPERATOR_INSTALL)
- sed -i '/{{if .DevSupport}}/d' $(OPERATOR_INSTALL)
- sed -i '/kind: ImageStreamTag/d' $(OPERATOR_INSTALL)
- sed -i '/{{else}}\|{{end}}/d' $(OPERATOR_INSTALL)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Remove any if/else/end conditional sections (not required)
-# - Replace Tag, Image placeholders
-#
-sync-deployment:
- cp $(ASSETS)/install/operator_deployment.yml.tmpl $(DEPLOYMENT)
- sed -i '/{{- if/,/{{- end}}\|{{end}}/d' $(DEPLOYMENT)
- sed -i 's/{{.Tag}}/$(TAG)/' $(DEPLOYMENT)
- sed -i 's_{{.Image}}_$(IMAGE)_' $(DEPLOYMENT)
- sed -i 's_{{.DatabaseImage}}_$(DB_IMAGE)_' $(DEPLOYMENT)
-
-#
-# Copy the go template from the src directory
-# Convert the go template to a formatted yaml file:
-# - Remove any range/end sections (not required)
-#
-sync-cr:
- cp $(ASSETS)/install/app.yml.tmpl $(CR)
- sed -i '/{{- range/,/{{- end }}\|{{end}}/d' $(CR)
-
-#
-# Injects the DEV_IMAGE & TAG values into the patches
-#
-sync-operator-dev:
- cp $(PATCH_ANNOTATION_SRC) $(PATCH_ANNOTATION_TGT)
- sed -i 's/{{.Tag}}/$(TAG)/' $(PATCH_ANNOTATION_TGT)
- cp $(PATCH_ENV_VAR_SRC) $(PATCH_ENV_VAR_TGT)
- cp $(PATCH_IMG_STREAM_SRC) $(PATCH_IMG_STREAM_TGT)
- sed -i 's_{{.Image}}_$(DEV_IMAGE)_' $(PATCH_IMG_STREAM_TGT)
- sed -i 's/{{.Tag}}/$(TAG)/' $(PATCH_IMG_STREAM_TGT)
-
#
# Setup the installation by installing crds, roles and granting
# privileges for the installing user.
#
-setup: kubectl sync-crd sync-role sync-grant
+setup: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/crd
+ $(MAKE) $(MK_OPTIONS) -C bases/role
+ $(MAKE) $(MK_OPTIONS) -C bases/grant
#@ Must be invoked by a user with cluster-admin privileges
kubectl apply -k setup
@@ -192,7 +41,11 @@ setup: kubectl sync-crd sync-role sync-grant
# This step is only applicable for environments that do not run and OLM
# OperatorHub.
#
-setup-jaeger: kubectl sync-jaeger-crd sync-role sync-grant
+setup-jaeger: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/crd
+ $(MAKE) $(MK_OPTIONS) -C bases/jaeger-crd
+ $(MAKE) $(MK_OPTIONS) -C bases/role
+ $(MAKE) $(MK_OPTIONS) -C bases/grant
#@ *************************** Warning ******************************
#@ ** This should only be invoked on a non-OperatorHub environment **
#@ ******************************************************************
@@ -202,14 +55,17 @@ setup-jaeger: kubectl sync-jaeger-crd sync-role sync-grant
#
# Install the operator deployment and related resources
#
-operator: kubectl sync-operator-install sync-deployment
+operator: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/deployment
#@ Must be invoked by a user previously granted permissions using `KUBE_USER= make install-setup`
kubectl apply -k operator
#
# Installs the operator deployment and in addition installs a default CR
#
-app: kubectl sync-cr sync-operator-install sync-deployment
+app: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/deployment
+ $(MAKE) $(MK_OPTIONS) -C app
#@ Must be invoked by a user previously granted permissions using `KUBE_USER= make install-setup`
kubectl apply -k app
@@ -222,7 +78,9 @@ app: kubectl sync-cr sync-operator-install sync-deployment
# - Patches the imagestream to use a locally built image
# rather than a downloaded docker image
#
-operator-dev: kubectl sync-operator-install sync-deployment sync-operator-dev
+operator-dev: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/deployment
+ $(MAKE) $(MK_OPTIONS) -C dev/operator
#@ Used for development purposes only - allows for a locally compiled operator
#@ Must be invoked by a user previously granted permissions using `KUBE_USER= make install-setup`
kubectl apply -k dev/operator
@@ -231,9 +89,12 @@ operator-dev: kubectl sync-operator-install sync-deployment sync-operator-dev
# Installs the operator deployment in development mode
# and in addition installs a default CR
#
-app-dev: kubectl sync-cr sync-operator-install sync-deployment sync-operator-dev
- #@ Must be invoked by a user previously granted permissions using `KUBE_USER= make install-setup`
- kubectl apply -k dev/app
+app-dev: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/deployment
+ $(MAKE) $(MK_OPTIONS) -C dev/operator
+ $(MAKE) $(MK_OPTIONS) -C dev/app
+ #@ Must be invoked by a user previously granted permissions using `KUBE_USER= make install-setup`
+ kubectl apply -k dev/app
#
# Installs the product operator using kustomize to override
@@ -242,7 +103,8 @@ app-dev: kubectl sync-cr sync-operator-install sync-deployment sync-operator-dev
# Red Hat registry. If not present then it request credentials
# and creates accordingly.
#
-product: kubectl sync-operator-install sync-deployment
+product: kubectl
+ $(MAKE) $(MK_OPTIONS) -C bases/deployment
#@ Credentials required for accessing the redhat registry
kubectl get secret syndesis-pull-secret || (\
read -p "enter username for registry.redhat.io and press [ENTER]: " username; \
diff --git a/install/operator/kustomize/app/Makefile b/install/operator/kustomize/app/Makefile
new file mode 100644
index 00000000000..0b463b0c4b9
--- /dev/null
+++ b/install/operator/kustomize/app/Makefile
@@ -0,0 +1,13 @@
+ASSETS := ../../pkg/generator/assets
+CR := ./syndesis-cr.yml
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Remove any range/end sections (not required)
+#
+sync:
+ cp $(ASSETS)/install/app.yml.tmpl $(CR)
+ sed -i '/{{- range/,/{{- end }}\|{{end}}/d' $(CR)
diff --git a/install/operator/kustomize/bases/crd/Makefile b/install/operator/kustomize/bases/crd/Makefile
new file mode 100644
index 00000000000..3b25cdab111
--- /dev/null
+++ b/install/operator/kustomize/bases/crd/Makefile
@@ -0,0 +1,10 @@
+ASSETS := ../../../pkg/generator/assets
+CRD := ./syndesis-crd.yml
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+#
+sync:
+ cp $(ASSETS)/install/cluster/syndesis.yml $(CRD)
diff --git a/install/operator/kustomize/bases/deployment/Makefile b/install/operator/kustomize/bases/deployment/Makefile
new file mode 100644
index 00000000000..d1cd5ac7338
--- /dev/null
+++ b/install/operator/kustomize/bases/deployment/Makefile
@@ -0,0 +1,37 @@
+ASSETS := ../../../pkg/generator/assets
+DB_IMAGE ?= centos/postgresql-10-centos7
+DEPLOYMENT := ./deployment.yml
+IMAGE ?= docker.io/syndesis/syndesis-operator
+NAMESPACE ?= syndesis
+OPERATOR_INSTALL := ./operator-install.yml
+ROLENAME ?= syndesis-operator
+TAG ?= latest
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Delete any line beginning with '{{'
+# - Delete any empty lines
+# - Convert go-style array '- xxx' to yaml format: '---\n' & remove double-spaces at start of lines
+# - Replace Role, Namespace, Tag, Image placeholders
+# - Delete DevSupport conditional, ImageStreamTag line, else and end codewords
+#
+sync:
+ cp $(ASSETS)/install/operator_install.yml.tmpl $(OPERATOR_INSTALL)
+ sed -i '/^{{\|^$$/d' $(OPERATOR_INSTALL)
+ sed -i 's/^- /\n---\n/' $(OPERATOR_INSTALL)
+ sed -i 's/^ //' $(OPERATOR_INSTALL)
+ sed -i 's/{{ .Role }}/$(ROLENAME)/' $(OPERATOR_INSTALL)
+ sed -i 's/{{.Namespace}}/$(NAMESPACE)/' $(OPERATOR_INSTALL)
+ sed -i 's/{{.Tag}}/$(TAG)/' $(OPERATOR_INSTALL)
+ sed -i 's_{{.Image}}_$(IMAGE)_' $(OPERATOR_INSTALL)
+ sed -i '/{{if .DevSupport}}/d' $(OPERATOR_INSTALL)
+ sed -i '/kind: ImageStreamTag/d' $(OPERATOR_INSTALL)
+ sed -i '/{{else}}\|{{end}}/d' $(OPERATOR_INSTALL)
+ cp $(ASSETS)/install/operator_deployment.yml.tmpl $(DEPLOYMENT)
+ sed -i '/{{- if/,/{{- end}}\|{{end}}/d' $(DEPLOYMENT)
+ sed -i 's/{{.Tag}}/$(TAG)/' $(DEPLOYMENT)
+ sed -i 's_{{.Image}}_$(IMAGE)_' $(DEPLOYMENT)
+ sed -i 's_{{.DatabaseImage}}_$(DB_IMAGE)_' $(DEPLOYMENT)
diff --git a/install/operator/kustomize/bases/grant/Makefile b/install/operator/kustomize/bases/grant/Makefile
new file mode 100644
index 00000000000..94d8d21ae2a
--- /dev/null
+++ b/install/operator/kustomize/bases/grant/Makefile
@@ -0,0 +1,41 @@
+ASSETS := ../../../pkg/generator/assets
+GRANT := ./grant.yml
+GRANT_JAEGER := ./grant-jaeger.yml
+GRANT_KAFKA := ./grant-kafka.yml
+GRANT_OLM := ./grant-olm.yml
+GRANT_PUBLIC_API := ./grant-public-api.yml
+KUBE_USER ?= developer
+NAMESPACE ?= syndesis
+ROLENAME ?= syndesis-operator
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Replace Kind, Role, User, Namespace placeholders
+# - Delete any if & end codeword lines
+#
+sync:
+ cp $(ASSETS)/install/grant/grant_role.yml.tmpl $(GRANT)
+ sed -i 's/{{ .Kind }}/Role/' $(GRANT)
+ sed -i 's/{{ .Role }}/$(ROLENAME)/' $(GRANT)
+ sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT)
+ sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT)
+ sed -i '/{{- if\|{{- end/d' $(GRANT)
+ cp $(ASSETS)/install/grant/grant_cluster_role_jaeger.yml.tmpl $(GRANT_JAEGER)
+ sed -i '/^{{\|^$$/d' $(GRANT_JAEGER)
+ sed -i 's/^- /\n---\n/' $(GRANT_JAEGER)
+ sed -i 's/^ //' $(GRANT_JAEGER)
+ sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT_JAEGER)
+ sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT_JAEGER)
+ cp $(ASSETS)/install/grant/grant_cluster_role_kafka.yml.tmpl $(GRANT_KAFKA)
+ sed -i 's/{{ .Namespace }}/$(NAMESPACE)/' $(GRANT_KAFKA)
+ cp $(ASSETS)/install/grant/grant_cluster_role_olm.yml.tmpl $(GRANT_OLM)
+ sed -i '/^{{\|^$$/d' $(GRANT_OLM)
+ sed -i 's/^- /\n---\n/' $(GRANT_OLM)
+ sed -i 's/^ //' $(GRANT_OLM)
+ sed -i 's/{{ .Role }}/$(ROLENAME)/' $(GRANT_OLM)
+ sed -i 's/{{ .User }}/$(KUBE_USER)/' $(GRANT_OLM)
+ cp $(ASSETS)/install/grant/grant_cluster_role_public_api.yml.tmpl $(GRANT_PUBLIC_API)
+ sed -i 's/{{.Namespace}}/$(NAMESPACE)/' $(GRANT_PUBLIC_API)
diff --git a/install/operator/kustomize/bases/jaeger-crd/Makefile b/install/operator/kustomize/bases/jaeger-crd/Makefile
new file mode 100644
index 00000000000..8b6aed67377
--- /dev/null
+++ b/install/operator/kustomize/bases/jaeger-crd/Makefile
@@ -0,0 +1,14 @@
+ASSETS := ../../../pkg/generator/assets
+JAEGER_CRD := ./jaeger-crd.yml
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Delete any line beginning with '{{'
+# - Delete any empty lines and comments
+#
+sync:
+ cp $(ASSETS)/install/cluster/jaeger.yml.tmpl $(JAEGER_CRD)
+ sed -i '/^{{\|^#\|^$$/d' $(JAEGER_CRD)
diff --git a/install/operator/kustomize/bases/jaeger-crd/kustomization.yaml b/install/operator/kustomize/bases/jaeger-crd/kustomization.yaml
new file mode 100644
index 00000000000..91ff71b8ee2
--- /dev/null
+++ b/install/operator/kustomize/bases/jaeger-crd/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+- jaeger-crd.yml
diff --git a/install/operator/kustomize/bases/role/Makefile b/install/operator/kustomize/bases/role/Makefile
new file mode 100644
index 00000000000..691690e9216
--- /dev/null
+++ b/install/operator/kustomize/bases/role/Makefile
@@ -0,0 +1,31 @@
+ASSETS := ../../../pkg/generator/assets
+ROLE := ./role.yml
+ROLE_JAEGER := ./cluster-role-jaeger.yml
+ROLE_KAFKA := ./cluster-role-kafka.yml
+ROLE_PUBLIC_API := ./cluster-role-public-api.yml
+ROLE_OLM := ./cluster-role-olm.yml
+ROLENAME ?= syndesis-operator
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Convert go-style array to yaml format, ie. remove '-' & double space
+# - Replace Kind & Role placeholders
+#
+sync:
+ cp $(ASSETS)/install/role.yml.tmpl $(ROLE)
+ sed -i 's/{{.Kind}}/Role/' $(ROLE)
+ sed -i 's/{{.Role}}/$(ROLENAME)/' $(ROLE)
+ sed -i 's/- kind:/kind:/' $(ROLE)
+ sed -i 's/^ //' $(ROLE)
+ cp $(ASSETS)/install/cluster_role_jaeger.yml.tmpl $(ROLE_JAEGER)
+ sed -i '/^{{\|^#\|^$$/d' $(ROLE_JAEGER)
+ cp $(ASSETS)/install/cluster_role_kafka.yml.tmpl $(ROLE_KAFKA)
+ cp $(ASSETS)/install/cluster_role_olm.yml.tmpl $(ROLE_OLM)
+ sed -i '/^{{\|^$$/d' $(ROLE_OLM)
+ sed -i 's/^- /\n---\n/' $(ROLE_OLM)
+ sed -i 's/^ //' $(ROLE_OLM)
+ sed -i '/{{- if\|{{- end/d' $(ROLE_OLM)
+ cp $(ASSETS)/install/cluster_role_public_api.yml.tmpl $(ROLE_PUBLIC_API)
diff --git a/install/operator/kustomize/dev/app/Makefile b/install/operator/kustomize/dev/app/Makefile
new file mode 100644
index 00000000000..b634fbacf03
--- /dev/null
+++ b/install/operator/kustomize/dev/app/Makefile
@@ -0,0 +1,13 @@
+ASSETS := ../../../pkg/generator/assets
+CR := ./syndesis-cr.yml
+
+.PHONY: sync
+
+#
+# Copy the go template from the src directory
+# Convert the go template to a formatted yaml file:
+# - Remove any range/end sections (not required)
+#
+sync:
+ cp $(ASSETS)/install/app.yml.tmpl $(CR)
+ sed -i '/{{- range/,/{{- end }}\|{{end}}/d' $(CR)
diff --git a/install/operator/kustomize/dev/operator/Makefile b/install/operator/kustomize/dev/operator/Makefile
new file mode 100644
index 00000000000..fb43d0d91c5
--- /dev/null
+++ b/install/operator/kustomize/dev/operator/Makefile
@@ -0,0 +1,22 @@
+DEV_IMAGE ?= syndesis-operator
+TAG ?= latest
+
+PATCH_ANNOTATION_SRC := ./annotation-patch.yaml
+PATCH_ANNOTATION_TGT := ./annotation-patch.yml
+PATCH_ENV_VAR_SRC := ./env-var-patch.yaml
+PATCH_ENV_VAR_TGT := ./env-var-patch.yml
+PATCH_IMG_STREAM_SRC := ./image-stream-patch.yaml
+PATCH_IMG_STREAM_TGT := ./image-stream-patch.yml
+
+.PHONY: sync
+
+#
+# Injects the DEV_IMAGE & TAG values into the patches
+#
+sync:
+ cp $(PATCH_ANNOTATION_SRC) $(PATCH_ANNOTATION_TGT)
+ sed -i 's/{{.Tag}}/$(TAG)/' $(PATCH_ANNOTATION_TGT)
+ cp $(PATCH_ENV_VAR_SRC) $(PATCH_ENV_VAR_TGT)
+ cp $(PATCH_IMG_STREAM_SRC) $(PATCH_IMG_STREAM_TGT)
+ sed -i 's_{{.Image}}_$(DEV_IMAGE)_' $(PATCH_IMG_STREAM_TGT)
+ sed -i 's/{{.Tag}}/$(TAG)/' $(PATCH_IMG_STREAM_TGT)
diff --git a/install/operator/kustomize/release/Makefile b/install/operator/kustomize/release/Makefile
new file mode 100644
index 00000000000..f1efb1501da
--- /dev/null
+++ b/install/operator/kustomize/release/Makefile
@@ -0,0 +1,44 @@
+
+VERSION := 1.0.0
+
+#
+# Make Options
+#
+MK_OPTIONS := -s
+
+.PHONY: $(SUBDIRS)
+
+SYNCDIRS := ../app ../bases/crd ../bases/deployment ../bases/grant ../bases/jaeger-crd ../bases/role ../dev/app ../dev/operator
+
+sync:
+ for dir in $(SYNCDIRS); do \
+ $(MAKE) $(MK_OPTIONS) -C $$dir; \
+ done
+
+RELEASEDIRS := ../app ../bases ../dev ../operator ../product ../setup ../setup-jaeger
+
+syndesis:
+ #@ Make a new syndesis builddirectory
+ mkdir -p syndesis
+ #@ Copy directories into build directory
+ for dir in $(RELEASEDIRS); do \
+ cp -rf $$dir syndesis/; \
+ done
+ #@ Remove sync rules from Makefiles
+ for f in `find ./syndesis -name Makefile`; do \
+ echo -e "sync:\n #@ Not required in release" > $$f; \
+ done
+ #@ Copy the root Makefile into build directory
+ cp -f ../Makefile syndesis/
+ #@ Hand off to the release script
+ ./release.sh --version $(VERSION)
+
+release: sync syndesis
+ifndef VERSION
+ $(error VERSION is not set)
+endif
+
+ tar zcvf syndesis-install-release-$(VERSION).tar.gz syndesis
+
+clean:
+ rm -rf syndesis *.tar.gz
diff --git a/install/operator/kustomize/release/release.sh b/install/operator/kustomize/release/release.sh
new file mode 100755
index 00000000000..b6240f00b57
--- /dev/null
+++ b/install/operator/kustomize/release/release.sh
@@ -0,0 +1,227 @@
+#!/bin/bash
+
+# Save global script args
+ARGS=("$@")
+
+# Exit if any error occurs
+# Fail on a single failed command in a pipeline (if supported)
+set -o pipefail
+
+# Fail on error and undefined vars (please don't use global vars, but evaluation of functions for return values)
+set -eu
+
+# Helper functions
+
+# Dir where this script is located
+basedir() {
+ # Default is current directory
+ local script=${BASH_SOURCE[0]}
+
+ # Resolve symbolic links
+ if [ -L $script ]; then
+ if readlink -f $script >/dev/null 2>&1; then
+ script=$(readlink -f $script)
+ elif readlink $script >/dev/null 2>&1; then
+ script=$(readlink $script)
+ elif realpath $script >/dev/null 2>&1; then
+ script=$(realpath $script)
+ else
+ echo "ERROR: Cannot resolve symbolic link $script"
+ exit 1
+ fi
+ fi
+
+ local dir=$(dirname "$script")
+ local full_dir=$(cd "${dir}" && pwd)
+ echo ${full_dir}
+}
+
+# Checks if a flag is present in the arguments.
+hasflag() {
+ filters="$@"
+ for var in "${ARGS[@]:-}"; do
+ for filter in $filters; do
+ if [ "$var" = "$filter" ]; then
+ echo 'true'
+ return
+ fi
+ done
+ done
+}
+
+# Read the value of an option.
+readopt() {
+ filters="$@"
+ next=false
+ for var in "${ARGS[@]:-}"; do
+ if $next; then
+ echo $var
+ break;
+ fi
+ for filter in $filters; do
+ if [[ "$var" = ${filter}* ]]; then
+ local value="${var//${filter}=/}"
+ if [ "$value" != "$var" ]; then
+ echo $value
+ return
+ fi
+ next=true
+ fi
+ done
+ done
+}
+
+# Getting base dir
+BASEDIR=$(basedir)
+COMMON_RELEASE_GIT_ORG="phantomjinx"
+COMMON_RELEASE_GIT_REPO="syndesis"
+TAR_NAME="syndesis-install-release"
+
+
+display_usage() {
+ cat <$ERROR_FILE 2>&1
+ local err=$?
+ set -e
+ if [ $err -ne 0 ]; then
+ echo "ERROR: Cannot upload release artifact $file on remote github repository"
+ return
+ fi
+}
+
+release_tar() {
+ local github_username=$(get_github_username)
+ check_error $github_username
+
+ local github_token=$(get_github_access_token)
+ check_error $github_token
+
+ result=$(publish_artifact)
+ check_error $result
+}
+
+release() {
+ if [ -z ${VERSION} ]; then
+ check_error "Error: Version not defined"
+ fi
+
+ local release_file="${TAR_NAME}-${VERSION}"
+
+ echo "==== Releasing tar file"
+ release_tar
+
+ echo "=== Tagging ${release_file}"
+ git tag -f "${release_file}"
+
+ # Push release tag
+ git_push "${release_file}"
+}
+
+
+# ==========================================================================================
+
+if [ "$#" -ne 1 ]; then
+ echo "usage: $0 "
+ exit 1
+fi
+
+VERSION="${1}"
+release