diff --git a/.gitignore b/.gitignore index 1702b92a42..14fbc3c0c7 100644 --- a/.gitignore +++ b/.gitignore @@ -166,4 +166,4 @@ config/**/*.gen.tmpl config/**/*.gen.yaml config/**/*.gen.json -release/*-installer* +*-installer* diff --git a/install/Makefile b/install/Makefile index e0c497908f..a84e6273fb 100644 --- a/install/Makefile +++ b/install/Makefile @@ -51,7 +51,7 @@ HEALTH_PORT ?= 8081 # Operator Logging Level: string [info, debug, 0, 1] LOGGING_LEVEL ?= info -CONFIG := ../config +CONFIG := config MANAGER := $(CONFIG)/manager SAMPLES := $(CONFIG)/samples RBAC := $(CONFIG)/rbac diff --git a/install/config b/install/config new file mode 120000 index 0000000000..3ca249e06b --- /dev/null +++ b/install/config @@ -0,0 +1 @@ +../config \ No newline at end of file diff --git a/install/example/kustomization.yaml b/install/example/kustomization.yaml index 6c0d51d85c..6b9541ac78 100644 --- a/install/example/kustomization.yaml +++ b/install/example/kustomization.yaml @@ -18,4 +18,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../config/samples/bases/camel_v1_integration.yaml +- ../config/samples/bases/camel_v1_integration.yaml diff --git a/install/operator/kustomization.yaml b/install/operator/kustomization.yaml index 3b5d1f1e07..e9412ac08c 100644 --- a/install/operator/kustomization.yaml +++ b/install/operator/kustomization.yaml @@ -43,4 +43,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../config/manager +- ../config/manager diff --git a/install/platform/kustomization.yaml b/install/platform/kustomization.yaml index 7102db8012..b425aeb515 100644 --- a/install/platform/kustomization.yaml +++ b/install/platform/kustomization.yaml @@ -15,10 +15,16 @@ # limitations under the License. # --------------------------------------------------------------------------- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + # # * patch-integration-platform.yaml # customizes the integration platform custom resource # Edit the patch manually to add required configuration # resources: -- ../../config/samples/bases/camel_v1_integrationplatform.yaml +- ../config/samples/bases/camel_v1_integrationplatform.yaml + +patchesStrategicMerge: +- ../config/samples/patch-integration-platform.yaml diff --git a/install/release/Makefile b/install/release/Makefile deleted file mode 100644 index c35ba2a9a2..0000000000 --- a/install/release/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# Include the main camel-k Makefile containing -# basic common recipes like kustomize and vars -# like VERSION -# - -.PHONY: $(SUBDIRS) - -INSTALLDIR := $(RELEASE_NAME)-installer -CONFIG := ../../config -INSTALL := ../../install -CMDUTIL := cmd/util - -RELEASE := $(CONFIG) $(INSTALL) - -default: release - -check-vars: -ifndef RELEASE_VERSION - $(error RELEASE_VERSION is not set) -endif -ifndef RELEASE_NAME - $(error RELEASE_NAME is not set) -endif - -create: - #@ Make a new build directory - @mkdir -p $(INSTALLDIR) - #@ Copy directories into build directory - @for rel in $(RELEASE); do \ - relname=$$(basename $$rel); \ - for dir in `find $$rel -mindepth 1 -maxdepth 1 \( ! -iname "*release*" \)`; do \ - mkdir -p "$(INSTALLDIR)/$$relname"; \ - cp -rfL $$dir $(INSTALLDIR)/$$relname/; \ - done \ - done - #@ Copy the platform-check go source since its built and run during install - @mkdir -p $(INSTALLDIR)/$(CMDUTIL) && \ - cp -rf ../../$(CMDUTIL)/platform-check $(INSTALLDIR)/$(CMDUTIL)/ - -release: check-vars create - #@tar zcvf $(INSTALLDIR)-$(RELEASE_VERSION).tar.gz $(INSTALLDIR) - -clean: - @rm -rf *-installer *.tar.gz diff --git a/install/setup-cluster/kustomization.yaml b/install/setup-cluster/kustomization.yaml index 88d4747cbb..cfce7838b8 100644 --- a/install/setup-cluster/kustomization.yaml +++ b/install/setup-cluster/kustomization.yaml @@ -18,5 +18,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../config/crd -- ../../config/rbac/user-cluster-role.yaml +- ../config/crd +- ../config/rbac/user-cluster-role.yaml diff --git a/install/setup/kustomization.yaml b/install/setup/kustomization.yaml index 9b3c34e6f5..c10dfd6538 100644 --- a/install/setup/kustomization.yaml +++ b/install/setup/kustomization.yaml @@ -18,4 +18,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../config/rbac +- ../config/rbac diff --git a/script/Makefile b/script/Makefile index 89d4ebca5c..1f5c56cadd 100644 --- a/script/Makefile +++ b/script/Makefile @@ -499,6 +499,11 @@ release-nightly: clean codegen set-module-version set-version build-resources bu release-helm: ./script/release_helm.sh +release-kustomize: + RELEASE_VERSION=$(CUSTOM_VERSION) \ + RELEASE_NAME=$(PACKAGE) \ + ./script/release_kustomize.sh + install-crc: ./script/install_crc.sh $(CUSTOM_VERSION) install-minikube: diff --git a/script/check_platform.sh b/script/check_platform.sh index 2b43f18d93..f3afc3b4ec 100755 --- a/script/check_platform.sh +++ b/script/check_platform.sh @@ -15,9 +15,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +location=$(dirname $0) +rootdir=$location/../ +cmdutil="./cmd/util" +check_binary="./platform-check" + check_platform() { set +e - echo $(./platform-check) + echo $(${check_binary}) set -e } @@ -40,23 +45,27 @@ is_binary_available() { echo "ERROR: No '${client}' binary found in path." } -location=$(dirname $0) -rootdir=$location/../ - cd $rootdir -if [ -d "./cmd/util/platform-check" ]; then +if [ -d "${cmdutil}/platform-check" ]; then + + if [ -f "${check_binary}" ]; then + # + # Avoid compiling again if binary already exists + # + go_result=$(check_platform) + else + hasgo=$(is_binary_available "go") + if [ "${hasgo}" == "OK" ]; then + go build ${cmdutil}/platform-check/ + if [ $? == 0 ]; then + go_result=$(check_platform) + else + go_result="ERROR: failed to build platform-check binary" + fi - hasgo=$(is_binary_available "go") - if [ "${hasgo}" == "OK" ]; then - go build ./cmd/util/platform-check/ - if [ $? == 0 ]; then - go_result=$(check_platform) else - go_result="ERROR: failed to build platform-check binary" + go_result="ERROR: cannot build platform-check" fi - - else - go_result="ERROR: cannot build platform-check" fi else diff --git a/script/release_kustomize.sh b/script/release_kustomize.sh new file mode 100755 index 0000000000..7f842420e8 --- /dev/null +++ b/script/release_kustomize.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +location=$(dirname $0) +rootdir=$(realpath ${location}/..) +configdir="config" +installdir="install" +cmdutildir="cmd/util" # make cmd a hidden directory + +check_env_var() { + if [ -z "${2}" ]; then + echo "Error: ${1} env var not defined" + exit 1 + fi +} + +check_env_var "RELEASE_VERSION" ${RELEASE_VERSION} +check_env_var "RELEASE_NAME" ${RELEASE_NAME} + +pushd ${rootdir} + +releasedir="${RELEASE_NAME}-${RELEASE_VERSION}-installer" +zipname="${RELEASE_NAME}-${RELEASE_VERSION}-installer.zip" + +if [ -d "${releasedir}" ]; then + rm -rf "${releasedir}" +fi +mkdir -p ${releasedir} + +# +# Copies contents of install and converts softlinks +# to target files. +# +cp -rfL "${installdir}"/* "${releasedir}/" + +# +# Copy the platform-check go source since its built and run during install +# +mkdir -p "${releasedir}/.${cmdutildir}/" +cp -rf "${cmdutildir}/platform-check" "${releasedir}/.${cmdutildir}/" + +# +# Update location of cmd to point to hidden directory version +# +sed -i 's~^cmdutil=.*~cmdutil=\"./.cmd/util\"~' ${releasedir}/script/check_platform.sh + +# +# Copy the config directory +# +cp -rfL "${configdir}" "${releasedir}/" + +# +# Zip up the release +# +if [ -f "${zipname}" ]; then + rm -f "${zipname}" +fi +zip -r "${zipname}" "${releasedir}" && rm -rf "${releasedir}"