This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit cd71e8e2701dd9acda22021186ab6db65fef6c6f Author: nferraro <ni.ferr...@gmail.com> AuthorDate: Thu Jun 6 12:18:40 2019 +0200 Fix #703: add initial SNAPSHOT CSV --- deploy/olm-catalog/camel-k.package.yaml | 2 +- .../camel-k.v0.3.3.clusterserviceversion.yaml | 0 ...el-k.v0.3.4-SNAPSHOT.clusterserviceversion.yaml | 390 +++++++++++++++++++++ deploy/olm-catalog/csv-config.yaml | 2 +- deploy/operator-role-olm.yaml | 182 ++++++++++ deploy/resources.go | 186 ++++++++++ script/Makefile | 10 +- script/unsnapshot_olm.sh | 22 ++ 8 files changed, 790 insertions(+), 4 deletions(-) diff --git a/deploy/olm-catalog/camel-k.package.yaml b/deploy/olm-catalog/camel-k.package.yaml index 79967b8..e061dab 100644 --- a/deploy/olm-catalog/camel-k.package.yaml +++ b/deploy/olm-catalog/camel-k.package.yaml @@ -18,4 +18,4 @@ packageName: camel-k channels: - name: alpha - currentCSV: camel-k-operator.v0.3.3 + currentCSV: camel-k-operator.v0.3.4-SNAPSHOT diff --git a/deploy/olm-catalog/camel-k.v0.3.3.clusterserviceversion.yaml b/deploy/olm-catalog/camel-k/0.3.3/camel-k.v0.3.3.clusterserviceversion.yaml similarity index 100% rename from deploy/olm-catalog/camel-k.v0.3.3.clusterserviceversion.yaml rename to deploy/olm-catalog/camel-k/0.3.3/camel-k.v0.3.3.clusterserviceversion.yaml diff --git a/deploy/olm-catalog/camel-k/0.3.4-SNAPSHOT/camel-k.v0.3.4-SNAPSHOT.clusterserviceversion.yaml b/deploy/olm-catalog/camel-k/0.3.4-SNAPSHOT/camel-k.v0.3.4-SNAPSHOT.clusterserviceversion.yaml new file mode 100644 index 0000000..9718838 --- /dev/null +++ b/deploy/olm-catalog/camel-k/0.3.4-SNAPSHOT/camel-k.v0.3.4-SNAPSHOT.clusterserviceversion.yaml @@ -0,0 +1,390 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: |- + [{ + "apiVersion": "camel.apache.org/v1alpha1", + "kind": "IntegrationPlatform", + "metadata": { + "name": "example" + }, + "spec": { + "build": { + "buildStrategy": "pod" + }, + "resources": { + "contexts": [ + "jvm" + ] + } + } + }, + { + "apiVersion": "camel.apache.org/v1alpha1", + "kind": "Integration", + "metadata": { + "name": "example" + }, + "spec": { + "source": { + "content": "// Add example Java code to create Integration", + "name": "Example.java" + } + } + }, + { + "apiVersion": "camel.apache.org/v1alpha1", + "kind": "IntegrationContext", + "metadata": { + "name": "example" + } + }, + { + "apiVersion": "camel.apache.org/v1alpha1", + "kind": "CamelCatalog", + "metadata": { + "name": "example" + } + }, + { + "apiVersion": "camel.apache.org/v1alpha1", + "kind": "Build", + "metadata": { + "name": "example" + } + }] + capabilities: Basic Install + categories: Integration & Delivery + certified: "false" + containerImage: docker.io/apache/camel-k:0.3.4-SNAPSHOT + createdAt: "2019-05-06T16:45:00Z" + description: Apache Camel K is a lightweight integration platform, born on Kubernetes, + with serverless superpowers. + repository: https://github.com/apache/camel-k + support: Camel + name: camel-k-operator.v0.3.4-SNAPSHOT + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: A Camel K build + displayName: Build + kind: Build + name: builds.camel.apache.org + version: v1alpha1 + - description: A Camel catalog + displayName: Camel Catalog + kind: CamelCatalog + name: camelcatalogs.camel.apache.org + version: v1alpha1 + - description: A Camel K integration + displayName: Integration + kind: Integration + name: integrations.camel.apache.org + version: v1alpha1 + - description: A Camel K integration context + displayName: Integration Context + kind: IntegrationContext + name: integrationcontexts.camel.apache.org + version: v1alpha1 + - description: A Camel K integration platform + displayName: Integration Platform + kind: IntegrationPlatform + name: integrationplatforms.camel.apache.org + version: v1alpha1 + description: | + Apache Camel K + ============== + + Apache 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/v1alpha1 + kind: IntegrationPlatform + metadata: + name: camel-k + labels: + app: "camel-k" + ``` + + ## Running an Integration + + After the initial setup, you can run a Camel integration on the cluster by creating an example `Integration`: + ``` + apiVersion: camel.apache.org/v1alpha1 + kind: Integration + metadata: + name: example + spec: + sources: + - 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"); + } + } + name: Example.java + ``` + displayName: Camel K Operator + icon: + - base64data: PHN2ZyB2aWV3Qm94PSIwIDAgMTMwLjIxIDEzMC4wMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSIzMzMuNDgiIHgyPSI0NzciIHkxPSI3MDIuNiIgeTI9IjU2My43MyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg5NC4wMzggMjc2LjA2KSBzY2FsZSguOTkyMDYpIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iI0Y2OTkyMyIgb2Zmc2V0PSIwIi8+PHN0b3Agc3RvcC1jb2xvcj0iI0Y3OUEyMyIgb2Zmc2V0PSIuMTEiLz48c3RvcCBzdG9wLWNvbG9yPSIjRTk3ODI2IiBvZmZzZXQ9Ii45NDUiLz48L2xp [...] + mediatype: image/svg+xml + install: + spec: + deployments: + - name: camel-k-operator + spec: + replicas: 1 + selector: + matchLabels: + name: camel-k-operator + strategy: + type: Recreate + template: + metadata: + labels: + camel.apache.org/component: operator + name: camel-k-operator + spec: + containers: + - command: + - camel-k + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: OPERATOR_NAME + value: camel-k + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: docker.io/apache/camel-k:0.3.4-SNAPSHOT + imagePullPolicy: IfNotPresent + name: camel-k-operator + resources: {} + serviceAccountName: camel-k-operator + permissions: + - rules: + - apiGroups: + - camel.apache.org + resources: + - '*' + verbs: + - '*' + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - configmaps + - secrets + - serviceaccounts + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + - rolebindings + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + resources: + - events + verbs: + - get + - list + - watch + - apiGroups: + - apps + resources: + - deployments + - replicasets + - statefulsets + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - apps + resources: + - daemonsets + verbs: + - get + - list + - watch + - apiGroups: + - extensions + resources: + - ingresses + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + - build.openshift.io + resources: + - buildconfigs + - buildconfigs/webhooks + - builds + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + - image.openshift.io + resources: + - imagestreamimages + - imagestreammappings + - imagestreams + - imagestreams/secrets + - imagestreamtags + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + - build.openshift.io + resources: + - buildconfigs/instantiate + - buildconfigs/instantiatebinary + - builds/clone + verbs: + - create + - apiGroups: + - "" + - route.openshift.io + resources: + - routes + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + - route.openshift.io + resources: + - routes/custom-host + verbs: + - create + - apiGroups: + - serving.knative.dev + resources: + - '*' + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + - apiGroups: + - eventing.knative.dev + resources: + - '*' + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + serviceAccountName: camel-k-operator + 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: Camel K source code repository + url: https://github.com/apache/camel-k + maintainers: + - email: us...@camel.apache.org + name: The Apache Software Foundation + maturity: alpha + minKubeVersion: 1.11.0 + provider: + name: The Apache Software Foundation + replaces: camel-k.v0.3.3 + selector: + matchLabels: + name: camel-k-operator + version: 0.3.4-SNAPSHOT diff --git a/deploy/olm-catalog/csv-config.yaml b/deploy/olm-catalog/csv-config.yaml index 76cca94..6a2abb7 100644 --- a/deploy/olm-catalog/csv-config.yaml +++ b/deploy/olm-catalog/csv-config.yaml @@ -22,4 +22,4 @@ crd-cr-paths: - deploy/crd-integration.yaml - deploy/crd-integration-context.yaml - deploy/crd-integration-platform.yaml -role-path: deploy/operator-role-kubernetes.yaml +role-path: deploy/operator-role-olm.yaml diff --git a/deploy/operator-role-olm.yaml b/deploy/operator-role-olm.yaml new file mode 100644 index 0000000..ca1ee2f --- /dev/null +++ b/deploy/operator-role-olm.yaml @@ -0,0 +1,182 @@ +kind: Role +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: camel-k-operator + labels: + app: "camel-k" +rules: +- apiGroups: + - camel.apache.org + resources: + - "*" + verbs: + - "*" +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - configmaps + - secrets + - serviceaccounts + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + - rolebindings + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - get + - list + - watch +- apiGroups: + - apps + resources: + - deployments + - replicasets + - statefulsets + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + attributeRestrictions: null + resources: + - daemonsets + verbs: + - get + - list + - watch +- apiGroups: + - extensions + resources: + - ingresses + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - "build.openshift.io" + resources: + - buildconfigs + - buildconfigs/webhooks + - builds + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - "image.openshift.io" + resources: + - imagestreamimages + - imagestreammappings + - imagestreams + - imagestreams/secrets + - imagestreamtags + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - build.openshift.io + attributeRestrictions: null + resources: + - buildconfigs/instantiate + - buildconfigs/instantiatebinary + - builds/clone + verbs: + - create +- apiGroups: + - "" + - "route.openshift.io" + resources: + - routes + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - route.openshift.io + resources: + - routes/custom-host + verbs: + - create +- apiGroups: + - serving.knative.dev + resources: + - "*" + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - eventing.knative.dev + resources: + - "*" + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch diff --git a/deploy/resources.go b/deploy/resources.go index 1c85319..c328be0 100644 --- a/deploy/resources.go +++ b/deploy/resources.go @@ -11033,6 +11033,192 @@ rules: - watch ` + Resources["operator-role-olm.yaml"] = + ` +kind: Role +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: camel-k-operator + labels: + app: "camel-k" +rules: +- apiGroups: + - camel.apache.org + resources: + - "*" + verbs: + - "*" +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - configmaps + - secrets + - serviceaccounts + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + - rolebindings + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - get + - list + - watch +- apiGroups: + - apps + resources: + - deployments + - replicasets + - statefulsets + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + attributeRestrictions: null + resources: + - daemonsets + verbs: + - get + - list + - watch +- apiGroups: + - extensions + resources: + - ingresses + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - "build.openshift.io" + resources: + - buildconfigs + - buildconfigs/webhooks + - builds + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - "image.openshift.io" + resources: + - imagestreamimages + - imagestreammappings + - imagestreams + - imagestreams/secrets + - imagestreamtags + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - build.openshift.io + attributeRestrictions: null + resources: + - buildconfigs/instantiate + - buildconfigs/instantiatebinary + - builds/clone + verbs: + - create +- apiGroups: + - "" + - "route.openshift.io" + resources: + - routes + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + - route.openshift.io + resources: + - routes/custom-host + verbs: + - create +- apiGroups: + - serving.knative.dev + resources: + - "*" + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch +- apiGroups: + - eventing.knative.dev + resources: + - "*" + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch + +` Resources["operator-role-openshift.yaml"] = ` kind: Role diff --git a/script/Makefile b/script/Makefile index 70ff17e..030b4bb 100644 --- a/script/Makefile +++ b/script/Makefile @@ -114,6 +114,9 @@ build-resources: ./script/embed_resources.sh deploy go run cmd/util/json-schema-gen/jsonschemagen.go --out=./assets/json-schema +build-olm: + operator-sdk olm-catalog gen-csv --csv-version $(VERSION) --csv-config deploy/olm-catalog/csv-config.yaml --update-crds + build-compile-integration-tests: go test -c -tags=integration ./test/*.go @@ -179,11 +182,14 @@ package-examples: package-artifacts: ./script/package_maven_artifacts.sh $(RUNTIME_VERSION) -release: clean codegen set-version build-resources build images images-push cross-compile package-examples git-tag +unsnapshot-olm: + ./script/unsnapshot_olm.sh + +release: clean codegen set-version build-resources unsnapshot-olm build images images-push cross-compile package-examples git-tag install-minishift: ./script/install_minishift.sh install-minikube: ./script/install_minikube.sh -.PHONY: build build-operator build-kamel build-resources build-builder dep codegen images images-dec images-push test check test-integration clean release cross-compile package-examples set-version git-tag +.PHONY: build build-operator build-kamel build-resources build-builder build-olm unsnapshot-olm dep codegen images images-dec images-push test check test-integration clean release cross-compile package-examples set-version git-tag diff --git a/script/unsnapshot_olm.sh b/script/unsnapshot_olm.sh new file mode 100755 index 0000000..4af2774 --- /dev/null +++ b/script/unsnapshot_olm.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Prefer unsnapshotting to regenerating, because changes done to snapshot file may get lost + +location=$(dirname $0) +olm_catalog=${location}/../deploy/olm-catalog + + +for d in $(find ${olm_catalog} -type d -name "*-SNAPSHOT*"); +do + mv ${d} ${d//-SNAPSHOT/} +done + +for f in $(find ${olm_catalog} -type f -name "*-SNAPSHOT*"); +do + mv ${f} ${f//-SNAPSHOT/} +done + +for f in $(find ${olm_catalog} -type f); +do + sed -i 's/-SNAPSHOT//g' $f +done