🔥 Delete the unused docker package

This commit is contained in:
M. Mert Yildiran
2023-10-16 23:41:33 +03:00
parent e215870b9d
commit fb08481909
3 changed files with 4 additions and 64 deletions

View File

@@ -25,7 +25,6 @@ import (
"github.com/docker/go-connections/nat"
"github.com/kubeshark/kubeshark/config"
"github.com/kubeshark/kubeshark/config/configStructs"
"github.com/kubeshark/kubeshark/docker"
"github.com/kubeshark/kubeshark/internal/connect"
"github.com/kubeshark/kubeshark/kubernetes"
"github.com/kubeshark/kubeshark/misc"
@@ -449,9 +448,6 @@ func pcap(tarPath string) error {
log.Info().Str("tar-path", tarPath).Msg("Openning")
docker.SetRegistry(config.Config.Tap.Docker.Registry)
docker.SetTag(config.Config.Tap.Docker.Tag)
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
@@ -460,9 +456,9 @@ func pcap(tarPath string) error {
}
defer cli.Close()
imageFront := docker.GetFrontImage()
imageHub := docker.GetHubImage()
imageWorker := docker.GetWorkerImage()
imageFront := fmt.Sprintf("%s%s:%s", config.Config.Tap.Docker.Registry, "front", config.Config.Tap.Docker.Tag)
imageHub := fmt.Sprintf("%s%s:%s", config.Config.Tap.Docker.Registry, "hub", config.Config.Tap.Docker.Tag)
imageWorker := fmt.Sprintf("%s%s:%s", config.Config.Tap.Docker.Registry, "worker", config.Config.Tap.Docker.Tag)
err = pullImages(ctx, cli, imageFront, imageHub, imageWorker)
if err != nil {

View File

@@ -10,7 +10,6 @@ import (
"sync"
"time"
"github.com/kubeshark/kubeshark/docker"
"github.com/kubeshark/kubeshark/internal/connect"
"github.com/kubeshark/kubeshark/kubernetes/helm"
"github.com/kubeshark/kubeshark/misc"
@@ -47,9 +46,7 @@ var ready *Readiness
func tap() {
ready = &Readiness{}
state.startTime = time.Now()
docker.SetRegistry(config.Config.Tap.Docker.Registry)
docker.SetTag(config.Config.Tap.Docker.Tag)
log.Info().Str("registry", docker.GetRegistry()).Str("tag", docker.GetTag()).Msg("Using Docker:")
log.Info().Str("registry", config.Config.Tap.Docker.Registry).Str("tag", config.Config.Tap.Docker.Tag).Msg("Using Docker:")
if config.Config.Tap.Pcap != "" {
err := pcap(config.Config.Tap.Pcap)
if err != nil {

View File

@@ -1,53 +0,0 @@
package docker
import (
"fmt"
"strings"
)
const (
hub = "hub"
worker = "worker"
front = "front"
)
var (
registry = "docker.io/kubeshark/"
tag = "latest"
)
func GetRegistry() string {
return registry
}
func SetRegistry(value string) {
if strings.HasPrefix(value, "docker.io/kubeshark") {
registry = "docker.io/kubeshark/"
} else {
registry = value
}
}
func GetTag() string {
return tag
}
func SetTag(value string) {
tag = value
}
func getImage(image string) string {
return fmt.Sprintf("%s%s:%s", registry, image, tag)
}
func GetHubImage() string {
return getImage(hub)
}
func GetWorkerImage() string {
return getImage(worker)
}
func GetFrontImage() string {
return getImage(front)
}