You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "christophd (via GitHub)" <gi...@apache.org> on 2024/07/08 09:11:20 UTC

[PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

christophd opened a new pull request, #14757:
URL: https://github.com/apache/camel/pull/14757

   # Description
   
   <!--
   - Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   -->
   
   This PR introduces a new Camel JBang plugin to deploy/run on Kubernetes. The plugin extends the Camel JBang export functionality to also generate a Kubernetes manifest (kubernetes.yml) which holds all resources (Deployment, Service, ConfigMap, etc.) to run the application on Kubernetes.
   
   The idea is to run a project export first and then build and deploy via SB / Quarkus standards using the generated Kubernetes manifest just like how you would normally do this via their Maven plugins.
   
   The Kubernetes plugin provides the following commands:
   - export to generate the Quarkus/SB project with the Kubernetes manifest being part of the exported project
   - run to export the project in the background and call Maven package to build and deploy to Kubernetes (also supports `--dev` option to use automatic redeployment)
   - delete to remove all resources from Kubernetes using the generated Kubernetes manifest
   - logs to show the logs of the running Pod
   
   Traits:
   The Kubernetes export functionality is able to make use of the Camel K traits in order to simplify the Kubernetes manifest generation (e.g. adding envvars, configure exported ports, use volume mounts, secrets, configmaps etc.). At the moment the PR supports some basic traits (DeploymentTrait, ContainerTrait, EnvTrait, ...) more trait implementations may follow.
   
   Detailed changes in this PR:
   - Introduce new Camel JBang plugin `camel-jbang-plugin-kubernetes` to configure/run Camel applications on Kubernetes
   - Camel K JBang plugin depends on the new Kubernetes plugin
   - Move Kubernetes basics (e.g. PodLogs command) from Camel K plugin to the new Kubernetes plugin
   - Kubernetes plugin provides run, delete, export and logs command
   - Kubernetes export command extends the arbitrary project export command and adds the generation of a Kubernetes manifest (kubernetes.yml) that becomes part of the exported project.
   - Kubernetes run command uses the exported project to build the application image (with container-jib)
   - Kubernetes deployment is done with arbitrary Quarkus/Spring Boot tooling and uses the generated Kubernetes manifest (kubernetes.yml)
   - Kubernetes delete command uses the manifest (kubernetes.yml) to remove all resources
   - Kubernetes logs command connects to the pod (selected via label conventions) and displays the log output
   
   The PR put focus on Maven based projects with Quarkus platform as a runtime. Next step would be to also apply this Kubernetes run mechanism to Spring Boot (eventually camel-main).
   
   TODOs in this PR:
   - remove Camel K CRD model dependency in favor of using own trait domain model in Camel JBang
   - make image builder configurable to support builders other than quarkus-container-image-jib
   - remove fixed kubernetes-client version as soon as 6.13.1 is part of the Quarkus platform
   - implement SpringBoot project build & Kubernetes deployment
   
   This is considered to be a draft PR in order to find agreement within the team and to do some tuning with adding documentation and writing some unit tests.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   See CAMEL-20904
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [x] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
   
   <!--
   You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1668494746


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java:
##########
@@ -47,9 +49,9 @@ protected Integer export() throws Exception {
             System.err.println("The runtime option must be specified");
             return 1;
         }
+
         if (gav == null) {
-            System.err.println("The gav option must be specified");
-            return 1;
+            gav = "org.apache.camel:%s:%s".formatted(getProjectName(), getVersion());

Review Comment:
   I guess you got tired of typing `--gav` all the time for exports. 
   
   We can have this convention, but using `org.apache.camel` as group id is not a good idea as its not official ASF that is exported. So we need some other default to use.



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/PluginType.java:
##########
@@ -25,6 +25,7 @@
 public enum PluginType {
 
     CAMEL_K("camel-k", "k", "Manage Camel integrations on Kubernetes", "4.4.0"),

Review Comment:
   Managed Camel K integrations ...



##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-jbang-parent</artifactId>
+        <version>4.7.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-jbang-plugin-kubernetes</artifactId>
+
+    <name>Camel :: JBang :: Plugin :: Kubernetes</name>
+    <description>Camel JBang Kubernetes Plugin</description>
+
+    <properties>
+        <firstVersion>4.4.0</firstVersion>

Review Comment:
   4.8.0



##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExport.java:
##########
@@ -0,0 +1,283 @@
+/*
+ * 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.dsl.jbang.core.commands.kubernetes;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.Export;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.TraitCatalog;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.TraitContext;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.TraitHelper;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.TraitProfile;
+import org.apache.camel.dsl.jbang.core.common.RuntimeType;
+import org.apache.camel.util.StringHelper;
+import org.apache.camel.v1.integrationspec.Traits;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+@Command(name = "export", description = "Export as Maven/Gradle project that contains a Kubernetes deployment manifest",
+         sortOptions = false)
+class KubernetesExport extends Export {
+
+    @CommandLine.Option(names = { "--trait-profile" }, description = "The trait profile to use for the deployment.")
+    String traitProfile;
+
+    @CommandLine.Option(names = { "--dependency", "-d" },
+                        description = "Adds dependency that should be included, use \"camel:\" prefix for a Camel component, \"mvn:org.my:app:1.0\" for a Maven dependency.")
+    String[] dependencies;
+
+    @CommandLine.Option(names = { "--property", "-p" },
+                        description = "Add a runtime property or properties file from a path, a config map or a secret (syntax: [my-key=my-value|file:/path/to/my-conf.properties|[configmap|secret]:name]).")
+    String[] properties;
+
+    @CommandLine.Option(names = { "--config" },
+                        description = "Add a runtime configuration from a ConfigMap or a Secret (syntax: [configmap|secret]:name[/key], where name represents the configmap/secret name and key optionally represents the configmap/secret key to be filtered).")
+    String[] configs;
+
+    @CommandLine.Option(names = { "--resource" },
+                        description = "Add a runtime resource from a Configmap or a Secret (syntax: [configmap|secret]:name[/key][@path], where name represents the configmap/secret name, key optionally represents the configmap/secret key to be filtered and path represents the destination path).")
+    String[] resources;
+
+    @CommandLine.Option(names = { "--open-api-spec" }, description = "Add an OpenAPI spec (syntax: [configmap|file]:name).")
+    String[] openApis;
+
+    @CommandLine.Option(names = { "--env", "-e" },
+                        description = "Set an environment variable in the integration container, for instance \"-e MY_VAR=my-value\".")
+    String[] envVars;
+
+    @CommandLine.Option(names = { "--volume", "-v" },
+                        description = "Mount a volume into the integration container, for instance \"-v pvcname:/container/path\".")
+    String[] volumes;
+
+    @CommandLine.Option(names = { "--connect", "-c" },
+                        description = "A Service that the integration should bind to, specified as [[apigroup/]version:]kind:[namespace/]name.")
+    String[] connects;
+
+    @CommandLine.Option(names = { "--annotation" },
+                        description = "Add an annotation to the integration. Use name values pairs like \"--annotation my.company=hello\".")
+    String[] annotations;
+
+    @CommandLine.Option(names = { "--label" },
+                        description = "Add a label to the integration. Use name values pairs like \"--label my.company=hello\".")
+    String[] labels;
+
+    @CommandLine.Option(names = { "--traits", "-t" },
+                        description = "Add a trait configuration to the integration. Use name values pairs like \"--trait trait.name.config=hello\".")
+    String[] traits;
+
+    @CommandLine.Option(names = { "--image" },
+                        description = "The image name to be built.")
+    String image;
+
+    @CommandLine.Option(names = { "--image-registry" },
+                        defaultValue = "quay.io",
+                        description = "The image registry to hold the app container image.")
+    String imageRegistry = "quay.io";
+
+    @CommandLine.Option(names = { "--image-group" },
+                        description = "The image registry group used to push images to.")
+    String imageGroup;
+
+    public KubernetesExport(CamelJBangMain main) {
+        super(main);
+    }
+
+    public KubernetesExport(CamelJBangMain main, ExportConfigurer configurer) {
+        super(main);
+
+        runtime = configurer.runtime;
+        quarkusVersion = configurer.quarkusVersion;
+        symbolicLink = configurer.symbolicLink;
+        mavenWrapper = configurer.mavenWrapper;
+        gradleWrapper = configurer.gradleWrapper;
+        exportDir = configurer.exportDir;
+        files = configurer.files;
+        gav = configurer.gav;
+        fresh = configurer.fresh;
+        download = configurer.download;
+        quiet = configurer.quiet;
+        logging = configurer.logging;
+        loggingLevel = configurer.loggingLevel;
+    }
+
+    public Integer export() throws Exception {
+        if (runtime == null) {
+            runtime = RuntimeType.quarkus;
+        }
+
+        List<String> exportDependencies = Optional.ofNullable(dependencies).map(Arrays::asList).orElseGet(ArrayList::new);
+        exportDependencies.add("camel:cli-connector");
+        exportDependencies.add("io.quarkus:quarkus-kubernetes");
+        // TODO: make configurable to support builders other than quarkus-container-image-jib
+        exportDependencies.add("io.quarkus:quarkus-container-image-jib");
+
+        // TODO: remove when fixed kubernetes-client version is part of the Quarkus platform
+        // pin kubernetes-client to this version because of https://github.com/fabric8io/kubernetes-client/issues/6059
+        exportDependencies.add("io.fabric8:kubernetes-client:6.13.1");
+
+        if (super.dependencies != null) {
+            super.dependencies += "," + String.join(",", exportDependencies);
+        } else {
+            super.dependencies = String.join(",", exportDependencies);
+        }
+
+        additionalProperties = Optional.ofNullable(additionalProperties).orElse("");
+
+        Map<String, String> exportProps = new HashMap<>();
+
+        if (imageRegistry != null) {
+            if (imageRegistry.equals("kind") || imageRegistry.equals("kind-registry")) {
+                exportProps.put("quarkus.container-image.registry", "localhost:5001");
+                exportProps.put("quarkus.container-image.insecure", "true");
+            } else if (imageRegistry.equals("minikube") || imageRegistry.equals("minikube-registry")) {
+                exportProps.put("quarkus.container-image.registry", "localhost:5000");
+                exportProps.put("quarkus.container-image.insecure", "true");
+            } else {
+                exportProps.put("quarkus.container-image.registry", imageRegistry);
+            }
+        }
+
+        if (imageGroup != null) {
+            exportProps.put("quarkus.container-image.group", imageGroup);
+        }
+
+        if (additionalProperties.isEmpty()) {
+            additionalProperties = exportProps.entrySet().stream()
+                    .map(entry -> "%s=%s".formatted(entry.getKey(), entry.getValue())).collect(Collectors.joining(","));
+        } else {
+            additionalProperties += "," + exportProps.entrySet().stream()
+                    .map(entry -> "%s=%s".formatted(entry.getKey(), entry.getValue())).collect(Collectors.joining(","));
+        }
+
+        // run export
+        int exit = super.export();
+        if (exit != 0) {
+            if (!quiet) {
+                printer().println("Project export failed");
+            }
+            return exit;
+        }
+
+        String projectName = getProjectName();
+        TraitContext context = new TraitContext(projectName, getVersion());
+        if (traitProfile != null) {
+            context.setProfile(TraitProfile.valueOf(traitProfile));
+        }
+
+        if (!quiet) {
+            printer().println("Building Kubernetes manifest ...");
+        }
+
+        Traits traitsSpec;
+        if (traits != null && traits.length > 0) {
+            traitsSpec = TraitHelper.parseTraits(traits);
+        } else {
+            traitsSpec = new Traits();
+        }
+
+        TraitHelper.configureMountTrait(traitsSpec, configs, resources, volumes);
+        TraitHelper.configureOpenApiSpec(traitsSpec, openApis);
+        TraitHelper.configureProperties(traitsSpec, properties);
+        TraitHelper.configureContainerImage(traitsSpec, image, imageRegistry, imageGroup, projectName, getVersion());
+        TraitHelper.configureEnvVars(traitsSpec, envVars);
+        TraitHelper.configureConnects(traitsSpec, connects);
+
+        if (traitProfile != null) {
+            new TraitCatalog().traitsForProfile(TraitProfile.valueOf(traitProfile.toUpperCase(Locale.US))).forEach(t -> {
+                if (t.configure(traitsSpec, context)) {
+                    t.apply(traitsSpec, context);
+                }
+            });
+        } else {
+            new TraitCatalog().allTraits().forEach(t -> {
+                if (t.configure(traitsSpec, context)) {
+                    t.apply(traitsSpec, context);
+                }
+            });
+        }
+
+        String yaml = context.buildItems().stream().map(KubernetesHelper::dumpYaml).collect(Collectors.joining("---\n"));
+        safeCopy(new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)),
+                new File(exportDir + "/src/main/kubernetes/kubernetes.yml"));
+
+        if (!quiet) {
+            printer().println("Project export successful!");
+        }
+
+        return 0;
+    }
+
+    protected String getProjectName() {
+        if (image != null) {
+            return KubernetesHelper.sanitize(image.replaceAll(":", "-v"));
+        }
+
+        return KubernetesHelper.sanitize(super.getProjectName());
+    }
+
+    protected String getVersion() {
+        if (image != null) {
+            return StringHelper.afterLast(image, ":");
+        }
+
+        return super.getVersion();
+    }
+
+    /**
+     * Configurer used to customize internal options for the Export command.
+     *
+     * @param runtime

Review Comment:
   All this param javadoc is not really needed



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java:
##########
@@ -47,9 +49,9 @@ protected Integer export() throws Exception {
             System.err.println("The runtime option must be specified");
             return 1;
         }
+
         if (gav == null) {
-            System.err.println("The gav option must be specified");
-            return 1;
+            gav = "org.apache.camel:%s:%s".formatted(getProjectName(), getVersion());

Review Comment:
   And then required = true should be removed from gav option so its optional.



##########
dsl/camel-jbang/camel-jbang-plugin-k/pom.xml:
##########
@@ -46,6 +46,13 @@
           <artifactId>camel-jbang-core</artifactId>
         </dependency>
 
+        <!-- TODO: clarify why jbang plugin is not part of camel-bom -->

Review Comment:
   Add a JIRA so we can add it to camel-bam



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -802,6 +802,32 @@ private static String determinePackageName(String content) {
         return matcher.find() ? matcher.group(1) : null;
     }
 
+    /**
+     * Normalize dependency expression. Basically replaces "camel-" based artifact names to use proper "camel:" prefix.
+     *
+     * @param  dependency to normalize.
+     * @return            normalized dependency.
+     */
+    private static String normalizeDependency(String dependency) {
+        if (dependency.startsWith("camel-quarkus-")) {
+            return "camel:" + dependency.substring("camel-quarkus-".length());
+        }
+
+        if (dependency.startsWith("camel-quarkus:")) {
+            return "camel:" + dependency.substring("camel-quarkus:".length());
+        }
+
+        if (dependency.startsWith("camel-k-")) {
+            return "camel-k:" + dependency.substring("camel-k-".length());
+        }
+
+        if (dependency.startsWith("camel-")) {
+            return "camel:" + dependency.substring("camel-".length());
+        }
+

Review Comment:
   There is also spring boot that uses `-starter` so this would be needed when SB support is added



##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesDelete.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.dsl.jbang.core.commands.kubernetes;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.List;
+
+import io.fabric8.kubernetes.api.model.StatusDetails;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.StringHelper;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "delete", description = "Delete Camel application from Kubernetes", sortOptions = false)
+public class KubernetesDelete extends KubernetesBaseCommand {
+
+    @CommandLine.Parameters(description = "The Camel file(s) to run.",

Review Comment:
   delete



##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java:
##########
@@ -0,0 +1,390 @@
+/*
+ * 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.dsl.jbang.core.commands.kubernetes;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import io.fabric8.kubernetes.api.model.Pod;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.BaseTrait;
+import org.apache.camel.dsl.jbang.core.common.RuntimeCompletionCandidates;
+import org.apache.camel.dsl.jbang.core.common.RuntimeType;
+import org.apache.camel.dsl.jbang.core.common.RuntimeTypeConverter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.FileWatcherResourceReloadStrategy;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "run", description = "Run Camel application on Kubernetes", sortOptions = false)
+public class KubernetesRun extends KubernetesBaseCommand {
+
+    @CommandLine.Parameters(description = "The Camel file(s) to run.",
+                            arity = "0..9", paramLabel = "<files>")
+    String[] filePaths;
+
+    @CommandLine.Option(names = { "--trait-profile" }, description = "The trait profile to use for the deployment.")
+    String traitProfile;
+
+    @CommandLine.Option(names = { "--dependency", "-d" },
+                        description = "Adds dependency that should be included, use \"camel:\" prefix for a Camel component, \"mvn:org.my:app:1.0\" for a Maven dependency.")
+    String[] dependencies;
+
+    @CommandLine.Option(names = { "--property", "-p" },
+                        description = "Add a runtime property or properties file from a path, a config map or a secret (syntax: [my-key=my-value|file:/path/to/my-conf.properties|[configmap|secret]:name]).")
+    String[] properties;
+
+    @CommandLine.Option(names = { "--config" },
+                        description = "Add a runtime configuration from a ConfigMap or a Secret (syntax: [configmap|secret]:name[/key], where name represents the configmap/secret name and key optionally represents the configmap/secret key to be filtered).")
+    String[] configs;
+
+    @CommandLine.Option(names = { "--resource" },
+                        description = "Add a runtime resource from a Configmap or a Secret (syntax: [configmap|secret]:name[/key][@path], where name represents the configmap/secret name, key optionally represents the configmap/secret key to be filtered and path represents the destination path).")
+    String[] resources;
+
+    @CommandLine.Option(names = { "--open-api" }, description = "Add an OpenAPI spec (syntax: [configmap|file]:name).")
+    String[] openApis;
+
+    @CommandLine.Option(names = { "--env", "-e" },
+                        description = "Set an environment variable in the integration container, for instance \"-e MY_VAR=my-value\".")
+    String[] envVars;
+
+    @CommandLine.Option(names = { "--volume", "-v" },
+                        description = "Mount a volume into the integration container, for instance \"-v pvcname:/container/path\".")
+    String[] volumes;
+
+    @CommandLine.Option(names = { "--connect", "-c" },
+                        description = "A Service that the integration should bind to, specified as [[apigroup/]version:]kind:[namespace/]name.")
+    String[] connects;
+
+    @CommandLine.Option(names = { "--annotation" },
+                        description = "Add an annotation to the integration. Use name values pairs like \"--annotation my.company=hello\".")
+    String[] annotations;
+
+    @CommandLine.Option(names = { "--label" },
+                        description = "Add a label to the integration. Use name values pairs like \"--label my.company=hello\".")
+    String[] labels;
+
+    @CommandLine.Option(names = { "--traits", "-t" },
+                        description = "Add a trait configuration to the integration. Use name values pairs like \"--trait trait.name.config=hello\".")
+    String[] traits;
+
+    @CommandLine.Option(names = { "--wait", "-w" }, description = "Wait for the deployment to become ready.")
+    boolean wait;
+
+    @CommandLine.Option(names = { "--logs", "-l" }, description = "Print logs after Camel application has been started.")
+    boolean logs;
+
+    @CommandLine.Option(names = { "--reload", "--dev" },
+                        description = "Enables dev mode (live reload when source files are updated and saved)")
+    boolean dev;
+
+    @CommandLine.Option(names = { "--output", "-o" },
+                        description = "Just output the generated integration custom resource (supports: yaml or json).")
+    String output;
+
+    // Export options
+
+    @CommandLine.Option(names = { "--image" },
+                        description = "The image name to be built.")
+    String image;
+
+    @CommandLine.Option(names = { "--image-registry" },
+                        defaultValue = "quay.io",
+                        description = "The image registry to hold the app container image.")
+    String imageRegistry = "quay.io";
+
+    @CommandLine.Option(names = { "--image-group" },
+                        description = "The image registry group used to push images to.")
+    String imageGroup;
+
+    @CommandLine.Option(names = { "--image-platforms" },
+                        description = "List of target platforms. Each platform is defined using the pattern.")
+    String imagePlatforms;
+
+    @CommandLine.Option(names = { "--gav" }, description = "The Maven group:artifact:version")
+    String gav;
+
+    @CommandLine.Option(names = { "--runtime" },
+                        completionCandidates = RuntimeCompletionCandidates.class,
+                        defaultValue = "quarkus",
+                        converter = RuntimeTypeConverter.class,
+                        description = "Runtime (${COMPLETION-CANDIDATES})")
+    RuntimeType runtime = RuntimeType.quarkus;
+
+    @CommandLine.Option(names = { "--quarkus-version" }, description = "Quarkus Platform version",
+                        defaultValue = RuntimeType.QUARKUS_VERSION)
+    String quarkusVersion = RuntimeType.QUARKUS_VERSION;
+
+    public KubernetesRun(CamelJBangMain main) {
+        super(main);
+    }
+
+    public Integer doCall() throws Exception {
+        String projectName = getProjectName();
+
+        String workingDir = RUN_PLATFORM_DIR + "/" + projectName;
+
+        KubernetesExport export = new KubernetesExport(
+                getMain(), new KubernetesExport.ExportConfigurer(
+                        runtime,
+                        quarkusVersion,
+                        true,
+                        true,
+                        false,
+                        workingDir,
+                        List.of(filePaths),
+                        gav,
+                        true,
+                        true,
+                        false,
+                        false,
+                        "off"));
+
+        export.image = image;
+        export.imageRegistry = imageRegistry;
+        export.imageGroup = imageGroup;
+        export.traitProfile = traitProfile;
+        export.dependencies = dependencies;
+        export.properties = properties;
+        export.configs = configs;
+        export.resources = resources;
+        export.openApis = openApis;
+        export.envVars = envVars;
+        export.volumes = volumes;
+        export.connects = connects;
+        export.annotations = annotations;
+        export.labels = labels;
+        export.traits = traits;
+
+        printer().println("Exporting application ...");
+
+        int exit = export.export();
+        if (exit != 0) {
+            printer().println("Project export failed!");
+            return exit;
+        }
+
+        if (output != null) {
+            if (RuntimeType.quarkus == runtime) {
+                exit = buildQuarkus(workingDir);
+            } else if (RuntimeType.springBoot == runtime) {
+                exit = buildSpringBoot(workingDir);
+            }
+
+            if (exit != 0) {
+                printer().println("Project build failed!");
+                return exit;
+            }
+
+            File manifest;
+            switch (output) {
+                case "yaml" -> manifest = new File(workingDir, "target/kubernetes/kubernetes.yml");
+                case "json" -> manifest = new File(workingDir, "target/kubernetes/kubernetes.json");
+                default -> {
+                    printer().printf("Unsupported output format '%s' (supported: yaml, json)%n", output);
+                    return -1;
+                }
+            }
+
+            try (FileInputStream fis = new FileInputStream(manifest)) {
+                printer().println(IOHelper.loadText(fis));
+            }
+
+            return 0;
+        }
+
+        if (RuntimeType.quarkus == runtime) {
+            exit = deployQuarkus(workingDir);
+        } else if (RuntimeType.springBoot == runtime) {
+            exit = deploySpringBoot(workingDir);
+        }
+
+        if (exit != 0) {
+            printer().println("Deployment to Kubernetes failed!");
+            return exit;
+        }
+
+        if (dev) {
+            DefaultCamelContext reloadContext = new DefaultCamelContext(false);
+            configureFileWatch(reloadContext, export, workingDir);
+            reloadContext.start();
+        }
+
+        if (dev || wait || logs) {

Review Comment:
   If you run in `--dev` mode, does the pod autoatic delete when you exit via ctrl + c ?



##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java:
##########
@@ -0,0 +1,390 @@
+/*
+ * 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.dsl.jbang.core.commands.kubernetes;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import io.fabric8.kubernetes.api.model.Pod;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.BaseTrait;
+import org.apache.camel.dsl.jbang.core.common.RuntimeCompletionCandidates;
+import org.apache.camel.dsl.jbang.core.common.RuntimeType;
+import org.apache.camel.dsl.jbang.core.common.RuntimeTypeConverter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.FileWatcherResourceReloadStrategy;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "run", description = "Run Camel application on Kubernetes", sortOptions = false)
+public class KubernetesRun extends KubernetesBaseCommand {
+
+    @CommandLine.Parameters(description = "The Camel file(s) to run.",
+                            arity = "0..9", paramLabel = "<files>")
+    String[] filePaths;
+
+    @CommandLine.Option(names = { "--trait-profile" }, description = "The trait profile to use for the deployment.")
+    String traitProfile;
+
+    @CommandLine.Option(names = { "--dependency", "-d" },
+                        description = "Adds dependency that should be included, use \"camel:\" prefix for a Camel component, \"mvn:org.my:app:1.0\" for a Maven dependency.")
+    String[] dependencies;
+
+    @CommandLine.Option(names = { "--property", "-p" },

Review Comment:
   We do not favour single char options, we use `--prop` and `--dep` / `--deps`
   See the vanilla run command



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on PR #14757:
URL: https://github.com/apache/camel/pull/14757#issuecomment-2218576260

   Many thanks for the initial feedback. I think this one is ready for final review.
   
   I have fixed some reported issues, added unit tests, added documentation and the ability to auto remove the deployment when terminating a process with `--dev` option.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669871573


##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-jbang-parent</artifactId>
+        <version>4.7.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-jbang-plugin-kubernetes</artifactId>
+
+    <name>Camel :: JBang :: Plugin :: Kubernetes</name>
+    <description>Camel JBang Kubernetes Plugin</description>
+
+    <properties>
+        <firstVersion>4.4.0</firstVersion>

Review Comment:
   Good catch!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #14757:
URL: https://github.com/apache/camel/pull/14757#issuecomment-2213875560

   Great work @christophd - love that we can make it gitops compliant, and that the k8s experience becomes just a standard Q or SB maven project with that kubernetes yaml file. Must less that goes wrong, and its all done in the same way that users already do, or would do if they did it by hand.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669851407


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java:
##########
@@ -47,9 +49,9 @@ protected Integer export() throws Exception {
             System.err.println("The runtime option must be specified");
             return 1;
         }
+
         if (gav == null) {
-            System.err.println("The gav option must be specified");
-            return 1;
+            gav = "org.apache.camel:%s:%s".formatted(getProjectName(), getVersion());

Review Comment:
   > And then required = true should be removed from gav option so its optional.
   
   👍 I think the option is optional already



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669875502


##########
dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java:
##########
@@ -0,0 +1,390 @@
+/*
+ * 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.dsl.jbang.core.commands.kubernetes;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import io.fabric8.kubernetes.api.model.Pod;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.traits.BaseTrait;
+import org.apache.camel.dsl.jbang.core.common.RuntimeCompletionCandidates;
+import org.apache.camel.dsl.jbang.core.common.RuntimeType;
+import org.apache.camel.dsl.jbang.core.common.RuntimeTypeConverter;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.support.FileWatcherResourceReloadStrategy;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "run", description = "Run Camel application on Kubernetes", sortOptions = false)
+public class KubernetesRun extends KubernetesBaseCommand {
+
+    @CommandLine.Parameters(description = "The Camel file(s) to run.",
+                            arity = "0..9", paramLabel = "<files>")
+    String[] filePaths;
+
+    @CommandLine.Option(names = { "--trait-profile" }, description = "The trait profile to use for the deployment.")
+    String traitProfile;
+
+    @CommandLine.Option(names = { "--dependency", "-d" },
+                        description = "Adds dependency that should be included, use \"camel:\" prefix for a Camel component, \"mvn:org.my:app:1.0\" for a Maven dependency.")
+    String[] dependencies;
+
+    @CommandLine.Option(names = { "--property", "-p" },
+                        description = "Add a runtime property or properties file from a path, a config map or a secret (syntax: [my-key=my-value|file:/path/to/my-conf.properties|[configmap|secret]:name]).")
+    String[] properties;
+
+    @CommandLine.Option(names = { "--config" },
+                        description = "Add a runtime configuration from a ConfigMap or a Secret (syntax: [configmap|secret]:name[/key], where name represents the configmap/secret name and key optionally represents the configmap/secret key to be filtered).")
+    String[] configs;
+
+    @CommandLine.Option(names = { "--resource" },
+                        description = "Add a runtime resource from a Configmap or a Secret (syntax: [configmap|secret]:name[/key][@path], where name represents the configmap/secret name, key optionally represents the configmap/secret key to be filtered and path represents the destination path).")
+    String[] resources;
+
+    @CommandLine.Option(names = { "--open-api" }, description = "Add an OpenAPI spec (syntax: [configmap|file]:name).")
+    String[] openApis;
+
+    @CommandLine.Option(names = { "--env", "-e" },
+                        description = "Set an environment variable in the integration container, for instance \"-e MY_VAR=my-value\".")
+    String[] envVars;
+
+    @CommandLine.Option(names = { "--volume", "-v" },
+                        description = "Mount a volume into the integration container, for instance \"-v pvcname:/container/path\".")
+    String[] volumes;
+
+    @CommandLine.Option(names = { "--connect", "-c" },
+                        description = "A Service that the integration should bind to, specified as [[apigroup/]version:]kind:[namespace/]name.")
+    String[] connects;
+
+    @CommandLine.Option(names = { "--annotation" },
+                        description = "Add an annotation to the integration. Use name values pairs like \"--annotation my.company=hello\".")
+    String[] annotations;
+
+    @CommandLine.Option(names = { "--label" },
+                        description = "Add a label to the integration. Use name values pairs like \"--label my.company=hello\".")
+    String[] labels;
+
+    @CommandLine.Option(names = { "--traits", "-t" },
+                        description = "Add a trait configuration to the integration. Use name values pairs like \"--trait trait.name.config=hello\".")
+    String[] traits;
+
+    @CommandLine.Option(names = { "--wait", "-w" }, description = "Wait for the deployment to become ready.")
+    boolean wait;
+
+    @CommandLine.Option(names = { "--logs", "-l" }, description = "Print logs after Camel application has been started.")
+    boolean logs;
+
+    @CommandLine.Option(names = { "--reload", "--dev" },
+                        description = "Enables dev mode (live reload when source files are updated and saved)")
+    boolean dev;
+
+    @CommandLine.Option(names = { "--output", "-o" },
+                        description = "Just output the generated integration custom resource (supports: yaml or json).")
+    String output;
+
+    // Export options
+
+    @CommandLine.Option(names = { "--image" },
+                        description = "The image name to be built.")
+    String image;
+
+    @CommandLine.Option(names = { "--image-registry" },
+                        defaultValue = "quay.io",
+                        description = "The image registry to hold the app container image.")
+    String imageRegistry = "quay.io";
+
+    @CommandLine.Option(names = { "--image-group" },
+                        description = "The image registry group used to push images to.")
+    String imageGroup;
+
+    @CommandLine.Option(names = { "--image-platforms" },
+                        description = "List of target platforms. Each platform is defined using the pattern.")
+    String imagePlatforms;
+
+    @CommandLine.Option(names = { "--gav" }, description = "The Maven group:artifact:version")
+    String gav;
+
+    @CommandLine.Option(names = { "--runtime" },
+                        completionCandidates = RuntimeCompletionCandidates.class,
+                        defaultValue = "quarkus",
+                        converter = RuntimeTypeConverter.class,
+                        description = "Runtime (${COMPLETION-CANDIDATES})")
+    RuntimeType runtime = RuntimeType.quarkus;
+
+    @CommandLine.Option(names = { "--quarkus-version" }, description = "Quarkus Platform version",
+                        defaultValue = RuntimeType.QUARKUS_VERSION)
+    String quarkusVersion = RuntimeType.QUARKUS_VERSION;
+
+    public KubernetesRun(CamelJBangMain main) {
+        super(main);
+    }
+
+    public Integer doCall() throws Exception {
+        String projectName = getProjectName();
+
+        String workingDir = RUN_PLATFORM_DIR + "/" + projectName;
+
+        KubernetesExport export = new KubernetesExport(
+                getMain(), new KubernetesExport.ExportConfigurer(
+                        runtime,
+                        quarkusVersion,
+                        true,
+                        true,
+                        false,
+                        workingDir,
+                        List.of(filePaths),
+                        gav,
+                        true,
+                        true,
+                        false,
+                        false,
+                        "off"));
+
+        export.image = image;
+        export.imageRegistry = imageRegistry;
+        export.imageGroup = imageGroup;
+        export.traitProfile = traitProfile;
+        export.dependencies = dependencies;
+        export.properties = properties;
+        export.configs = configs;
+        export.resources = resources;
+        export.openApis = openApis;
+        export.envVars = envVars;
+        export.volumes = volumes;
+        export.connects = connects;
+        export.annotations = annotations;
+        export.labels = labels;
+        export.traits = traits;
+
+        printer().println("Exporting application ...");
+
+        int exit = export.export();
+        if (exit != 0) {
+            printer().println("Project export failed!");
+            return exit;
+        }
+
+        if (output != null) {
+            if (RuntimeType.quarkus == runtime) {
+                exit = buildQuarkus(workingDir);
+            } else if (RuntimeType.springBoot == runtime) {
+                exit = buildSpringBoot(workingDir);
+            }
+
+            if (exit != 0) {
+                printer().println("Project build failed!");
+                return exit;
+            }
+
+            File manifest;
+            switch (output) {
+                case "yaml" -> manifest = new File(workingDir, "target/kubernetes/kubernetes.yml");
+                case "json" -> manifest = new File(workingDir, "target/kubernetes/kubernetes.json");
+                default -> {
+                    printer().printf("Unsupported output format '%s' (supported: yaml, json)%n", output);
+                    return -1;
+                }
+            }
+
+            try (FileInputStream fis = new FileInputStream(manifest)) {
+                printer().println(IOHelper.loadText(fis));
+            }
+
+            return 0;
+        }
+
+        if (RuntimeType.quarkus == runtime) {
+            exit = deployQuarkus(workingDir);
+        } else if (RuntimeType.springBoot == runtime) {
+            exit = deploySpringBoot(workingDir);
+        }
+
+        if (exit != 0) {
+            printer().println("Deployment to Kubernetes failed!");
+            return exit;
+        }
+
+        if (dev) {
+            DefaultCamelContext reloadContext = new DefaultCamelContext(false);
+            configureFileWatch(reloadContext, export, workingDir);
+            reloadContext.start();
+        }
+
+        if (dev || wait || logs) {

Review Comment:
   No, it does not. This is a good idea. Let me see if I can add this, thx



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd merged PR #14757:
URL: https://github.com/apache/camel/pull/14757


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669870772


##########
dsl/camel-jbang/camel-jbang-plugin-k/pom.xml:
##########
@@ -46,6 +46,13 @@
           <artifactId>camel-jbang-core</artifactId>
         </dependency>
 
+        <!-- TODO: clarify why jbang plugin is not part of camel-bom -->

Review Comment:
   👍 https://issues.apache.org/jira/browse/CAMEL-20955



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669933931


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java:
##########
@@ -47,9 +49,9 @@ protected Integer export() throws Exception {
             System.err.println("The runtime option must be specified");
             return 1;
         }
+
         if (gav == null) {
-            System.err.println("The gav option must be specified");
-            return 1;
+            gav = "org.apache.camel:%s:%s".formatted(getProjectName(), getVersion());

Review Comment:
   Yeah good idea to change them all



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20904: Add Kubernetes Camel JBang plugin [camel]

Posted by "christophd (via GitHub)" <gi...@apache.org>.
christophd commented on code in PR #14757:
URL: https://github.com/apache/camel/pull/14757#discussion_r1669854076


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java:
##########
@@ -47,9 +49,9 @@ protected Integer export() throws Exception {
             System.err.println("The runtime option must be specified");
             return 1;
         }
+
         if (gav == null) {
-            System.err.println("The gav option must be specified");
-            return 1;
+            gav = "org.apache.camel:%s:%s".formatted(getProjectName(), getVersion());

Review Comment:
   What about `org.example.project` as a default? `org.apache.camel` is being used by SBOMGenerator command and in the automatic dummy exports that is part of the run command. Should we change these occurrences, too?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org