Skip to content

Commit

Permalink
update doc strings to reflect ignored user inputs, remove NewTunnelInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
chaospuppy committed Jul 11, 2024
1 parent 8d66f17 commit a638114
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
8 changes: 4 additions & 4 deletions site/src/content/docs/commands/zarf_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ zarf connect { REGISTRY | GIT | connect-name } [flags]
--cli-only Disable browser auto-open
-h, --help help for connect
--local-port int (Optional, autogenerated if not provided) Specify the local port to bind to. E.g. local-port=42000.
--name string Specify the resource name. E.g. name=unicorns or name=unicorn-pod-7448499f4d-b5bk6.
--namespace string Specify the namespace. E.g. namespace=default. (default "zarf")
--remote-port int Specify the remote port of the resource to bind to. E.g. remote-port=8080.
--type string Specify the resource type. E.g. type=svc or type=pod. (default "svc")
--name string Specify the resource name. E.g. name=unicorns or name=unicorn-pod-7448499f4d-b5bk6. Ignored if connect-name is supplied.
--namespace string Specify the namespace. E.g. namespace=default. Ignored if connect-name is supplied. (default "zarf")
--remote-port int Specify the remote port of the resource to bind to. E.g. remote-port=8080. Ignored if connect-name is supplied.
--type string Specify the resource type. E.g. type=svc or type=pod. Ignored if connect-name is supplied. (default "svc")
```

### Options inherited from parent commands
Expand Down
12 changes: 0 additions & 12 deletions src/cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,9 @@ var (
if err != nil {
return fmt.Errorf("unable to create tunnel: %w", err)
}
if zt.ResourceType != cluster.SvcResource {
ti.ResourceType = zt.ResourceType
}
if zt.ResourceName != "" {
ti.ResourceName = zt.ResourceName
}
if zt.Namespace != cluster.ZarfNamespaceName {
ti.Namespace = zt.Namespace
}
if zt.LocalPort != 0 {
ti.LocalPort = zt.LocalPort
}
if zt.RemotePort != 0 {
ti.RemotePort = zt.RemotePort
}
tunnel, err = c.ConnectTunnelInfo(ctx, ti)
}

Expand Down
8 changes: 4 additions & 4 deletions src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ const (
// zarf connect list
CmdConnectListShort = "Lists all available connection shortcuts"

CmdConnectFlagName = "Specify the resource name. E.g. name=unicorns or name=unicorn-pod-7448499f4d-b5bk6."
CmdConnectFlagNamespace = "Specify the namespace. E.g. namespace=default."
CmdConnectFlagType = "Specify the resource type. E.g. type=svc or type=pod."
CmdConnectFlagName = "Specify the resource name. E.g. name=unicorns or name=unicorn-pod-7448499f4d-b5bk6. Ignored if connect-name is supplied."
CmdConnectFlagNamespace = "Specify the namespace. E.g. namespace=default. Ignored if connect-name is supplied."
CmdConnectFlagType = "Specify the resource type. E.g. type=svc or type=pod. Ignored if connect-name is supplied."
CmdConnectFlagLocalPort = "(Optional, autogenerated if not provided) Specify the local port to bind to. E.g. local-port=42000."
CmdConnectFlagRemotePort = "Specify the remote port of the resource to bind to. E.g. remote-port=8080."
CmdConnectFlagRemotePort = "Specify the remote port of the resource to bind to. E.g. remote-port=8080. Ignored if connect-name is supplied."
CmdConnectFlagCliOnly = "Disable browser auto-open"

CmdConnectPreparingTunnel = "Preparing a tunnel to connect to %s"
Expand Down
12 changes: 0 additions & 12 deletions src/pkg/cluster/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ type TunnelInfo struct {
urlSuffix string
}

// NewTunnelInfo returns a new TunnelInfo object for connecting to a cluster
func NewTunnelInfo(namespace, resourceType, resourceName, urlSuffix string, localPort, remotePort int) TunnelInfo {
return TunnelInfo{
Namespace: namespace,
ResourceType: resourceType,
ResourceName: resourceName,
urlSuffix: urlSuffix,
LocalPort: localPort,
RemotePort: remotePort,
}
}

// PrintConnectTable will print a table of all Zarf connect matches found in the cluster.
func (c *Cluster) PrintConnectTable(ctx context.Context) error {
selector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{
Expand Down

0 comments on commit a638114

Please sign in to comment.