Skip to content

Commit

Permalink
wow, five hours of no GitHub CI was fantastic
Browse files Browse the repository at this point in the history
* DRY gross tests from dev
* correct configmap tests
* test max len(port name)
  • Loading branch information
Matt Hamilton committed May 23, 2020
1 parent 7464ad4 commit 2cc73d9
Show file tree
Hide file tree
Showing 2 changed files with 267 additions and 675 deletions.
8 changes: 4 additions & 4 deletions cmd/kubectl-tap/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (
const (
kubetapContainerName = "kubetap"
kubetapServicePortName = "kubetap-web"
kubetapPortName = "kubetap-listen" // must be < 15 bytes
kubetapPortName = "kubetap-listen"
kubetapWebPortName = "kubetap-web"
kubetapProxyListenPort = 7777
kubetapProxyWebInterfacePort = 2244
Expand Down Expand Up @@ -125,8 +125,7 @@ func NewListCommand(client kubernetes.Interface, viper *viper.Viper) func(*cobra
fmt.Fprintf(cmd.OutOrStdout(), "No Services in the %s namespace are tapped.\n", namespace)
return nil
}
fmt.Fprintf(cmd.OutOrStdout(), "Tapped Services in the %s namespace:\n", namespace)
fmt.Fprintln(cmd.OutOrStdout())
fmt.Fprintf(cmd.OutOrStdout(), "Tapped Services in the %s namespace:\n\n", namespace)
for k := range tappedServices {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", k)
}
Expand Down Expand Up @@ -183,6 +182,7 @@ func NewTapCommand(client kubernetes.Interface, config *rest.Config, viper *vipe
return fmt.Errorf("--port flag not provided")
}
if namespace == "" {
viper.Set("namespace", "default")
namespace = "default"
}
exists, err := hasNamespace(client, namespace)
Expand Down Expand Up @@ -228,7 +228,7 @@ func NewTapCommand(client kubernetes.Interface, config *rest.Config, viper *vipe
if ports.TargetPort.Type == intstr.String {
dp, err := deploymentFromSelectors(deploymentsClient, targetService.Spec.Selector)
if err != nil {
return fmt.Errorf("error resolving TargetPort in Deployment: %w", err)
return fmt.Errorf("error resolving Deployment from Service selectors: %w", err)
}
for _, c := range dp.Spec.Template.Spec.Containers {
for _, p := range c.Ports {
Expand Down
Loading

0 comments on commit 2cc73d9

Please sign in to comment.