Skip to content

Commit

Permalink
[operator] Optimize installation and uninstallation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mfordjody committed Dec 19, 2024
1 parent 23e39b4 commit 10220f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 2 additions & 6 deletions operator/cmd/cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,21 @@ import (
"io"
"os"
"strings"
"time"
)

var installerScope = log.RegisterScope("installer", "installer")

type installArgs struct {
Files []string
Sets []string
Revision string
ManifestPath string
SkipConfirmation bool
ReadinessTimeout time.Duration
}

func (i *installArgs) String() string {
var b strings.Builder
b.WriteString("Files: " + (fmt.Sprint(i.Files) + "\n"))
b.WriteString("Sets: " + (fmt.Sprint(i.Sets) + "\n"))
b.WriteString("Revision: " + (fmt.Sprint(i.Revision) + "\n"))
b.WriteString("ManifestPath: " + (fmt.Sprint(i.ManifestPath) + "\n"))
return b.String()
}
Expand Down Expand Up @@ -81,7 +77,7 @@ dubboctl install -f my-config.yaml
}

func Install(kubeClient kube.CLIClient, rootArgs *RootArgs, iArgs *installArgs, cl clog.Logger, stdOut io.Writer, p Printer) error {
setFlags := applyFlagAliases(iArgs.Sets, iArgs.ManifestPath, iArgs.Revision)
setFlags := applyFlagAliases(iArgs.Sets, iArgs.ManifestPath)
manifests, vals, err := render.GenerateManifest(iArgs.Files, setFlags, cl, kubeClient)
if err != nil {
return fmt.Errorf("generate config: %v", err)
Expand All @@ -108,7 +104,7 @@ func Install(kubeClient kube.CLIClient, rootArgs *RootArgs, iArgs *installArgs,
return nil
}

func applyFlagAliases(flags []string, manifestsPath string, revision string) []string {
func applyFlagAliases(flags []string, manifestsPath string) []string {
if manifestsPath != "" {
flags = append(flags, fmt.Sprintf("manifestsPath=%s", manifestsPath))
}
Expand Down
4 changes: 4 additions & 0 deletions operator/cmd/cluster/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
)

type uninstallArgs struct {
files []string
sets []string
manifestPath string
purge bool
}

func addUninstallFlags() {
Expand Down

0 comments on commit 10220f9

Please sign in to comment.