Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark kubeconfig flag required #57

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pkg/cmd/adm/must_gather_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"k8s.io/client-go/discovery"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"k8s.io/kubectl/pkg/scheme"
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -52,13 +51,9 @@
return MustGatherNamespace(term, kubeconfig, args[0], destDir)
},
}
defaultKubeconfigPath := ""
if home := homedir.HomeDir(); home != "" {
defaultKubeconfigPath = filepath.Join(home, ".kube", "config")
}
cmd.Flags().StringVar(&destDir, "dest-dir", "", "Gather information with a specific local folder to copy to")
flags.MustMarkRequired(cmd, "dest-dir")
cmd.Flags().StringVar(&kubeconfig, "kubeconfig", defaultKubeconfigPath, "Path to the kubeconfig file (default: "+defaultKubeconfigPath+")")
cmd.Flags().StringVar(&kubeconfig, "kubeconfig", "", "Path to the kubeconfig file")

Check warning on line 56 in pkg/cmd/adm/must_gather_namespace.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/adm/must_gather_namespace.go#L56

Added line #L56 was not covered by tests
flags.MustMarkRequired(cmd, "kubeconfig")
return cmd
}
Expand Down
9 changes: 2 additions & 7 deletions pkg/cmd/generate/cli_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"context"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/kubesaw/ksctl/pkg/assets"
Expand All @@ -21,7 +20,6 @@
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"k8s.io/kubectl/pkg/scheme"
"k8s.io/utils/pointer"
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -54,12 +52,9 @@
command.Flags().StringVarP(&f.outDir, "out-dir", "o", configDirPath, "Directory where generated ksctl.yaml files should be stored")
command.Flags().UintVarP(&f.tokenExpirationDays, "token-expiration-days", "e", 365, "Expiration time of the ServiceAccount tokens in days")

defaultKubeconfigPath := ""
if home := homedir.HomeDir(); home != "" {
defaultKubeconfigPath = filepath.Join(home, ".kube", "config")
}
command.Flags().StringSliceVarP(&f.kubeconfigs, "kubeconfig", "k", []string{defaultKubeconfigPath}, "Kubeconfig(s) for managing multiple clusters and the access to them - paths should be comma separated when using multiple of them. "+
command.Flags().StringSliceVarP(&f.kubeconfigs, "kubeconfig", "k", nil, "Kubeconfig(s) for managing multiple clusters and the access to them - paths should be comma separated when using multiple of them. "+

Check warning on line 55 in pkg/cmd/generate/cli_configs.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/generate/cli_configs.go#L55

Added line #L55 was not covered by tests
"In dev mode, the first one has to represent the host cluster.")
flags.MustMarkRequired(command, "kubeconfig")

Check warning on line 57 in pkg/cmd/generate/cli_configs.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/generate/cli_configs.go#L57

Added line #L57 was not covered by tests

return command
}
Expand Down
Loading