🔨 Bring in models.Resources dependency to kubernetes package

This commit is contained in:
M. Mert Yildiran 2022-12-29 03:41:35 +03:00
parent 5e269831e4
commit 6d06c53ebf
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
5 changed files with 15 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import (
"fmt"
"regexp"
"github.com/kubeshark/base/pkg/models"
"github.com/kubeshark/kubeshark/kubernetes"
"github.com/kubeshark/kubeshark/utils"
"github.com/rs/zerolog/log"
)
@ -54,8 +54,8 @@ type DockerConfig struct {
}
type ResourcesConfig struct {
Worker models.Resources `yaml:"worker"`
Hub models.Resources `yaml:"hub"`
Worker kubernetes.Resources `yaml:"worker"`
Hub kubernetes.Resources `yaml:"hub"`
}
type TapConfig struct {

View File

@ -10,7 +10,6 @@ import (
"path/filepath"
"regexp"
"github.com/kubeshark/base/pkg/models"
"github.com/kubeshark/kubeshark/docker"
"github.com/kubeshark/kubeshark/semver"
"github.com/rs/zerolog/log"
@ -175,7 +174,7 @@ type PodOptions struct {
PodName string
PodImage string
ServiceAccountName string
Resources models.Resources
Resources Resources
ImagePullPolicy core.PullPolicy
Debug bool
}
@ -665,7 +664,7 @@ func (provider *Provider) ApplyWorkerDaemonSet(
workerPodName string,
nodeNames []string,
serviceAccountName string,
resources models.Resources,
resources Resources,
imagePullPolicy core.PullPolicy,
serviceMesh bool,
tls bool,

8
kubernetes/structs.go Normal file
View File

@ -0,0 +1,8 @@
package kubernetes
type Resources struct {
CpuLimit string `yaml:"cpu-limit" default:"750m"`
MemoryLimit string `yaml:"memory-limit" default:"1Gi"`
CpuRequests string `yaml:"cpu-requests" default:"50m"`
MemoryRequests string `yaml:"memory-requests" default:"50Mi"`
}

View File

@ -39,7 +39,7 @@ type WorkerSyncerConfig struct {
TargetNamespaces []string
PodFilterRegex regexp.Regexp
SelfNamespace string
WorkerResources models.Resources
WorkerResources Resources
ImagePullPolicy v1.PullPolicy
KubesharkServiceAccountExists bool
ServiceMesh bool

View File

@ -3,7 +3,6 @@ package resources
import (
"context"
"github.com/kubeshark/base/pkg/models"
"github.com/kubeshark/kubeshark/config"
"github.com/kubeshark/kubeshark/docker"
"github.com/kubeshark/kubeshark/errormessage"
@ -13,7 +12,7 @@ import (
core "k8s.io/api/core/v1"
)
func CreateHubResources(ctx context.Context, kubernetesProvider *kubernetes.Provider, isNsRestrictedMode bool, selfNamespace string, hubResources models.Resources, imagePullPolicy core.PullPolicy, debug bool) (bool, error) {
func CreateHubResources(ctx context.Context, kubernetesProvider *kubernetes.Provider, isNsRestrictedMode bool, selfNamespace string, hubResources kubernetes.Resources, imagePullPolicy core.PullPolicy, debug bool) (bool, error) {
if !isNsRestrictedMode {
if err := createSelfNamespace(ctx, kubernetesProvider, selfNamespace); err != nil {
return false, err