This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 6334a4661 chore(cmd): cleaning and deprecations
6334a4661 is described below
commit 6334a46614fc81babade9be65eff1743ea1d9fdc
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sat Nov 1 10:44:02 2025 +0100
chore(cmd): cleaning and deprecations
Closes #6338, #6342, #6298
---
e2e/advanced/operator_id_filtering_test.go | 8 +-
e2e/common/cli/get_test.go | 77 -----
e2e/common/cli/offline_commands_test.go | 58 ----
pkg/cmd/bind.go | 2 -
pkg/cmd/completion.go | 40 ---
pkg/cmd/completion_bash.go | 446 -----------------------------
pkg/cmd/completion_zsh.go | 65 -----
pkg/cmd/debug.go | 16 +-
pkg/cmd/delete.go | 7 +-
pkg/cmd/get.go | 11 +-
pkg/cmd/kit.go | 7 +-
pkg/cmd/kit_create.go | 3 -
pkg/cmd/log.go | 3 -
pkg/cmd/root.go | 12 +-
pkg/cmd/run.go | 94 +++---
pkg/cmd/run_test.go | 19 --
pkg/cmd/version.go | 10 +-
pkg/cmd/version_test.go | 4 +-
18 files changed, 78 insertions(+), 804 deletions(-)
diff --git a/e2e/advanced/operator_id_filtering_test.go
b/e2e/advanced/operator_id_filtering_test.go
index 8e22c70f8..05f6d0e45 100644
--- a/e2e/advanced/operator_id_filtering_test.go
+++ b/e2e/advanced/operator_id_filtering_test.go
@@ -50,12 +50,12 @@ func TestOperatorIDFiltering(t *testing.T) {
g.Eventually(PlatformPhase(t, ctx, nsop2),
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
t.Run("Operators ignore non-scoped
integrations", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx,
"operator-x", ns, "files/yaml.yaml", "--name", "untouched",
"--force").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx,
"operator-x", ns, "files/yaml.yaml", "--name",
"untouched").Execute()).To(Succeed())
g.Consistently(IntegrationPhase(t, ctx,
ns, "untouched"), 10*time.Second).Should(BeEmpty())
})
t.Run("Operators run scoped integrations",
func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx,
"operator-x", ns, "files/yaml.yaml", "--name", "moving",
"--force").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx,
"operator-x", ns, "files/yaml.yaml", "--name",
"moving").Execute()).To(Succeed())
g.Expect(AssignIntegrationToOperator(t,
ctx, ns, "moving", operator1)).To(Succeed())
g.Eventually(IntegrationPhase(t, ctx,
ns, "moving"), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseRunning))
g.Eventually(IntegrationPodPhase(t,
ctx, ns, "moving"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -101,7 +101,7 @@ func TestOperatorIDFiltering(t *testing.T) {
},
}
g.Expect(TestClient(t).Create(ctx,
&externalKit)).Should(BeNil())
- g.Expect(KamelRunWithID(t, ctx,
operator2, ns, "files/yaml.yaml", "--name", "pre-built", "--kit", "external",
"--force").Execute()).To(Succeed())
+ g.Expect(KamelRunWithID(t, ctx,
operator2, ns, "files/yaml.yaml", "--name", "pre-built", "--kit",
"external").Execute()).To(Succeed())
g.Consistently(IntegrationPhase(t, ctx,
ns, "pre-built"),
10*time.Second).ShouldNot(Equal(v1.IntegrationPhaseBuildingKit))
g.Eventually(IntegrationPhase(t, ctx,
ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
g.Eventually(IntegrationStatusImage(t,
ctx, ns, "pre-built"), TestTimeoutShort).Should(Equal(kitImage))
@@ -111,7 +111,7 @@ func TestOperatorIDFiltering(t *testing.T) {
})
t.Run("Operators can run scoped Pipes", func(t
*testing.T) {
- g.Expect(KamelBindWithID(t, ctx,
"operator-x", ns, "timer-source?message=Hello", "log-sink", "--name", "klb",
"--force").Execute()).To(Succeed())
+ g.Expect(KamelBindWithID(t, ctx,
"operator-x", ns, "timer-source?message=Hello", "log-sink", "--name",
"klb").Execute()).To(Succeed())
g.Consistently(Integration(t, ctx, ns,
"klb"), 10*time.Second).Should(BeNil())
g.Expect(AssignPipeToOperator(t, ctx,
ns, "klb", operator1)).To(Succeed())
g.Eventually(Integration(t, ctx, ns,
"klb"), TestTimeoutShort).ShouldNot(BeNil())
diff --git a/e2e/common/cli/get_test.go b/e2e/common/cli/get_test.go
deleted file mode 100644
index 6504b4b9e..000000000
--- a/e2e/common/cli/get_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go ->
Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-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 common
-
-import (
- "context"
- "fmt"
- "testing"
-
- corev1 "k8s.io/api/core/v1"
-
- . "github.com/onsi/gomega"
-
- . "github.com/apache/camel-k/v2/e2e/support"
-)
-
-func TestKamelCLIGet(t *testing.T) {
- t.Parallel()
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
-
- t.Run("get integration", func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns,
"files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- // regex is used for the compatibility of tests between
OC and vanilla K8
- // kamel get may have different output depending on the
platform
- g.Eventually(IntegrationKit(t, ctx, ns,
"yaml")).ShouldNot(Equal(""))
- kitName := IntegrationKit(t, ctx, ns, "yaml")()
- kitNamespace := IntegrationKitNamespace(t, ctx, ns,
"yaml")()
- regex :=
fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*yaml\tRunning\t(%s/%s|%s)", kitNamespace,
kitName, kitName)
- g.Eventually(GetOutputString(Kamel(t, ctx, "get", "-n",
ns))).Should(MatchRegexp(regex))
- })
-
- t.Run("get several integrations", func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns,
"files/yaml.yaml").Execute()).To(Succeed())
- g.Expect(KamelRun(t, ctx, ns,
"files/Java.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-
- g.Eventually(IntegrationKit(t, ctx, ns,
"java")).ShouldNot(Equal(""))
- g.Eventually(IntegrationKit(t, ctx, ns,
"yaml")).ShouldNot(Equal(""))
- kitName1 := IntegrationKit(t, ctx, ns, "java")()
- kitName2 := IntegrationKit(t, ctx, ns, "yaml")()
- kitNamespace1 := IntegrationKitNamespace(t, ctx, ns,
"java")()
- kitNamespace2 := IntegrationKitNamespace(t, ctx, ns,
"yaml")()
- regex :=
fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*java\tRunning\t"+
- "(%s/%s|%s)\n\\s*yaml\tRunning\t(%s/%s|%s)\n",
kitNamespace1, kitName1, kitName1, kitNamespace2, kitName2, kitName2)
- g.Eventually(GetOutputString(Kamel(t, ctx, "get", "-n",
ns))).Should(MatchRegexp(regex))
-
- g.Expect(Kamel(t, ctx, "delete", "--all", "-n",
ns).Execute()).To(Succeed())
- })
-
- t.Run("get no integrations", func(t *testing.T) {
- g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n",
ns))).NotTo(ContainSubstring("Running"))
- g.Expect(GetOutputString(Kamel(t, ctx, "get", "-n",
ns))).NotTo(ContainSubstring("Building Kit"))
- })
- })
-}
diff --git a/e2e/common/cli/offline_commands_test.go
b/e2e/common/cli/offline_commands_test.go
deleted file mode 100644
index e18ff3b0f..000000000
--- a/e2e/common/cli/offline_commands_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-//go:build integration
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go ->
Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-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 common
-
-import (
- "io"
- "testing"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- . "github.com/onsi/gomega"
-)
-
-func TestKamelVersionWorksOffline(t *testing.T) {
- t.Parallel()
- g := NewWithT(t)
- g.Expect(Kamel(t, TestContext(), "version", "--kube-config",
"non-existent-kubeconfig-file").Execute()).To(Succeed())
-}
-
-func TestKamelHelpOptionWorksOffline(t *testing.T) {
- t.Parallel()
- g := NewWithT(t)
-
- traitCmd := Kamel(t, TestContext(), "run", "Xxx.java", "--help")
- traitCmd.SetOut(io.Discard)
- g.Expect(traitCmd.Execute()).To(Succeed())
-}
-
-func TestKamelCompletionWorksOffline(t *testing.T) {
- t.Parallel()
- g := NewWithT(t)
-
- bashCmd := Kamel(t, TestContext(), "completion", "bash",
"--kube-config", "non-existent-kubeconfig-file")
- bashCmd.SetOut(io.Discard)
- zshCmd := Kamel(t, TestContext(), "completion", "zsh", "--kube-config",
"non-existent-kubeconfig-file")
- zshCmd.SetOut(io.Discard)
- g.Expect(bashCmd.Execute()).To(Succeed())
- g.Expect(zshCmd.Execute()).To(Succeed())
-}
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index 9f9883526..d4ce3f2ea 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -62,7 +62,6 @@ func newCmdBind(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *bindCmdOptions
cmd.Flags().StringArrayP("trait", "t", nil, `Add a trait to the
corresponding Integration.`)
cmd.Flags().StringP("operator-id", "x", "camel-k", "Operator id
selected to manage this Pipe.")
cmd.Flags().StringArray("annotation", nil, "Add an annotation to the
Pipe. E.g. \"--annotation my.company=hello\"")
- cmd.Flags().Bool("force", false, "Force creation of Pipe regardless of
potential misconfiguration.")
cmd.Flags().String("service-account", "", "The SA to use to run this
binding")
cmd.Flags().StringArrayP("dependency", "d", nil, `A dependency that
should be included, e.g., "camel:mail" for a Camel component,
"mvn:org.my:app:1.0" for a Maven dependency`)
@@ -88,7 +87,6 @@ type bindCmdOptions struct {
Traits []string `mapstructure:"traits" yaml:",omitempty"`
OperatorID string `mapstructure:"operator-id" yaml:",omitempty"`
Annotations []string `mapstructure:"annotations" yaml:",omitempty"`
- Force bool `mapstructure:"force" yaml:",omitempty"`
ServiceAccount string `mapstructure:"service-account"
yaml:",omitempty"`
Dependencies []string `mapstructure:"dependencies" yaml:",omitempty"`
}
diff --git a/pkg/cmd/completion.go b/pkg/cmd/completion.go
deleted file mode 100644
index 6bacf6193..000000000
--- a/pkg/cmd/completion.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-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 cmd
-
-import (
- "github.com/spf13/cobra"
-)
-
-func newCmdCompletion(root *cobra.Command) *cobra.Command {
- completion := cobra.Command{
- Use: "completion",
- Short: "Generate completion scripts",
- Deprecated: "no longer supported.",
- }
-
- completion.AddCommand(newCmdCompletionBash(root))
- completion.AddCommand(newCmdCompletionZsh(root))
-
- return &completion
-}
-
-func configureKnownCompletions(command *cobra.Command) {
- configureKnownBashCompletions(command)
- configureKnownZshCompletions(command)
-}
diff --git a/pkg/cmd/completion_bash.go b/pkg/cmd/completion_bash.go
deleted file mode 100644
index 28970ca07..000000000
--- a/pkg/cmd/completion_bash.go
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
-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 cmd
-
-import (
- "fmt"
- "sort"
- "strings"
-
- "github.com/spf13/cobra"
-
- v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
- "github.com/apache/camel-k/v2/pkg/util/camel"
-)
-
-// ******************************
-//
-//
-//
-// ******************************
-
-const bashCompletionCmdLongDescription = `
-To load completion run
-
-. <(kamel completion bash)
-
-To configure your bash shell to load completions for each session add to your
bashrc
-
-# ~/.bashrc or ~/.profile
-. <(kamel completion bash)
-`
-
-//nolint:dupword
-var bashCompletionFunction = `
-__kamel_dependency_type() {
- case ${cur} in
- c*)
- local type_list="` + computeCamelDependencies() + `"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
- ;;
- m*)
- local type_list="mvn:"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
- compopt -o nospace
- ;;
- f*)
- local type_list="file:"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
- compopt -o nospace
- ;;
- *)
- local type_list="camel: mvn: file:"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
- compopt -o nospace
- esac
-}
-
-__kamel_languages() {
- local type_list="java xml yaml"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
-}
-
-__kamel_deletion_policy() {
- local type_list="owner label"
- COMPREPLY=( $( compgen -W "${type_list}" -- "$cur") )
-}
-
-__kamel_kubectl_get_servicebinding() {
- local template
- local template_gvkn
- local kubectl_out
- local service_names
- local services_list
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
- template_gvkn="{{ range .items }}{{ .kind }}/{{ .apiVersion }}/{{
.metadata.name }} {{ end }}"
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} crd -l service.binding/provisioned-service=true
2>/dev/null); then
- kubectl_out="${kubectl_out// /,}"
- service_names="${kubectl_out}servicebinding"
- if kubectl_out=$(kubectl get -o template --template="${template_gvkn}"
${namespace_condition} ${service_names} 2>/dev/null); then
- for resource in $kubectl_out
- do
- name=$(echo ${resource} | cut -d'/' -f 4)
- version=$(echo ${resource} | cut -d'/' -f 3)
- group=$(echo ${resource} | cut -d'/' -f 2)
- kind=$(echo ${resource} | cut -d'/' -f 1)
- services_list="${services_list}
${group}/${version}:${kind}:${name}"
- done
- COMPREPLY=( $( compgen -W "${services_list[*]}" -- "$cur" ) )
- fi
- fi
-}
-
-__kamel_kubectl_get_configmap() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} configmap 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_secret() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} secret 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_integrations() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} integrations 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_integrationkits() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} integrationkits 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_non_platform_integrationkits() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
- label_condition="camel.apache.org/kit.type!=platform"
-
- if kubectl_out=$(kubectl get -l ${label_condition} -o template
--template="${template}" ${namespace_condition} integrationkits 2>/dev/null);
then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_kamelets() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
- if kubectl_out=$(kubectl get -o template --template="${template}"
${namespace_condition} kamelets 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__kamel_kubectl_get_non_bundled_non_readonly_kamelets() {
- local template
- local kubectl_out
- local namespace_condition
-
- if command -v awk &> /dev/null ; then
- local namespace_config=$(${COMP_WORDS[0]} config --list | awk
'/default-namespace/{print $2}')
- if [ ! -z $namespace_config ]; then
- namespace_condition=$(echo "--namespace ${namespace_config}")
- fi
- fi
-
- local namespace_flag=$(echo "${flaghash['-n']}${flaghash['--namespace']}")
- if [ ! -z $namespace_flag ]; then
- namespace_condition=$(echo "--namespace ${namespace_flag}")
- fi
-
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
-
label_conditions="camel.apache.org/kamelet.bundled=false,camel.apache.org/kamelet.readonly=false"
-
- if kubectl_out=$(kubectl get -l ${label_conditions} -o template
--template="${template}" ${namespace_condition} kamelets 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}" -- "$cur" ) )
- fi
-}
-
-__custom_func() {
- case ${last_command} in
- kamel_describe_integration)
- __kamel_kubectl_get_integrations
- return
- ;;
- kamel_describe_kit)
- __kamel_kubectl_get_integrationkits
- return
- ;;
- kamel_describe_kamelet)
- __kamel_kubectl_get_kamelets
- return
- ;;
- kamel_delete)
- __kamel_kubectl_get_integrations
- return
- ;;
- kamel_log)
- __kamel_kubectl_get_integrations
- return
- ;;
- kamel_get)
- __kamel_kubectl_get_integrations
- return
- ;;
- kamel_kit_delete)
- __kamel_kubectl_get_non_platform_integrationkits
- return
- ;;
- kamel_kit_get)
- __kamel_kubectl_get_integrationkits
- return
- ;;
- kamel_kamelet_delete)
- __kamel_kubectl_get_non_bundled_non_readonly_kamelets
- return
- ;;
- *)
- ;;
- esac
-}
-`
-
-// ******************************
-//
-// COMMAND
-//
-// ******************************
-
-func newCmdCompletionBash(root *cobra.Command) *cobra.Command {
- return &cobra.Command{
- Use: "bash",
- Short: "Generates bash completion scripts",
- Long: bashCompletionCmdLongDescription,
- Deprecated: "no longer supported.",
- Run: func(_ *cobra.Command, _ []string) {
- err := root.GenBashCompletion(root.OutOrStdout())
- if err != nil {
- fmt.Fprint(root.ErrOrStderr(), err.Error())
- }
- },
- Annotations: map[string]string{
- offlineCommandLabel: "true",
- },
- }
-}
-
-func configureKnownBashCompletions(command *cobra.Command) {
- configureBashAnnotationForFlag(
- command,
- "dependency",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_dependency_type"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "configmap",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_kubectl_get_configmap"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "secret",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_kubectl_get_secret"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "kit",
- map[string][]string{
- cobra.BashCompCustom:
{"__kamel_kubectl_get_non_platform_integrationkits"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "language",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_languages"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "trait",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_traits"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "deletion-policy",
- map[string][]string{
- cobra.BashCompCustom: {"__kamel_deletion_policy"},
- },
- )
- configureBashAnnotationForFlag(
- command,
- "connect",
- map[string][]string{
- cobra.BashCompCustom:
{"__kamel_kubectl_get_servicebinding"},
- },
- )
-}
-
-func configureBashAnnotationForFlag(command *cobra.Command, flagName string,
annotations map[string][]string) {
- if flag := command.Flag(flagName); flag != nil {
- flag.Annotations = annotations
- }
-}
-
-func computeCamelDependencies() string {
- catalog, err := camel.DefaultCatalog()
- if err != nil || catalog == nil {
- catalog = camel.NewRuntimeCatalog(v1.CamelCatalog{})
- }
-
- results := make([]string, 0,
len(catalog.Artifacts)+len(catalog.Loaders))
- for a := range catalog.Artifacts {
- // skipping camel-k-* and other artifacts as they may not be
useful for cli completion
- if strings.HasPrefix(a, "camel-quarkus-") {
- results = append(results, camel.NormalizeDependency(a))
- }
- }
- for _, l := range catalog.Loaders {
- if strings.HasPrefix(l.ArtifactID, "camel-quarkus-") {
- results = append(results,
camel.NormalizeDependency(l.ArtifactID))
- }
- }
- sort.Strings(results)
-
- return strings.Join(results, " ")
-}
diff --git a/pkg/cmd/completion_zsh.go b/pkg/cmd/completion_zsh.go
deleted file mode 100644
index 28cefc07f..000000000
--- a/pkg/cmd/completion_zsh.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-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 cmd
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-)
-
-// ******************************
-//
-//
-//
-// ******************************
-
-const zshCompletionCmdLongDescription = `
-To configure your zsh shell to load completions for each session add to your
zshrc
-
-if [ $commands[kamel] ]; then
- source <(kamel completion zsh)
-fi
-`
-
-// ******************************
-//
-// COMMAND
-//
-// ******************************
-
-func newCmdCompletionZsh(root *cobra.Command) *cobra.Command {
- return &cobra.Command{
- Use: "zsh",
- Short: "Generates zsh completion scripts",
- Long: zshCompletionCmdLongDescription,
- Deprecated: "no longer supported.",
- Run: func(_ *cobra.Command, _ []string) {
- err := root.GenZshCompletion(root.OutOrStdout())
- if err != nil {
- fmt.Fprint(root.ErrOrStderr(), err.Error())
- }
- },
- Annotations: map[string]string{
- offlineCommandLabel: "true",
- },
- }
-}
-
-func configureKnownZshCompletions(command *cobra.Command) {
-}
diff --git a/pkg/cmd/debug.go b/pkg/cmd/debug.go
index babeda9a0..6fe31b7e5 100644
--- a/pkg/cmd/debug.go
+++ b/pkg/cmd/debug.go
@@ -42,21 +42,19 @@ func newCmdDebug(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *debugCmdOptio
}
cmd := cobra.Command{
- Use: "debug [integration name]",
- Short: "Debug an integration running on Kubernetes",
- Long: `Set an integration running on the Kubernetes cluster
in debug mode and forward ports in order to connect a remote debugger running
on the local host.`,
- Args: options.validateArgs,
- PreRunE: decode(&options, options.Flags),
- RunE: options.run,
+ Use: "debug [integration name]",
+ Short: "Debug an integration running on Kubernetes",
+ Long: `Set an integration running on the Kubernetes
cluster in debug mode and forward ports in order to connect a remote debugger
running on the local host.`,
+ Args: options.validateArgs,
+ PreRunE: decode(&options, options.Flags),
+ RunE: options.run,
+ Deprecated: "Warning: this command is deprecated and will be
removed in the future.",
}
cmd.Flags().Bool("suspend", true, "Suspend the integration on startup,
to let the debugger attach from the beginning")
cmd.Flags().Uint("port", 5005, "Local port to use for port-forwarding")
cmd.Flags().Uint("remote-port", 5005, "Remote port to use for
port-forwarding")
- // completion support
- configureKnownCompletions(&cmd)
-
return &cmd, &options
}
diff --git a/pkg/cmd/delete.go b/pkg/cmd/delete.go
index 7c715fa98..e25290571 100644
--- a/pkg/cmd/delete.go
+++ b/pkg/cmd/delete.go
@@ -39,9 +39,10 @@ func newCmdDelete(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *deleteCmdOpt
RootCmdOptions: rootCmdOptions,
}
cmd := cobra.Command{
- Use: "delete [integration1] [integration2] ...",
- Short: "Delete integrations deployed on Kubernetes",
- PreRunE: decode(&options, options.Flags),
+ Use: "delete [integration1] [integration2] ...",
+ Short: "Delete integrations deployed on Kubernetes",
+ Deprecated: "Warning: this command is deprecated and will be
removed in the future. Use kubectl instead.",
+ PreRunE: decode(&options, options.Flags),
RunE: func(cmd *cobra.Command, args []string) error {
if err := options.validate(args); err != nil {
return err
diff --git a/pkg/cmd/get.go b/pkg/cmd/get.go
index e6445069d..d637196e8 100644
--- a/pkg/cmd/get.go
+++ b/pkg/cmd/get.go
@@ -39,11 +39,12 @@ func newCmdGet(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *getCmdOptions)
RootCmdOptions: rootCmdOptions,
}
cmd := cobra.Command{
- Use: "get [integration]",
- Short: "Get integrations deployed on Kubernetes",
- Long: `Get the status of integrations deployed on
Kubernetes.`,
- PreRunE: decode(&options, options.Flags),
- RunE: options.run,
+ Use: "get [integration]",
+ Short: "Get integrations deployed on Kubernetes",
+ Long: `Get the status of integrations deployed on
Kubernetes.`,
+ Deprecated: "Warning: this command is deprecated and will be
removed in the future. Use kubectl instead.",
+ PreRunE: decode(&options, options.Flags),
+ RunE: options.run,
}
return &cmd, &options
diff --git a/pkg/cmd/kit.go b/pkg/cmd/kit.go
index 726f09d90..597eaa603 100644
--- a/pkg/cmd/kit.go
+++ b/pkg/cmd/kit.go
@@ -23,9 +23,10 @@ import (
func newCmdKit(rootCmdOptions *RootCmdOptions) *cobra.Command {
cmd := cobra.Command{
- Use: "kit",
- Short: "Configure an Integration Kit",
- Long: `Configure an Integration Kit.`,
+ Use: "kit",
+ Short: "Configure an Integration Kit",
+ Long: `Configure an Integration Kit.`,
+ Deprecated: "Warning: this command is deprecated and will be
removed in the future",
}
cmd.AddCommand(cmdOnly(newKitCreateCmd(rootCmdOptions)))
diff --git a/pkg/cmd/kit_create.go b/pkg/cmd/kit_create.go
index fa03c0718..f3daff0e7 100644
--- a/pkg/cmd/kit_create.go
+++ b/pkg/cmd/kit_create.go
@@ -56,9 +56,6 @@ func newKitCreateCmd(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *kitCreate
cmd.Flags().StringP("operator-id", "x", "camel-k", "Operator id
selected to manage this kit")
cmd.Flags().StringArrayP("trait", "t", nil, "Configure a trait. E.g.
\"-t service.enabled=false\"")
- // completion support
- configureKnownCompletions(&cmd)
-
return &cmd, &options
}
diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go
index 260dc89c6..21cdffb41 100644
--- a/pkg/cmd/log.go
+++ b/pkg/cmd/log.go
@@ -48,9 +48,6 @@ func newCmdLog(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *logCmdOptions)
cmd.Flags().Int64("tail", -1, "The number of lines from the end of the
logs to show. Defaults to -1 to show all the lines.")
- // completion support
- configureKnownCompletions(&cmd)
-
return &cmd, &options
}
diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go
index 90267a2c5..c9b0e0a14 100644
--- a/pkg/cmd/root.go
+++ b/pkg/cmd/root.go
@@ -77,12 +77,11 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command,
error) {
func kamelPreAddCommandInit(options *RootCmdOptions) *cobra.Command {
cmd := cobra.Command{
- BashCompletionFunction: bashCompletionFunction,
- PersistentPreRunE: options.preRun,
- Use: "kamel",
- Short: "Kamel is a awesome client tool for
running Apache Camel integrations natively on Kubernetes",
- Long: kamelCommandLongDescription,
- SilenceUsage: true,
+ PersistentPreRunE: options.preRun,
+ Use: "kamel",
+ Short: "Kamel is a awesome client tool for running
Apache Camel integrations natively on Kubernetes",
+ Long: kamelCommandLongDescription,
+ SilenceUsage: true,
}
cmd.PersistentFlags().StringVar(&options.KubeConfig, "kube-config",
os.Getenv("KUBECONFIG"), "Path to the kube config file to use for CLI requests")
@@ -134,7 +133,6 @@ func kamelPostAddCommandInit(cmd *cobra.Command, v
*viper.Viper) error {
}
func addKamelSubcommands(cmd *cobra.Command, options *RootCmdOptions) {
- cmd.AddCommand(newCmdCompletion(cmd))
cmd.AddCommand(cmdOnly(newCmdVersion(options)))
cmd.AddCommand(cmdOnly(newCmdRun(options)))
cmd.AddCommand(cmdOnly(newCmdDeploy(options)))
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 06ce39acc..c18da04ad 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -102,7 +102,6 @@ func newCmdRun(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *runCmdOptions)
cmd.Flags().StringArrayP("trait", "t", nil, "Configure a trait. E.g.
\"-t service.enabled=false\"")
cmd.Flags().StringP("output", "o", "", "Output format. One of:
json|yaml")
cmd.Flags().Bool("compression", false, "Enable storage of sources and
resources as a compressed binary blobs")
- cmd.Flags().StringArray("open-api", nil, "Add an OpenAPI spec (syntax:
[configmap|file]:name)")
cmd.Flags().StringArrayP("volume", "v", nil, "Mount a volume into the
integration container. E.g \"-v pvcname:/container/path\"")
cmd.Flags().StringArrayP("env", "e", nil, "Set an environment variable
in the integration container. E.g \"-e MY_VAR=my-value\"")
cmd.Flags().StringArray("annotation", nil, "Add an annotation to the
integration. E.g. \"--annotation my.company=hello\"")
@@ -111,7 +110,6 @@ func newCmdRun(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *runCmdOptions)
"this is added to the list of files listed as arguments of the
command")
cmd.Flags().String("pod-template", "", "The path of the YAML file
containing a PodSpec template to be used for the Integration pods")
cmd.Flags().String("service-account", "", "The SA to use to run this
Integration")
- cmd.Flags().Bool("force", false, "Force creation of integration
regardless of potential misconfiguration.")
cmd.Flags().String("git", "", "A Git repository containing the project
to build.")
cmd.Flags().String("git-branch", "", "Git branch to checkout when using
--git option")
cmd.Flags().String("git-tag", "", "Git tag to checkout when using --git
option")
@@ -120,53 +118,51 @@ func newCmdRun(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *runCmdOptions)
cmd.Flags().Bool("dont-run-after-build", false, "Only build, don't run
the application. "+
"You can run \"kamel deploy\" to run a built Integration.")
- // completion support
- configureKnownCompletions(&cmd)
-
return &cmd, &options
}
type runCmdOptions struct {
*RootCmdOptions `json:"-"`
- Compression bool `mapstructure:"compression"
yaml:",omitempty"`
- Wait bool `mapstructure:"wait" yaml:",omitempty"`
- Logs bool `mapstructure:"logs" yaml:",omitempty"`
- Sync bool `mapstructure:"sync" yaml:",omitempty"`
- Dev bool `mapstructure:"dev" yaml:",omitempty"`
- UseFlows bool `mapstructure:"use-flows" yaml:",omitempty"`
- Save bool `mapstructure:"save" yaml:",omitempty"
kamel:"omitsave"`
- IntegrationKit string `mapstructure:"kit" yaml:",omitempty"`
- IntegrationName string `mapstructure:"name" yaml:",omitempty"`
- ContainerImage string `mapstructure:"image" yaml:",omitempty"`
- GitRepo string `mapstructure:"git" yaml:",omitempty"`
- GitBranch string `mapstructure:"git-branch"
yaml:",omitempty"`
- GitTag string `mapstructure:"git-tag" yaml:",omitempty"`
- GitCommit string `mapstructure:"git-commit"
yaml:",omitempty"`
- Profile string `mapstructure:"profile" yaml:",omitempty"`
- IntegrationProfile string `mapstructure:"integration-profile"
yaml:",omitempty"`
- OperatorID string `mapstructure:"operator-id"
yaml:",omitempty"`
- OutputFormat string `mapstructure:"output" yaml:",omitempty"`
- PodTemplate string `mapstructure:"pod-template"
yaml:",omitempty"`
- ServiceAccount string `mapstructure:"service-account"
yaml:",omitempty"`
- Resources []string `mapstructure:"resources" yaml:",omitempty"`
- // Deprecated: openapi parameter won't be supported in future releases.
- OpenAPIs []string `mapstructure:"open-apis" yaml:",omitempty"`
- Dependencies []string `mapstructure:"dependencies" yaml:",omitempty"`
- Properties []string `mapstructure:"properties" yaml:",omitempty"`
+ // Deprecated: won't be supported in the future
+ Compression bool `mapstructure:"compression" yaml:",omitempty"`
+ Wait bool `mapstructure:"wait" yaml:",omitempty"`
+ Logs bool `mapstructure:"logs" yaml:",omitempty"`
+ Sync bool `mapstructure:"sync" yaml:",omitempty"`
+ Dev bool `mapstructure:"dev" yaml:",omitempty"`
+ UseFlows bool `mapstructure:"use-flows" yaml:",omitempty"`
+ Save bool `mapstructure:"save" yaml:",omitempty"
kamel:"omitsave"`
+ // Deprecated: won't be supported in the future
+ IntegrationKit string `mapstructure:"kit" yaml:",omitempty"`
+ IntegrationName string `mapstructure:"name" yaml:",omitempty"`
+ ContainerImage string `mapstructure:"image" yaml:",omitempty"`
+ GitRepo string `mapstructure:"git" yaml:",omitempty"`
+ GitBranch string `mapstructure:"git-branch" yaml:",omitempty"`
+ GitTag string `mapstructure:"git-tag" yaml:",omitempty"`
+ GitCommit string `mapstructure:"git-commit" yaml:",omitempty"`
+ Profile string `mapstructure:"profile" yaml:",omitempty"`
+ IntegrationProfile string `mapstructure:"integration-profile"
yaml:",omitempty"`
+ OperatorID string `mapstructure:"operator-id" yaml:",omitempty"`
+ OutputFormat string `mapstructure:"output" yaml:",omitempty"`
+ // Deprecated: won't be supported in the future
+ PodTemplate string `mapstructure:"pod-template" yaml:",omitempty"`
+ ServiceAccount string `mapstructure:"service-account"
yaml:",omitempty"`
+ Resources []string `mapstructure:"resources" yaml:",omitempty"`
+ Dependencies []string `mapstructure:"dependencies" yaml:",omitempty"`
+ // Deprecated: won't be supported in the future
+ Properties []string `mapstructure:"properties" yaml:",omitempty"`
+ // Deprecated: won't be supported in the future
BuildProperties []string `mapstructure:"build-properties"
yaml:",omitempty"`
Configs []string `mapstructure:"configs" yaml:",omitempty"`
Repositories []string `mapstructure:"maven-repositories"
yaml:",omitempty"`
Traits []string `mapstructure:"traits" yaml:",omitempty"`
Volumes []string `mapstructure:"volumes" yaml:",omitempty"`
- EnvVars []string `mapstructure:"envs" yaml:",omitempty"`
- Labels []string `mapstructure:"labels" yaml:",omitempty"`
- Annotations []string `mapstructure:"annotations" yaml:",omitempty"`
- Sources []string `mapstructure:"sources" yaml:",omitempty"`
- // Deprecated: registry parameter no longer in use.
- RegistryOptions url.Values
- Force bool `mapstructure:"force" yaml:",omitempty"`
- DontRunAfterBuild bool `mapstructure:"dont-run-after-build"
yaml:",omitempty"`
+ // Deprecated: won't be supported in the future
+ EnvVars []string `mapstructure:"envs" yaml:",omitempty"`
+ Labels []string `mapstructure:"labels" yaml:",omitempty"`
+ Annotations []string `mapstructure:"annotations"
yaml:",omitempty"`
+ Sources []string `mapstructure:"sources" yaml:",omitempty"`
+ DontRunAfterBuild bool `mapstructure:"dont-run-after-build"
yaml:",omitempty"`
}
func (o *runCmdOptions) decode(cmd *cobra.Command, args []string) error {
@@ -199,10 +195,6 @@ func (o *runCmdOptions) decode(cmd *cobra.Command, args
[]string) error {
cmd.Annotations[offlineCommandLabel] = "true"
}
- if err := o.validate(cmd); err != nil {
- return err
- }
-
// backup the values from values belonging to kamel.run by coping the
// structure by values, which in practice is done by a marshal/unmarshal
// to/from json.
@@ -286,13 +278,6 @@ func (o *runCmdOptions) validate(cmd *cobra.Command) error
{
}
}
- for _, openapi := range o.OpenAPIs {
- // We support only cluster configmaps
- if !(strings.HasPrefix(openapi, "configmap:")) {
- return fmt.Errorf(`invalid openapi specification "%s".
It supports only configmaps`, openapi)
- }
- }
-
for i, property := range o.Properties {
// We support only --config
if strings.HasPrefix(property, "configmap:") ||
strings.HasPrefix(property, "secret:") {
@@ -310,6 +295,11 @@ func (o *runCmdOptions) validate(cmd *cobra.Command) error
{
}
}
+ // Deprecated: to be removed
+ if o.Compression {
+ fmt.Fprintf(cmd.OutOrStdout(), "Compression property is
deprecated. It will be removed from future releases.\n")
+ }
+
var client client.Client
if !isOfflineCommand(cmd) {
client, err = o.GetCmdClient()
@@ -475,7 +465,6 @@ func (o *runCmdOptions) syncIntegration(cmd *cobra.Command,
c client.Client, sou
files = append(files, filterFileLocation(o.Configs)...)
files = append(files, filterFileLocation(o.Properties)...)
files = append(files, filterFileLocation(o.BuildProperties)...)
- files = append(files, filterFileLocation(o.OpenAPIs)...)
for _, s := range files {
ok, err := source.IsLocalAndFileExists(s)
@@ -772,11 +761,6 @@ func (o *runCmdOptions) convertOptionsToTraits(cmd
*cobra.Command, c client.Clie
"mount.configs"); err != nil {
return err
}
- if err := o.parseAndConvertToTrait(cmd, c, it, o.OpenAPIs,
resource.ParseConfig,
- func(c *resource.Config) string { return c.Name() },
- "openapi.configmaps"); err != nil {
- return err
- }
if err := o.applyProperties(c, o.Properties, "camel.properties"); err
!= nil {
return err
diff --git a/pkg/cmd/run_test.go b/pkg/cmd/run_test.go
index 71172b685..e8df749be 100644
--- a/pkg/cmd/run_test.go
+++ b/pkg/cmd/run_test.go
@@ -225,25 +225,6 @@ func TestRunNameFlag(t *testing.T) {
assert.Equal(t, "myIntegration", runCmdOptions.IntegrationName)
}
-func TestRunOpenApiFlag(t *testing.T) {
- runCmdOptions, rootCmd, _ := initializeRunCmdOptions(t)
- _, err := ExecuteCommand(rootCmd, cmdRun,
- "--open-api", "configmap:oapi2",
- integrationSource)
- require.NoError(t, err)
- assert.Len(t, runCmdOptions.OpenAPIs, 1)
- assert.Equal(t, "configmap:oapi2", runCmdOptions.OpenAPIs[0])
-}
-
-func TestRunOpenApiInvalidFlag(t *testing.T) {
- _, rootCmd, _ := initializeRunCmdOptions(t)
- _, err := ExecuteCommand(rootCmd, cmdRun,
- "--open-api", "secret:oapi1",
- "--open-api", "oapi2",
- integrationSource)
- require.Error(t, err)
-}
-
func TestRunOutputFlag(t *testing.T) {
runCmdOptions, rootCmd, _ := initializeRunCmdOptions(t)
_, err := ExecuteCommand(rootCmd, cmdRun, "-o", "yaml",
integrationSource)
diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go
index ce959bfe8..e9a6fc8c1 100644
--- a/pkg/cmd/version.go
+++ b/pkg/cmd/version.go
@@ -56,9 +56,9 @@ func newCmdVersion(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *versionCmdO
Annotations: make(map[string]string),
}
- cmd.Flags().Bool("operator", false, "Display Operator version")
+ cmd.Flags().Bool("operator", false, "Display Operator version.
Deprecated option.")
cmd.Flags().BoolP("verbose", "v", false, "Display all available extra
information")
- cmd.Flags().BoolP("all", "a", false, "Display both Client and Operator
version")
+ cmd.Flags().BoolP("all", "a", false, "Display both Client and Operator
version. Deprecated option.")
return &cmd, &options
}
@@ -66,15 +66,18 @@ func newCmdVersion(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *versionCmdO
type versionCmdOptions struct {
*RootCmdOptions
+ // Deprecated: to be removed in future versions.
Operator bool `mapstructure:"operator"`
Verbose bool `mapstructure:"verbose"`
- All bool `mapstructure:"all"`
+ // Deprecated: to be removed in future versions.
+ All bool `mapstructure:"all"`
}
func (o *versionCmdOptions) preRunE(cmd *cobra.Command, args []string) error {
if !o.Operator && !o.All {
// let the command to work in offline mode
cmd.Annotations[offlineCommandLabel] = "true"
+ fmt.Fprintf(cmd.OutOrStdout(), "Operator version discovery is
deprecated. It will be removed from future releases.\n")
}
return o.preRun(cmd, args)
}
@@ -128,6 +131,7 @@ func (o *versionCmdOptions) displayOperatorVersion(cmd
*cobra.Command, c client.
}
}
+// Deprecated: to be removed in future versions.
func operatorInfo(ctx context.Context, c client.Client, namespace string)
(map[string]string, error) {
infos := make(map[string]string)
platform, err := platformutil.GetOrFindLocal(ctx, c, namespace)
diff --git a/pkg/cmd/version_test.go b/pkg/cmd/version_test.go
index 6c7115343..dccd0d9fe 100644
--- a/pkg/cmd/version_test.go
+++ b/pkg/cmd/version_test.go
@@ -64,7 +64,7 @@ func TestVersionClient(t *testing.T) {
_, rootCmd, _ := initializeVersionCmdOptions(t)
output, err := ExecuteCommand(rootCmd, cmdVersion)
require.NoError(t, err)
- assert.Equal(t, fmt.Sprintf("Camel K Client %s\n", defaults.Version),
output)
+ assert.Contains(t, output, fmt.Sprintf("Camel K Client %s\n",
defaults.Version))
}
func TestVersionOperatorFlag(t *testing.T) {
@@ -79,7 +79,7 @@ func TestVersionClientVerbose(t *testing.T) {
output, err := ExecuteCommand(rootCmd, cmdVersion, "-v")
require.NoError(t, err)
assert.True(t, versionCmdOptions.Verbose)
- assert.Equal(t, fmt.Sprintf("Camel K Client %s\nGit Commit: %s\n",
defaults.Version, defaults.GitCommit), output)
+ assert.Contains(t, output, fmt.Sprintf("Camel K Client %s\nGit Commit:
%s\n", defaults.Version, defaults.GitCommit))
}
func TestOperatorVersionVerbose(t *testing.T) {