mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-08-03 20:59:52 +00:00
* Bump docker go.mod (#7681) * Shortcircuit commands with version or help flags (#7683) * Fix for longhorn integration test * Add Rotation certification Check (#7097) * Add Certification Test to Validate Cluster * Fix to stop/start for k3s certificate rotation * E2E: Use sudo for all RunCmdOnNode * Remove unnecessary daemonset addition/deletion Signed-off-by: Derek Nola <derek.nola@suse.com> Signed-off-by: est-suse <esteban.esquivel@suse.com> Signed-off-by: Brad Davidson <brad.davidson@rancher.com> Co-authored-by: Esteban Esquivel Alvarado <esteban.alvarado@suse.com> Co-authored-by: est-suse <esteban.esquivel@suse.com> Co-authored-by: Brad Davidson <brad.davidson@rancher.com>
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package configfilearg
|
|
|
|
import (
|
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
|
"github.com/k3s-io/k3s/pkg/version"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var DefaultParser = &Parser{
|
|
After: []string{"server", "agent", "etcd-snapshot:1"},
|
|
ConfigFlags: []string{"--config", "-c"},
|
|
EnvName: version.ProgramUpper + "_CONFIG_FILE",
|
|
DefaultConfig: "/etc/rancher/" + version.Program + "/config.yaml",
|
|
ValidFlags: map[string][]cli.Flag{"server": cmds.ServerFlags, "etcd-snapshot": cmds.EtcdSnapshotFlags},
|
|
}
|
|
|
|
func MustParse(args []string) []string {
|
|
result, err := DefaultParser.Parse(args)
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
return result
|
|
}
|
|
|
|
func MustFindString(args []string, target string) string {
|
|
parser := &Parser{
|
|
OverrideFlags: []string{"--help", "-h", "--version", "-v"},
|
|
EnvName: version.ProgramUpper + "_CONFIG_FILE",
|
|
DefaultConfig: "/etc/rancher/" + version.Program + "/config.yaml",
|
|
}
|
|
result, err := parser.FindString(args, target)
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
return result
|
|
}
|