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-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org