Skip to content

Commit

Permalink
chore: remove unused functions vars and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-ibra committed Jun 7, 2024
1 parent 50c8e94 commit 0a949dd
Show file tree
Hide file tree
Showing 24 changed files with 65 additions and 1,826 deletions.
8 changes: 4 additions & 4 deletions cmd/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For more information about validator, see: https://github.com/validator-labs/val
},
RunE: func(cmd *cobra.Command, args []string) error {
taskConfig := cfg.NewTaskConfig(
Version, configFile, configOnly, false, updatePasswords, false, false,
Version, configFile, configOnly, false, updatePasswords, false,
)
if err := c.Save(""); err != nil {
return err
Expand Down Expand Up @@ -73,7 +73,7 @@ For more information about validator, see: https://github.com/validator-labs/val
},
RunE: func(cmd *cobra.Command, args []string) error {
taskConfig := cfg.NewTaskConfig(
Version, configFile, false, false, false, false, false,
Version, configFile, false, false, false, false,
)
if err := validator.UpgradeValidatorCommand(c, taskConfig); err != nil {
return fmt.Errorf("failed to upgrade validator: %v", err)
Expand Down Expand Up @@ -106,7 +106,7 @@ func NewUndeployValidatorCmd() *cobra.Command {
},
RunE: func(cmd *cobra.Command, args []string) error {
taskConfig := cfg.NewTaskConfig(
Version, configFile, false, false, false, false, false,
Version, configFile, false, false, false, false,
)
if err := validator.UndeployValidatorCommand(taskConfig, deleteCluster); err != nil {
return fmt.Errorf("failed to uninstall validator: %v", err)
Expand Down Expand Up @@ -143,7 +143,7 @@ If the --config-file flag is specified, the KUBECONFIG specified in the validato
},
RunE: func(cmd *cobra.Command, args []string) error {
taskConfig := cfg.NewTaskConfig(
Version, configFile, false, false, false, false, false,
Version, configFile, false, false, false, false,
)
if err := validator.DescribeValidationResultsCommand(taskConfig); err != nil {
return fmt.Errorf("failed to describe validation results: %v", err)
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22.4
require (
emperror.dev/errors v0.8.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/aws/aws-sdk-go v1.53.16
github.com/fsnotify/fsnotify v1.7.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/pkg/errors v0.9.1
Expand Down Expand Up @@ -61,7 +60,6 @@ require (
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYr
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
github.com/aws/aws-sdk-go v1.53.16 h1:8oZjKQO/ml1WLUZw5hvF7pvYjPf8o9f57Wldoy/q9Qc=
github.com/aws/aws-sdk-go v1.53.16/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
Expand Down Expand Up @@ -105,10 +103,6 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
11 changes: 0 additions & 11 deletions pkg/cmd/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,13 @@ import (
vapi "github.com/validator-labs/validator/api/v1alpha1"
"github.com/validator-labs/validator/pkg/helm"

//"github.com/spectrocloud/palette-cli/models"
"github.com/validator-labs/validatorctl/pkg/components"
//"github.com/spectrocloud/palette-cli/pkg/components/cluster"
//"github.com/spectrocloud/palette-cli/pkg/config"
cfg "github.com/validator-labs/validatorctl/pkg/config"
log "github.com/validator-labs/validatorctl/pkg/logging"
//"github.com/spectrocloud/palette-cli/pkg/repo"
//"github.com/spectrocloud/palette-cli/pkg/services/clouds"
"github.com/validator-labs/validatorctl/pkg/services/validator"
embed "github.com/validator-labs/validatorctl/pkg/utils/embed"
"github.com/validator-labs/validatorctl/pkg/utils/kind"
"github.com/validator-labs/validatorctl/pkg/utils/kube"
//net_utils "github.com/spectrocloud/palette-cli/pkg/utils/network"
//"github.com/spectrocloud/palette/api/v1alpha1"
)

var (
ErrNilValidationResult = errors.New("validation result is nil")
)

func DeployValidatorCommand(c *cfg.Config, tc *cfg.TaskConfig, reconfigure bool) error {
Expand Down
17 changes: 4 additions & 13 deletions pkg/components/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import (

cfg "github.com/validator-labs/validatorctl/pkg/config"
log "github.com/validator-labs/validatorctl/pkg/logging"
"github.com/validator-labs/validatorctl/pkg/repo"
env "github.com/validator-labs/validatorctl/pkg/services"
"github.com/validator-labs/validatorctl/pkg/utils/crypto"
models "github.com/validator-labs/validatorctl/pkg/utils/extra"
)

type ValidatorConfig struct {
Expand All @@ -27,7 +26,6 @@ type ValidatorConfig struct {
UseKindCluster bool `yaml:"useKindCluster"`
Kubeconfig string `yaml:"kubeconfig"`
SinkConfig *SinkConfig `yaml:"sinkConfig"`
ScarProps *repo.ScarProps `yaml:"scarProps"`
ProxyConfig *ProxyConfig `yaml:"proxyConfig"`
ImageRegistry string `yaml:"imageRegistry"`
UseFixedVersions bool `yaml:"useFixedVersions"`
Expand All @@ -46,9 +44,8 @@ func NewValidatorConfig() *ValidatorConfig {
ReleaseSecret: &Secret{},
SinkConfig: &SinkConfig{},
ProxyConfig: &ProxyConfig{
Env: &models.V1Env{},
Env: &env.Env{},
},
ScarProps: &repo.ScarProps{},
// Plugin config
AWSPlugin: &AWSPluginConfig{
Release: &validator.HelmRelease{},
Expand Down Expand Up @@ -98,9 +95,6 @@ func (c *ValidatorConfig) decrypt() error {
if err := c.SinkConfig.decrypt(); err != nil {
return errors.Wrap(err, "failed to decrypt Sink configuration")
}
if err := c.ScarProps.Decrypt(); err != nil {
return errors.Wrap(err, "failed to decrypt SCAR properties")
}

if c.AWSPlugin != nil {
if err := c.AWSPlugin.decrypt(); err != nil {
Expand Down Expand Up @@ -140,9 +134,6 @@ func (c *ValidatorConfig) encrypt() error {
if err := c.SinkConfig.encrypt(); err != nil {
return errors.Wrap(err, "failed to encrypt Sink configuration")
}
if err := c.ScarProps.Encrypt(); err != nil {
return errors.Wrap(err, "failed to encrypt SCAR properties")
}

if c.AWSPlugin != nil {
if err := c.AWSPlugin.encrypt(); err != nil {
Expand Down Expand Up @@ -174,8 +165,8 @@ func (c *ValidatorConfig) encrypt() error {
}

type ProxyConfig struct {
Enabled bool `yaml:"enabled"`
Env *models.V1Env `yaml:"env"`
Enabled bool `yaml:"enabled"`
Env *env.Env `yaml:"env"`
}

type SinkConfig struct {
Expand Down
18 changes: 1 addition & 17 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ import (
"emperror.dev/errors"
"github.com/spf13/viper"
"gopkg.in/yaml.v2"
//prompt_utils "github.com/spectrocloud-labs/prompts-tui/prompts"
//"github.com/validator-labs/validatorctl/pkg/utils/ptr"
//"github.com/spectrocloud/palette-cli/models"
//log "github.com/validator-labs/validatorctl/pkg/logging"
//"github.com/validator-labs/validatorctl/pkg/utils/crypto"
//string_utils "github.com/validator-labs/validatorctl/pkg/utils/string"
)

func NewConfig() *Config {
Expand All @@ -28,32 +22,23 @@ type Config struct {
WorkspaceLoc string `yaml:"workspaceLoc"`
}

type ImageRegistryType string

const (
ImageRegistryTypeDefault = "Default"
ImageRegistryTypeCustom = "Custom"
)

type TaskConfig struct {
CliVersion string
ConfigFile string
CreateConfigOnly bool
Silent bool
UpdatePasswords bool
UpdateTokens bool
SkipTeardown bool
}

func NewTaskConfig(cliVersion, configFile string, configOnly, silent, updatePasswords, updateTokens, skipTeardown bool) *TaskConfig {
func NewTaskConfig(cliVersion, configFile string, configOnly, silent, updatePasswords, updateTokens bool) *TaskConfig {
return &TaskConfig{
CliVersion: cliVersion,
ConfigFile: configFile,
CreateConfigOnly: configOnly,
Silent: silent,
UpdatePasswords: updatePasswords,
UpdateTokens: updateTokens,
SkipTeardown: skipTeardown,
}
}

Expand Down Expand Up @@ -106,7 +91,6 @@ func (c *Config) restoreGlobalDefaults() (err error) {
return
}

// TODO: check if these Encrypt and Decrypt functions are needed
func (c *Config) Decrypt() error {
return nil
}
Expand Down
Loading

0 comments on commit 0a949dd

Please sign in to comment.