Skip to content

Commit

Permalink
change tuning flags to use dash character
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed May 22, 2024
1 parent b88296e commit 1e07d0e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
12 changes: 6 additions & 6 deletions mgrpxy/shared/kubernetes/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ func Deploy(imageFlags *utils.ProxyImageFlags, helmFlags *HelmFlags, configDir s
}
helmParams = append(helmParams, "-f", path.Join(configDir, "config.yaml"))

if len(imageFlags.TuningHttpd) > 0 {
absPath, err := filepath.Abs(imageFlags.TuningHttpd)
if len(imageFlags.Tuning.Httpd) > 0 {
absPath, err := filepath.Abs(imageFlags.Tuning.Httpd)
if err != nil {
return err
}
helmParams = append(helmParams, fmt.Sprintf("--set-file apache_tuning=%s", absPath))
helmParams = append(helmParams, "--set-file", "apache_tuning="+absPath)
}

if len(imageFlags.TuningSquid) > 0 {
absPath, err := filepath.Abs(imageFlags.TuningSquid)
if len(imageFlags.Tuning.Squid) > 0 {
absPath, err := filepath.Abs(imageFlags.Tuning.Squid)
if err != nil {
return err
}
helmParams = append(helmParams, fmt.Sprintf("--set-file squid_tuning=%s", absPath))
helmParams = append(helmParams, "--set-file", "squid_tuning="+absPath)
}

helmParams = append(helmParams,
Expand Down
8 changes: 4 additions & 4 deletions mgrpxy/shared/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func GenerateSystemdService(httpdImage string, saltBrokerImage string, squidImag
if err := generateSystemdFile(dataHttpd, "httpd"); err != nil {
return err
}
if flags.ProxyImageFlags.TuningHttpd != "" {
absPath, err := filepath.Abs(flags.ProxyImageFlags.TuningHttpd)
if flags.ProxyImageFlags.Tuning.Httpd != "" {
absPath, err := filepath.Abs(flags.ProxyImageFlags.Tuning.Httpd)
if err != nil {
return err
}
Expand All @@ -82,8 +82,8 @@ func GenerateSystemdService(httpdImage string, saltBrokerImage string, squidImag
if err := generateSystemdFile(dataSaltBroker, "salt-broker"); err != nil {
return err
}
if flags.ProxyImageFlags.TuningSquid != "" {
absPath, err := filepath.Abs(flags.ProxyImageFlags.TuningSquid)
if flags.ProxyImageFlags.Tuning.Squid != "" {
absPath, err := filepath.Abs(flags.ProxyImageFlags.Tuning.Squid)
if err != nil {
return err
}
Expand Down
13 changes: 9 additions & 4 deletions mgrpxy/shared/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ type ProxyImageFlags struct {
Squid types.ImageFlags `mapstructure:"squid"`
Ssh types.ImageFlags `mapstructure:"ssh"`
Tftpd types.ImageFlags `mapstructure:"tftpd"`
TuningHttpd string `mapstructure:"tuningHttpd"`
TuningSquid string `mapstructure:"tuningSquid"`
Tuning Tuning `mapstructure:"tuning"`
}

// Tuning are the custom configuration file provide by users.
type Tuning struct {
Httpd string `mapstructure:"httpd"`
Squid string `mapstructure:"squid"`
}

// Get the full container image name and tag for a container name.
Expand Down Expand Up @@ -79,8 +84,8 @@ func AddImageFlags(cmd *cobra.Command) {
addContainerImageFlags(cmd, "ssh")
addContainerImageFlags(cmd, "tftpd")

cmd.Flags().String("tuningHttpd", "", L("HTTPD tuning configuration file"))
cmd.Flags().String("tuningSquid", "", L("Squid tuning configuration file"))
cmd.Flags().String("tuning-httpd", "", L("HTTPD tuning configuration file"))
cmd.Flags().String("tuning-squid", "", L("Squid tuning configuration file"))
}

func addContainerImageFlags(cmd *cobra.Command, container string) {
Expand Down

0 comments on commit 1e07d0e

Please sign in to comment.