mirror of https://github.com/k3s-io/k3s
Merge pull request #34587 from resouer/stringflag
Automatic merge from submit-queue Merge string flag into util flag Continuing my work on https://github.com/kubernetes/kubernetes/issues/15634 This refactoring is expected to be completely finished and then I will add a verify scripts in `hack`pull/6/head
commit
9adbbf2324
|
@ -23,8 +23,8 @@ import (
|
|||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||
"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
utilconfig "k8s.io/kubernetes/pkg/util/config"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
@ -41,12 +41,12 @@ const (
|
|||
type KubeletServer struct {
|
||||
componentconfig.KubeletConfiguration
|
||||
|
||||
KubeConfig util.StringFlag
|
||||
KubeConfig flag.StringFlag
|
||||
BootstrapKubeconfig string
|
||||
|
||||
// If true, an invalid KubeConfig will result in the Kubelet exiting with an error.
|
||||
RequireKubeConfig bool
|
||||
AuthPath util.StringFlag // Deprecated -- use KubeConfig instead
|
||||
AuthPath flag.StringFlag // Deprecated -- use KubeConfig instead
|
||||
APIServerList []string // Deprecated -- use KubeConfig instead
|
||||
|
||||
// Insert a probability of random errors during calls to the master.
|
||||
|
@ -67,7 +67,7 @@ func NewKubeletServer() *KubeletServer {
|
|||
config := componentconfig.KubeletConfiguration{}
|
||||
api.Scheme.Convert(&v1alpha1.KubeletConfiguration{}, &config, nil)
|
||||
return &KubeletServer{
|
||||
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
|
||||
KubeConfig: flag.NewStringFlag("/var/lib/kubelet/kubeconfig"),
|
||||
RequireKubeConfig: false, // in 1.5, default to true
|
||||
KubeletConfiguration: config,
|
||||
}
|
||||
|
|
|
@ -30,21 +30,20 @@ import (
|
|||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
)
|
||||
|
||||
type createAuthInfoOptions struct {
|
||||
configAccess clientcmd.ConfigAccess
|
||||
name string
|
||||
authPath util.StringFlag
|
||||
clientCertificate util.StringFlag
|
||||
clientKey util.StringFlag
|
||||
token util.StringFlag
|
||||
username util.StringFlag
|
||||
password util.StringFlag
|
||||
authPath flag.StringFlag
|
||||
clientCertificate flag.StringFlag
|
||||
clientKey flag.StringFlag
|
||||
token flag.StringFlag
|
||||
username flag.StringFlag
|
||||
password flag.StringFlag
|
||||
embedCertData flag.Tristate
|
||||
authProvider util.StringFlag
|
||||
authProvider flag.StringFlag
|
||||
|
||||
authProviderArgs map[string]string
|
||||
authProviderArgsToRemove []string
|
||||
|
|
|
@ -21,11 +21,11 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
)
|
||||
|
||||
func stringFlagFor(s string) util.StringFlag {
|
||||
var f util.StringFlag
|
||||
func stringFlagFor(s string) flag.StringFlag {
|
||||
var f flag.StringFlag
|
||||
f.Set(s)
|
||||
return f
|
||||
}
|
||||
|
|
|
@ -28,17 +28,16 @@ import (
|
|||
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
)
|
||||
|
||||
type createClusterOptions struct {
|
||||
configAccess clientcmd.ConfigAccess
|
||||
name string
|
||||
server util.StringFlag
|
||||
apiVersion util.StringFlag
|
||||
server flag.StringFlag
|
||||
apiVersion flag.StringFlag
|
||||
insecureSkipTLSVerify flag.Tristate
|
||||
certificateAuthority util.StringFlag
|
||||
certificateAuthority flag.StringFlag
|
||||
embedCAData flag.Tristate
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ import (
|
|||
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/flag"
|
||||
)
|
||||
|
||||
type createContextOptions struct {
|
||||
configAccess clientcmd.ConfigAccess
|
||||
name string
|
||||
cluster util.StringFlag
|
||||
authInfo util.StringFlag
|
||||
namespace util.StringFlag
|
||||
cluster flag.StringFlag
|
||||
authInfo flag.StringFlag
|
||||
namespace flag.StringFlag
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package util
|
||||
package flag
|
||||
|
||||
// StringFlag is a string flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.
|
||||
type StringFlag struct {
|
Loading…
Reference in New Issue