From 4ae39c5e4c2f56f941d814f4cea36459cf483715 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Mon, 22 Apr 2024 18:05:56 +0200 Subject: [PATCH] fix(ci): support go:embed resources for make bundle procedure --- .../config/manager/kustomization.yaml | 0 .../bases/camel-k.clusterserviceversion.yaml | 0 .../config/manifests/global-labels.yaml | 13 +- .../config/manifests/kustomization.yaml | 0 .../patch-delete-user-cluster-role.yaml | 0 config/manager/kustomization.yaml | 28 --- .../bases/camel-k.clusterserviceversion.yaml | 173 ------------------ config/manifests/kustomization.yaml | 39 ---- pkg/resources/config/manifests/.vfsignore | 2 +- ...tch-delete-pvc.yaml => global-labels.yaml} | 19 +- .../config/manifests/kustomization.yaml | 3 +- script/Makefile | 16 +- 12 files changed, 25 insertions(+), 268 deletions(-) rename ci/downstream/{ => pkg/resources}/config/manager/kustomization.yaml (100%) rename ci/downstream/{ => pkg/resources}/config/manifests/bases/camel-k.clusterserviceversion.yaml (100%) rename config/manifests/patch-delete-user-cluster-role.yaml => ci/downstream/pkg/resources/config/manifests/global-labels.yaml (87%) rename ci/downstream/{ => pkg/resources}/config/manifests/kustomization.yaml (100%) rename ci/downstream/{ => pkg/resources}/config/manifests/patch-delete-user-cluster-role.yaml (100%) delete mode 100644 config/manager/kustomization.yaml delete mode 100644 config/manifests/bases/camel-k.clusterserviceversion.yaml delete mode 100644 config/manifests/kustomization.yaml rename pkg/resources/config/manifests/{patch-delete-pvc.yaml => global-labels.yaml} (83%) diff --git a/ci/downstream/config/manager/kustomization.yaml b/ci/downstream/pkg/resources/config/manager/kustomization.yaml similarity index 100% rename from ci/downstream/config/manager/kustomization.yaml rename to ci/downstream/pkg/resources/config/manager/kustomization.yaml diff --git a/ci/downstream/config/manifests/bases/camel-k.clusterserviceversion.yaml b/ci/downstream/pkg/resources/config/manifests/bases/camel-k.clusterserviceversion.yaml similarity index 100% rename from ci/downstream/config/manifests/bases/camel-k.clusterserviceversion.yaml rename to ci/downstream/pkg/resources/config/manifests/bases/camel-k.clusterserviceversion.yaml diff --git a/config/manifests/patch-delete-user-cluster-role.yaml b/ci/downstream/pkg/resources/config/manifests/global-labels.yaml similarity index 87% rename from config/manifests/patch-delete-user-cluster-role.yaml rename to ci/downstream/pkg/resources/config/manifests/global-labels.yaml index e380103de8..9169b1f1e2 100644 --- a/config/manifests/patch-delete-user-cluster-role.yaml +++ b/ci/downstream/pkg/resources/config/manifests/global-labels.yaml @@ -14,9 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # --------------------------------------------------------------------------- - -$patch: delete -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 +apiVersion: builtin +kind: LabelTransformer metadata: - name: camel-k-edit + name: global-labels +labels: + app: camel-k +fieldSpecs: +- path: metadata/labels + create: true diff --git a/ci/downstream/config/manifests/kustomization.yaml b/ci/downstream/pkg/resources/config/manifests/kustomization.yaml similarity index 100% rename from ci/downstream/config/manifests/kustomization.yaml rename to ci/downstream/pkg/resources/config/manifests/kustomization.yaml diff --git a/ci/downstream/config/manifests/patch-delete-user-cluster-role.yaml b/ci/downstream/pkg/resources/config/manifests/patch-delete-user-cluster-role.yaml similarity index 100% rename from ci/downstream/config/manifests/patch-delete-user-cluster-role.yaml rename to ci/downstream/pkg/resources/config/manifests/patch-delete-user-cluster-role.yaml diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml deleted file mode 100644 index 94d3d33774..0000000000 --- a/config/manager/kustomization.yaml +++ /dev/null @@ -1,28 +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. -# --------------------------------------------------------------------------- - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -- operator-deployment.yaml -- operator-service-account.yaml - -patchesStrategicMerge: -- patch-toleration.yaml -- patch-node-selector.yaml -- patch-resource-requirements.yaml diff --git a/config/manifests/bases/camel-k.clusterserviceversion.yaml b/config/manifests/bases/camel-k.clusterserviceversion.yaml deleted file mode 100644 index 980b98d383..0000000000 --- a/config/manifests/bases/camel-k.clusterserviceversion.yaml +++ /dev/null @@ -1,173 +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. -# --------------------------------------------------------------------------- - -apiVersion: operators.coreos.com/v1alpha1 -kind: ClusterServiceVersion -metadata: - annotations: - capabilities: Full Lifecycle - categories: Integration & Delivery - certified: "false" - containerImage: registry-proxy.engineering.redhat.com/rh-osbs/integration-camel-k-rhel8-operator:2.2.0 - createdAt: 2022-09-21T12:01:32Z - description: Red Hat Integration - Camel K is a lightweight integration platform, - born on Kubernetes, with serverless superpowers. - features.operators.openshift.io/cnf: "false" - features.operators.openshift.io/cni: "false" - features.operators.openshift.io/csi: "false" - features.operators.openshift.io/disconnected: "false" - features.operators.openshift.io/fips-compliant: "true" - features.operators.openshift.io/proxy-aware: "true" - features.operators.openshift.io/tls-profiles: "false" - features.operators.openshift.io/token-auth-aws: "false" - features.operators.openshift.io/token-auth-azure: "false" - features.operators.openshift.io/token-auth-gcp: "false" - olm.skipRange: '>=1.8.0 <1.10.0' - operators.operatorframework.io/builder: operator-sdk-v1.16.0 - operators.operatorframework.io/internal-objects: '["builds.camel.apache.org","integrationkits.camel.apache.org","camelcatalogs.camel.apache.org"]' - operators.operatorframework.io/project_layout: go.kubebuilder.io/v2 - operators.openshift.io/valid-subscription: '["Red Hat Integration", "Red Hat Application Foundations", "Red Hat Camel K"]' - repository: https://github.com/apache/camel-k - support: Camel - name: camel-k.vX.Y.Z - namespace: placeholder -spec: - apiservicedefinitions: {} - customresourcedefinitions: - owned: - - description: Build is the Schema for the builds API - displayName: Build - kind: Build - name: builds.camel.apache.org - version: v1 - - description: CamelCatalog is the Schema for the camelcatalogs API - displayName: Camel Catalog - kind: CamelCatalog - name: camelcatalogs.camel.apache.org - version: v1 - - description: IntegrationKit is the Schema for the integrationkits API - displayName: Integration Kit - kind: IntegrationKit - name: integrationkits.camel.apache.org - version: v1 - - description: IntegrationPlatform is the Schema for the integrationplatforms - API - displayName: Integration Platform - kind: IntegrationPlatform - name: integrationplatforms.camel.apache.org - version: v1 - - description: Integration is the Schema for the integrations API - displayName: Integration - kind: Integration - name: integrations.camel.apache.org - version: v1 - - description: KameletBinding is the Schema for the kamelets binding API - displayName: Kamelet Binding - kind: KameletBinding - name: kameletbindings.camel.apache.org - version: v1alpha1 - - description: Kamelet is the Schema for the kamelets API - displayName: Kamelet - kind: Kamelet - name: kamelets.camel.apache.org - version: v1alpha1 - description: | - Red Hat Integration - Camel K - ============== - - **Red Hat Integration - Camel K** is a lightweight integration platform, born on Kubernetes, with serverless superpowers. - - ## Installation - - To start using Camel K, install the operator and then create the following `IntegrationPlatform`: - ``` - apiVersion: camel.apache.org/v1 - kind: IntegrationPlatform - metadata: - name: camel-k - labels: - app: "camel-k" - ``` - - An `IntegrationPlatform` resource is automatically created by default on OpenShift, so you can skip this step. - Also, You can edit the `IntegrationPlatform`, to configure Camel K. - The configuration from the `IntegrationPlatform` will apply to the Camel integrations created in the same namespace/project. - - ## Running an Integration - - After the initial setup, you can run a Camel integration on the cluster by creating an example `Integration`, e.g.: - ``` - apiVersion: camel.apache.org/v1 - kind: Integration - metadata: - name: example - spec: - sources: - - name: Example.java - content: | - import org.apache.camel.builder.RouteBuilder; - - public class Example extends RouteBuilder { - @Override - public void configure() throws Exception { - from("timer:tick") - .setBody(constant("Hello World!")) - .to("log:info?skipBodyLineSeparator=false"); - } - } - ``` - displayName: Red Hat Integration - Camel K - icon: - - base64data: PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2Q3MWUwMDt9LmNscy0ye2ZpbGw6I2MyMWEwMDt9LmNscy0ze2ZpbGw6I2ZmZjt9LmNscy00e2ZpbGw6I2VhZWFlYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkxvZ288L3RpdGxlPjxnIGlkPSJMYXllcl8xIiBkYXRhLW5hbWU9IkxheWVyIDEiPjxjaXJjbGUgY2xhc3M9ImNscy0xIiBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMC43MSA1MCkgcm90YXRlKC00NSkiLz48cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik04NS4zNiwxNC42NEE1MCw1MCwwLDAsMSwxNC42NCw4NS4zNloiLz48cGF0aCBkPSJNMzEsMzEuMzZhMS45NCwxLjk0LDAsMCwxLTMuNjItLjg5LjQzLjQzLDAsMCwxLC41My0uNDQsMy4zMiwzLjMyLDAsMCwwLDIuODEuN0EuNDMuNDMsMCwwLDEsMzEsMzEuMzZaIi8+PHBhdGggY2xhc3M9ImNscy0zIiBkPSJNNzcuNjMsNDQuNzZDNzcuMTIsNDEuMzQsNzMsMjEsNjYuMzIsMjFjLTIuNDQsMC00LjU5LDMuMzUtNiw2Ljg4LS40NCwxLjA2LTEuMjMsMS4wOC0xLjYzLDBDNTcuMjQsMjQuMTY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Y2xhc3M9ImNscy00IiBkPSJNNTAuNDEsNDkuMzZsLjE1LDUuODFhMTA4LjIsMTA4LjIsMCwwLDAsMTQtNC41NCwxOS43OSwxOS43OSwwLDAsMSwyLjA2LThDNTkuNDYsNDMuNyw1Ni40NCw0Ni41OCw1MC40MSw0OS4zNloiLz48L2c+PC9zdmc+ - mediatype: image/svg+xml - install: - spec: - deployments: null - strategy: deployment - installModes: - - supported: true - type: OwnNamespace - - supported: true - type: SingleNamespace - - supported: false - type: MultiNamespace - - supported: true - type: AllNamespaces - keywords: - - apache - - kamel - - kubernetes - - serverless - - microservices - labels: - name: camel-k-operator - links: - - name: Apache Camel K source code repository - url: https://github.com/apache/camel-k - maintainers: - - email: janstey@redhat.com - name: Jon Anstey - maturity: alpha - minKubeVersion: 1.14.0 - provider: - name: Red Hat - url: https://access.redhat.com/products/red-hat-integration - replaces: red-hat-camel-k-operator.vX.Y.Z - selector: - matchLabels: - name: camel-k-operator - version: X.Y.Z diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml deleted file mode 100644 index c12f1418c6..0000000000 --- a/config/manifests/kustomization.yaml +++ /dev/null @@ -1,39 +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. -# --------------------------------------------------------------------------- -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -# Labels to add to all resources and selectors. -transformers: -- global-labels.yaml - -resources: -- ../manager -- ../crd -- ../samples -- ../scorecard -- ../rbac -- ../rbac/namespaced -- ../rbac/openshift -- ../rbac/openshift/namespaced - -patchesStrategicMerge: -- patch-delete-user-cluster-role.yaml -images: -- name: registry-proxy.engineering.redhat.com/rh-osbs/integration-camel-k-rhel8-operator - newName: registry-proxy.engineering.redhat.com/rh-osbs/integration-camel-k-rhel8-operator - newTag: 2.2.0 diff --git a/pkg/resources/config/manifests/.vfsignore b/pkg/resources/config/manifests/.vfsignore index 7fcceda23f..07c5c829de 100644 --- a/pkg/resources/config/manifests/.vfsignore +++ b/pkg/resources/config/manifests/.vfsignore @@ -15,4 +15,4 @@ # limitations under the License. # --------------------------------------------------------------------------- -# This dir and subdirs are not included in VFS +# This dir and subdirs are not included in VFS \ No newline at end of file diff --git a/pkg/resources/config/manifests/patch-delete-pvc.yaml b/pkg/resources/config/manifests/global-labels.yaml similarity index 83% rename from pkg/resources/config/manifests/patch-delete-pvc.yaml rename to pkg/resources/config/manifests/global-labels.yaml index ef4d9825ac..9169b1f1e2 100644 --- a/pkg/resources/config/manifests/patch-delete-pvc.yaml +++ b/pkg/resources/config/manifests/global-labels.yaml @@ -14,15 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # --------------------------------------------------------------------------- - -apiVersion: apps/v1 -kind: Deployment +apiVersion: builtin +kind: LabelTransformer metadata: - name: camel-k-operator -spec: - template: - spec: - containers: - - name: camel-k-operator - volumeMounts: null - volumes: null + name: global-labels +labels: + app: camel-k +fieldSpecs: +- path: metadata/labels + create: true diff --git a/pkg/resources/config/manifests/kustomization.yaml b/pkg/resources/config/manifests/kustomization.yaml index 97234f32a2..fe91ef5ac1 100644 --- a/pkg/resources/config/manifests/kustomization.yaml +++ b/pkg/resources/config/manifests/kustomization.yaml @@ -33,8 +33,7 @@ resources: patchesStrategicMerge: - patch-delete-user-cluster-role.yaml -- patch-delete-pvc.yaml images: - name: docker.io/apache/camel-k newName: docker.io/apache/camel-k - newTag: 2.3.1-SNAPSHOT + newTag: 2.3.0-SNAPSHOT diff --git a/script/Makefile b/script/Makefile index d95c4294d0..731ac9d424 100644 --- a/script/Makefile +++ b/script/Makefile @@ -49,8 +49,8 @@ LINT_GOGC := 10 LINT_DEADLINE := 10m # olm bundle vars -MANAGER := config/manager -MANIFESTS := config/manifests +MANAGER := pkg/resources/config/manager +MANIFESTS := pkg/resources/config/manifests BUNDLE_DIR := bundle DEFAULT_CHANNEL ?= $(shell echo "stable-v$(word 1,$(subst ., ,$(lastword $(OPERATOR_VERSION))))") CHANNELS ?= $(DEFAULT_CHANNEL),latest @@ -300,7 +300,6 @@ endif build-resources: ./script/get_catalog.sh $(DEFAULT_RUNTIME_VERSION) $(STAGING_RUNTIME_REPO) - go generate ./pkg/... bundle-kamelets: ifneq (,$(findstring release,$(MAKECMDGOALS))) @@ -522,10 +521,9 @@ $(BUNDLE_CAMEL_APIS): operator-sdk @# Remove the camel directory and re-copy only the required api rm -rf api_$@/camel/* && cp -rf pkg/apis/camel/$@ api_$@/camel/ @# operator-sdk generate ... cannot execute across separate modules so need to temporarily move api - $(OPERATOR_SDK) generate kustomize manifests --apis-dir $(addprefix api_, $@) -q @# Adds the licence header to the csv file. - ./script/add_license.sh config/manifests/bases ./script/headers/yaml.txt - ./script/add_createdAt.sh config/manifests/bases + ./script/add_license.sh pkg/resources/config/manifests/bases ./script/headers/yaml.txt + ./script/add_createdAt.sh pkg/resources/config/manifests/bases @# Clean up temporary working api directories rm -rf api_* @@ -558,12 +556,12 @@ pre-bundle: bundle: set-version generate-crd kustomize operator-sdk pre-bundle $(BUNDLE_CAMEL_APIS) @# Sets the operator image to the preferred image:tag - @cd config/manifests && $(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION) + @cd pkg/resources/config/manifests && $(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION) @# Build kustomize manifests - @$(KUSTOMIZE) build config/manifests | \ + @$(KUSTOMIZE) build pkg/resources/config/manifests | \ $(OPERATOR_SDK) generate bundle \ -q --overwrite --version $(OPERATOR_VERSION) \ - --kustomize-dir config/manifests $(BUNDLE_METADATA_OPTS) + --kustomize-dir pkg/resources/config/manifests $(BUNDLE_METADATA_OPTS) @# Move the dockerfile into the bundle directory ifeq ($(shell uname -s 2>/dev/null || echo Unknown),Darwin) @mv bundle.Dockerfile bundle/Dockerfile && sed -i '' 's/bundle\///g' bundle/Dockerfile