diff --git a/internal/kubernetes/api/contract.go b/internal/kubernetes/api/contract.go new file mode 100644 index 0000000..778f64e --- /dev/null +++ b/internal/kubernetes/api/contract.go @@ -0,0 +1 @@ +package api diff --git a/internal/kubernetes/api/provider.go b/internal/kubernetes/api/provider.go new file mode 100644 index 0000000..5bf639c --- /dev/null +++ b/internal/kubernetes/api/provider.go @@ -0,0 +1,20 @@ +package api + +import "github.com/kamilsk/forward/internal/kubernetes" + +// New returns new instance of Kubernetes provider above API. +func New() *provider { + return &provider{} +} + +type provider struct{} + +// Find tries to find pods suitable by the pattern. +func (*provider) Find(string) []kubernetes.Pod { + panic("implement me") +} + +// Forward initiates the port forwarding process. +func (*provider) Forward(kubernetes.Pod, kubernetes.Mapping) { + panic("implement me") +} diff --git a/internal/kubernetes/cli/contract.go b/internal/kubernetes/cli/contract.go new file mode 100644 index 0000000..7f1e458 --- /dev/null +++ b/internal/kubernetes/cli/contract.go @@ -0,0 +1 @@ +package cli diff --git a/internal/kubernetes/cli/provider.go b/internal/kubernetes/cli/provider.go new file mode 100644 index 0000000..6169a86 --- /dev/null +++ b/internal/kubernetes/cli/provider.go @@ -0,0 +1,20 @@ +package cli + +import "github.com/kamilsk/forward/internal/kubernetes" + +// New returns new instance of Kubernetes provider above CLI. +func New() *provider { + return &provider{} +} + +type provider struct{} + +// Find tries to find pods suitable by the pattern. +func (*provider) Find(string) []kubernetes.Pod { + panic("implement me") +} + +// Forward initiates the port forwarding process. +func (*provider) Forward(kubernetes.Pod, kubernetes.Mapping) { + panic("implement me") +} diff --git a/internal/kubernetes/interface.go b/internal/kubernetes/interface.go new file mode 100644 index 0000000..088f2f2 --- /dev/null +++ b/internal/kubernetes/interface.go @@ -0,0 +1,22 @@ +package kubernetes + +type ( + // Port is a type for port number. + Port int16 + // Local specifies local ports. + Local Port + // Remote specifies remote ports. + Remote Port + // Pod specifies a fully-qualified pod name. + Pod string + // Mapping specifies port forwarding rules. + Mapping map[Local]Remote +) + +// Interface defines a top-level behavior of Kubernetes provider (API or CLI). +type Interface interface { + // Find tries to find pods suitable by the pattern. + Find(string) []Pod + // Forward initiates the port forwarding process. + Forward(Pod, Mapping) +}