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/12/19 15:23:04 UTC

[camel-karavan] branch main updated (03d9f11 -> 875420f)

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

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


    from 03d9f11  Status collect for spring-boot app
     new 0c90cae  Health properties for Spring-boot
     new 875420f  fix #569

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../quarkus-openshift-application.properties       |  2 +-
 .../spring-boot-kubernetes-application.properties  |  5 ++++
 .../spring-boot-openshift-application.properties   |  5 ++++
 karavan-vscode/package.json                        | 29 ++++++++++++++++++++--
 karavan-vscode/src/extension.ts                    | 28 +++++++++++++--------
 karavan-vscode/src/utils.ts                        |  8 ++++--
 6 files changed, 61 insertions(+), 16 deletions(-)


[camel-karavan] 01/02: Health properties for Spring-boot

Posted by ma...@apache.org.
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

commit 0c90cae9749d0c4da2ea8a2fd739d5cc58d4493d
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Mon Dec 19 10:07:11 2022 -0500

    Health properties for Spring-boot
---
 .../quarkus-openshift-application.properties       |  2 +-
 .../spring-boot-kubernetes-application.properties  |  5 ++++
 .../spring-boot-openshift-application.properties   |  5 ++++
 karavan-vscode/package.json                        | 29 ++++++++++++++++++++--
 karavan-vscode/src/utils.ts                        |  8 ++++--
 5 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/karavan-app/src/main/resources/snippets/quarkus-openshift-application.properties b/karavan-app/src/main/resources/snippets/quarkus-openshift-application.properties
index 3faada9..31de765 100644
--- a/karavan-app/src/main/resources/snippets/quarkus-openshift-application.properties
+++ b/karavan-app/src/main/resources/snippets/quarkus-openshift-application.properties
@@ -8,6 +8,6 @@ camel.jbang.dependencies=camel:microprofile-health,mvn:io.quarkus:quarkus-opensh
 camel.health.enabled=true
 camel.health.exposure-level=full
 quarkus.container-image.name={projectId}
-quarkus.openshift.route.expose=false
+quarkus.openshift.route.expose=true
 quarkus.openshift.part-of={projectId}
 quarkus.openshift.replicas=1
\ No newline at end of file
diff --git a/karavan-app/src/main/resources/snippets/spring-boot-kubernetes-application.properties b/karavan-app/src/main/resources/snippets/spring-boot-kubernetes-application.properties
index 8bcef42..6a75791 100644
--- a/karavan-app/src/main/resources/snippets/spring-boot-kubernetes-application.properties
+++ b/karavan-app/src/main/resources/snippets/spring-boot-kubernetes-application.properties
@@ -6,6 +6,11 @@ camel.jbang.runtime=spring-boot
 camel.jbang.dependencies=camel:microprofile-health
 camel.health.enabled=true
 camel.health.exposure-level=full
+management.endpoints.web.exposure.include=health
+management.health.probes.enabled=true
+management.health.livenessState.enabled=true
+management.health.readinessState.enabled=true
+management.endpoint.health.show-details=always
 jkube.version=1.10.1
 jkube.build.strategy=jib
 jkube.imagePullPolicy=IfNotPresent
diff --git a/karavan-app/src/main/resources/snippets/spring-boot-openshift-application.properties b/karavan-app/src/main/resources/snippets/spring-boot-openshift-application.properties
index 29b302d..8d917d8 100644
--- a/karavan-app/src/main/resources/snippets/spring-boot-openshift-application.properties
+++ b/karavan-app/src/main/resources/snippets/spring-boot-openshift-application.properties
@@ -6,6 +6,11 @@ camel.jbang.runtime=spring-boot
 camel.jbang.dependencies=camel:microprofile-health
 camel.health.enabled=true
 camel.health.exposure-level=full
+management.endpoints.web.exposure.include=health
+management.health.probes.enabled=true
+management.health.livenessState.enabled=true
+management.health.readinessState.enabled=true
+management.endpoint.health.show-details=always
 jkube.version=1.10.1
 jkube.build.strategy=jib
 jkube.imagePullPolicy=IfNotPresent
diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json
index de9d0ca..97bb49f 100644
--- a/karavan-vscode/package.json
+++ b/karavan-vscode/package.json
@@ -168,7 +168,7 @@
           "scope": "machine",
           "order": 70
         },
-        "Karavan.applicationProperties": {
+        "Karavan.quarkusApplicationProperties": {
           "type": "array",
           "uniqueItems": true,
           "items": {
@@ -186,10 +186,35 @@
             "camel.jbang.runtime=$RUNTIME",
             "camel.jbang.exportDir=.export"
           ],
-          "description": "application.properties template",
+          "description": "Quarkus application.properties template",
           "scope": "machine",
           "order": 90
         },
+        "Karavan.springbootApplicationProperties": {
+          "type": "array",
+          "uniqueItems": true,
+          "items": {
+            "type": "string"
+          },
+          "default": [
+            "camel.health.enabled=true",
+            "camel.health.exposure-level=full",
+            "camel.karavan.project-id=$NAME",
+            "camel.karavan.project-name=$NAME",
+            "camel.karavan.project-description=$NAME",
+            "camel.karavan.target=$TARGET",
+            "camel.jbang.gav=$GAV",
+            "camel.jbang.quarkusVersion=2.13.5.Final",
+            "camel.jbang.runtime=$RUNTIME",
+            "camel.jbang.exportDir=.export",
+            "management.endpoints.web.exposure.include=health",
+            "management.health.probes.enabled=true",
+            "management.endpoint.health.show-details=always"
+          ],
+          "description": "Spring-boot application.properties template",
+          "scope": "machine",
+          "order": 91
+        },
         "Karavan.quarkusOpenshiftProperties": {
           "type": "array",
           "uniqueItems": true,
diff --git a/karavan-vscode/src/utils.ts b/karavan-vscode/src/utils.ts
index bec776a..136b6c7 100644
--- a/karavan-vscode/src/utils.ts
+++ b/karavan-vscode/src/utils.ts
@@ -300,8 +300,12 @@ export async function createApplicationproperties(runtime: string, gav: string,
         const uriFolder: Uri = workspace.workspaceFolders[0].uri;
         const name = currentFolderName() || "";
 
-        const props: string[] = workspace.getConfiguration().get("Karavan.applicationProperties") || [];
-        const runtimeProps: string[] = workspace.getConfiguration().get("Karavan.".concat(runtime.replaceAll("-", "")).concat(capitalize(target)).concat("Properties")) || [];
+        const runtimePrefix = runtime.replaceAll("-", "");
+        const appPropertyName = "Karavan.".concat(runtimePrefix).concat("ApplicationProperties");
+        const targetPropertyName = "Karavan.".concat(runtimePrefix).concat(capitalize(target)).concat("Properties");
+
+        const props: string[] = workspace.getConfiguration().get(appPropertyName) || [];
+        const runtimeProps: string[] = workspace.getConfiguration().get(targetPropertyName) || [];
 
         const text = props.concat(runtimeProps).map(v => {
             if (v.includes('$NAME')) return v.replace('$NAME', name)


[camel-karavan] 02/02: fix #569

Posted by ma...@apache.org.
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

commit 875420f29321ee58743fe97f122248ee1e9ba42e
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Mon Dec 19 10:22:49 2022 -0500

    fix #569
---
 karavan-vscode/src/extension.ts | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/karavan-vscode/src/extension.ts b/karavan-vscode/src/extension.ts
index 3e2b52f..b009636 100644
--- a/karavan-vscode/src/extension.ts
+++ b/karavan-vscode/src/extension.ts
@@ -70,7 +70,7 @@ export function activate(context: ExtensionContext) {
     context.subscriptions.push(openFile);
 
     // Create application
-    const applicationCommand = commands.registerCommand("karavan.create-application", (...args: any[]) => {
+    const applicationCommand = commands.registerCommand("karavan.create-application", async (...args: any[]) => {
         if (rootPath) {
             const defaultRuntime: string = workspace.getConfiguration().get("camel.runtimes") || '';
             const deployTarget: string = workspace.getConfiguration().get("camel.deployTarget") || 'openshift';
@@ -83,17 +83,23 @@ export function activate(context: ExtensionContext) {
                 { label: "kubernetes", picked: "kubernetes" === deployTarget },
                 { label: "none", picked: "none" === deployTarget }
             ];
-            utils.hasApplicationProperties(rootPath).then(hasAP => {
-                if (hasAP) {
-                    window.showInformationMessage("Folder already contains application.properties");
-                } else {
-                    window.showQuickPick(runtimeOptions, { title: "Select Runtime", canPickMany: false }).then((runtime) => {
-                        window.showQuickPick(deployOptions, { title: "Select Deploy Target", canPickMany: false }).then((target) => {
-                            if (runtime && target) inputExportGav(runtime.label, target.label)
-                        })
+            const hasAP = await utils.hasApplicationProperties(rootPath);
+            let createApp = !hasAP;
+            if (hasAP) {
+                const replaceOptions: QuickPickItem[] = [
+                    { label: "Replace", picked: false },
+                    { label: "Cancel", picked: true }
+                ];
+                const replace = await window.showQuickPick(replaceOptions, {title: "Application already exists!", canPickMany: false });
+                createApp = replace?.label === replaceOptions.at(0)?.label;
+            }
+            if (createApp){
+                window.showQuickPick(runtimeOptions, { title: "Select Runtime", canPickMany: false }).then((runtime) => {
+                    window.showQuickPick(deployOptions, { title: "Select Deploy Target", canPickMany: false }).then((target) => {
+                        if (runtime && target) inputExportGav(runtime.label, target.label)
                     })
-                }
-            })
+                })
+            }
         }
     });
     context.subscriptions.push(applicationCommand);