Skip to content

Commit

Permalink
refactor(kumactl) add install tracing context (#2343)
Browse files Browse the repository at this point in the history
Signed-off-by: Bart Smykla <bartek@smykla.com>
  • Loading branch information
bartsmykla authored Jul 14, 2021
1 parent 4aa8ec3 commit b0c72d1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
17 changes: 17 additions & 0 deletions app/kumactl/cmd/install/context/install_tracing_context.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package context

type TracingTemplateArgs struct {
Namespace string
}

type InstallTracingContext struct {
TemplateArgs TracingTemplateArgs
}

func DefaultInstallTracingContext() InstallTracingContext {
return InstallTracingContext{
TemplateArgs: TracingTemplateArgs{
Namespace: "kuma-tracing",
},
}
}
2 changes: 1 addition & 1 deletion app/kumactl/cmd/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func NewInstallCmd(pctx *kumactl_cmd.RootContext) *cobra.Command {
cmd.AddCommand(newInstallControlPlaneCmd(&pctx.InstallCpContext))
cmd.AddCommand(newInstallCrdsCmd(&pctx.InstallCRDContext))
cmd.AddCommand(newInstallMetrics(pctx))
cmd.AddCommand(newInstallTracing())
cmd.AddCommand(newInstallTracing(pctx))
cmd.AddCommand(newInstallDNS())
cmd.AddCommand(newInstallLogging())
cmd.AddCommand(newInstallTransparentProxy())
Expand Down
10 changes: 4 additions & 6 deletions app/kumactl/cmd/install/install_tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"

kumactl_cmd "github.com/kumahq/kuma/app/kumactl/pkg/cmd"

kumactl_data "github.com/kumahq/kuma/app/kumactl/data"
"github.com/kumahq/kuma/app/kumactl/pkg/install/data"
"github.com/kumahq/kuma/app/kumactl/pkg/install/k8s"
Expand All @@ -13,12 +15,8 @@ type tracingTemplateArgs struct {
Namespace string
}

func newInstallTracing() *cobra.Command {
args := struct {
Namespace string
}{
Namespace: "kuma-tracing",
}
func newInstallTracing(pctx *kumactl_cmd.RootContext) *cobra.Command {
args := pctx.InstallTracingContext.TemplateArgs
cmd := &cobra.Command{
Use: "tracing",
Short: "Install Tracing backend in Kubernetes cluster (Jaeger)",
Expand Down
2 changes: 2 additions & 0 deletions app/kumactl/pkg/cmd/root_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type RootContext struct {
InstallDemoContext install_context.InstallDemoContext
InstallGatewayKongContext install_context.InstallGatewayKongContext
InstallGatewayKongEnterpriseContext install_context.InstallGatewayKongEnterpriseContext
InstallTracingContext install_context.InstallTracingContext
}

func DefaultRootContext() *RootContext {
Expand Down Expand Up @@ -97,6 +98,7 @@ func DefaultRootContext() *RootContext {
InstallDemoContext: install_context.DefaultInstallDemoContext(),
InstallGatewayKongContext: install_context.DefaultInstallGatewayKongContext(),
InstallGatewayKongEnterpriseContext: install_context.DefaultInstallGatewayKongEnterpriseContext(),
InstallTracingContext: install_context.DefaultInstallTracingContext(),
}
}

Expand Down

0 comments on commit b0c72d1

Please sign in to comment.