You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2022/10/16 16:03:35 UTC

[camel-karavan] branch main updated: Fix #491

This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new c2eeb51  Fix #491
c2eeb51 is described below

commit c2eeb5115876f41bf7de3f88efef6e6fad8dcf8b
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Sun Oct 16 12:03:15 2022 -0400

    Fix #491
---
 .../src/main/resources/application.properties      |  2 +-
 karavan-generator/pom.xml                          |  2 +-
 .../karavan/operator/gitea/GiteaCatalogSource.java | 66 ++++++++++++++++++++++
 karavan-vscode/package.json                        |  4 +-
 4 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/karavan-app/src/main/resources/application.properties b/karavan-app/src/main/resources/application.properties
index 56914df..e936a39 100644
--- a/karavan-app/src/main/resources/application.properties
+++ b/karavan-app/src/main/resources/application.properties
@@ -16,7 +16,7 @@ karavan.kamelets-git-branch=main
 karavan.config.group-id=org.camel.karavan.demo
 karavan.config.image-group=karavan
 karavan.config.runtime=QUARKUS
-karavan.config.runtime-version=2.13.0.Final
+karavan.config.runtime-version=2.13.2.Final
 karavan.config.status-threshold=2000
 
 karavan.config.environments[0].name=dev
diff --git a/karavan-generator/pom.xml b/karavan-generator/pom.xml
index 771c7b8..7aedc70 100644
--- a/karavan-generator/pom.xml
+++ b/karavan-generator/pom.xml
@@ -29,7 +29,7 @@
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
         <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
-        <quarkus.platform.version>2.12.0.Final</quarkus.platform.version>
+        <quarkus.platform.version>2.13.2.Final</quarkus.platform.version>
         <surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
         <version.camel-core>3.18.2</version.camel-core>
         <version.camel-kamelet>0.9.1</version.camel-kamelet>
diff --git a/karavan-operator/src/main/java/org/apache/camel/karavan/operator/gitea/GiteaCatalogSource.java b/karavan-operator/src/main/java/org/apache/camel/karavan/operator/gitea/GiteaCatalogSource.java
new file mode 100644
index 0000000..ddb7dc8
--- /dev/null
+++ b/karavan-operator/src/main/java/org/apache/camel/karavan/operator/gitea/GiteaCatalogSource.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+package org.apache.camel.karavan.operator.resource;
+
+import io.fabric8.kubernetes.api.model.rbac.PolicyRuleBuilder;
+import io.fabric8.kubernetes.api.model.rbac.Role;
+import io.fabric8.kubernetes.api.model.rbac.RoleBuilder;
+import io.javaoperatorsdk.operator.api.reconciler.Context;
+import io.javaoperatorsdk.operator.api.reconciler.dependent.ReconcileResult;
+import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource;
+import org.apache.camel.karavan.operator.Constants;
+import org.apache.camel.karavan.operator.spec.Karavan;
+import org.apache.camel.karavan.operator.Utils;
+
+import java.util.Map;
+
+public class KaravanRole extends CRUDKubernetesDependentResource<Role, Karavan> {
+
+    public KaravanRole() {
+        super(Role.class);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Role desired(Karavan karavan, Context<Karavan> context) {
+        return new RoleBuilder()
+                .withNewMetadata()
+                .withName(Constants.ROLE_KARAVAN)
+                .withNamespace(karavan.getMetadata().getNamespace())
+                .withLabels(Utils.getLabels(Constants.ROLE_KARAVAN, Map.of()))
+                .endMetadata()
+                .withRules(
+                        new PolicyRuleBuilder().withApiGroups("").withResources("secrets", "configmaps").withVerbs("get", "list").build(),
+                        new PolicyRuleBuilder().withApiGroups("").withResources("persistentvolumes", "persistentvolumeclaims").withVerbs("get", "list", "watch").build(),
+                        new PolicyRuleBuilder().withApiGroups("tekton.dev").withResources("pipelineruns").withVerbs("*").build(),
+                        new PolicyRuleBuilder().withApiGroups("", "apps").withResources("deployments", "services", "routes", "replicationcontrollers").withVerbs("*").build()
+                        )
+                .build();
+    }
+
+    @Override
+    public ReconcileResult<Role> reconcile(Karavan karavan, Context<Karavan> context) {
+        Role role = getKubernetesClient().rbac().roles().inNamespace(karavan.getMetadata().getNamespace()).withName(Constants.ROLE_KARAVAN).get();
+        if (role == null) {
+            var desired = desired(karavan, context);
+            var createdResource = handleCreate(desired, karavan, context);
+            return ReconcileResult.resourceCreated(createdResource);
+        } else {
+            return ReconcileResult.noOperation(role);
+        }
+    }
+}
diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json
index b55b707..4fb1df8 100644
--- a/karavan-vscode/package.json
+++ b/karavan-vscode/package.json
@@ -62,7 +62,7 @@
       "properties": {
         "camel.version": {
           "type": "string",
-          "default": "3.18.1",
+          "default": "3.18.2",
           "description": "Camel version",
           "scope": "machine",
           "order": 10
@@ -81,7 +81,7 @@
         },
         "camel.quarkus-version": {
           "type": "string",
-          "default": "2.13.0.Final",
+          "default": "2.13.2.Final",
           "description": "Camel-quarkus version",
           "scope": "machine",
           "order": 21