本文整理汇总了Golang中k8s/io/kubernetes/pkg/util.NewStringFlag函数的典型用法代码示例。如果您正苦于以下问题:Golang NewStringFlag函数的具体用法?Golang NewStringFlag怎么用?Golang NewStringFlag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewStringFlag函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
return &KubeletServer{
Address: net.ParseIP("0.0.0.0"),
AuthPath: util.NewStringFlag("/var/lib/kubelet/kubernetes_auth"), // deprecated
CAdvisorPort: 4194,
CertDirectory: "/var/run/kubernetes",
CgroupRoot: "",
ConfigureCBR0: false,
ContainerRuntime: "docker",
CPUCFSQuota: false,
DockerDaemonContainer: "/docker-daemon",
DockerExecHandlerName: "native",
EventBurst: 10,
EventRecordQPS: 5.0,
EnableDebuggingHandlers: true,
EnableServer: true,
FileCheckFrequency: 20 * time.Second,
HealthzBindAddress: net.ParseIP("127.0.0.1"),
HealthzPort: 10248,
HostNetworkSources: kubetypes.AllSource,
HostPIDSources: kubetypes.AllSource,
HostIPCSources: kubetypes.AllSource,
HTTPCheckFrequency: 20 * time.Second,
ImageGCHighThresholdPercent: 90,
ImageGCLowThresholdPercent: 80,
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
LowDiskSpaceThresholdMB: 256,
MasterServiceNamespace: api.NamespaceDefault,
MaxContainerCount: 100,
MaxPerPodContainerCount: 2,
MaxOpenFiles: 1000000,
MaxPods: 40,
MinimumGCAge: 1 * time.Minute,
NetworkPluginDir: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/",
NetworkPluginName: "",
NodeLabels: []string{},
NodeLabelsFile: "",
NodeStatusUpdateFrequency: 10 * time.Second,
OOMScoreAdj: qos.KubeletOOMScoreAdj,
PodInfraContainerImage: dockertools.PodInfraContainerImage,
Port: ports.KubeletPort,
ReadOnlyPort: ports.KubeletReadOnlyPort,
RegisterNode: true, // will be ignored if no apiserver is configured
RegisterSchedulable: true,
RegistryBurst: 10,
RegistryPullQPS: 5.0,
ResourceContainer: "/kubelet",
RktPath: "",
RktStage1Image: "",
RootDirectory: defaultRootDir,
SerializeImagePulls: true,
StreamingConnectionIdleTimeout: 5 * time.Minute,
SyncFrequency: 1 * time.Minute,
SystemContainer: "",
ReconcileCIDR: true,
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
}
}
示例2: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
config := componentconfig.KubeletConfiguration{}
api.Scheme.Convert(&v1alpha1.KubeletConfiguration{}, &config)
return &KubeletServer{
AuthPath: util.NewStringFlag("/var/lib/kubelet/kubernetes_auth"), // deprecated
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
KubeletConfiguration: config,
}
}
示例3: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
config := componentconfig.KubeletConfiguration{}
api.Scheme.Convert(&v1alpha1.KubeletConfiguration{}, &config, nil)
return &KubeletServer{
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
RequireKubeConfig: false, // in 1.5, default to true
KubeletConfiguration: config,
}
}
示例4: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
return &KubeletServer{
Address: net.ParseIP("0.0.0.0"),
AuthPath: util.NewStringFlag("/var/lib/kubelet/kubernetes_auth"), // deprecated
CadvisorPort: 4194,
CertDirectory: "/var/run/kubernetes",
CgroupRoot: "",
ConfigureCBR0: false,
ContainerRuntime: "docker",
CPUCFSQuota: false,
DockerDaemonContainer: "/docker-daemon",
DockerExecHandlerName: "native",
EnableDebuggingHandlers: true,
EnableServer: true,
FileCheckFrequency: 20 * time.Second,
HealthzBindAddress: net.ParseIP("127.0.0.1"),
HealthzPort: 10248,
HostNetworkSources: kubelet.FileSource,
HTTPCheckFrequency: 20 * time.Second,
ImageGCHighThresholdPercent: 90,
ImageGCLowThresholdPercent: 80,
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
LowDiskSpaceThresholdMB: 256,
MasterServiceNamespace: api.NamespaceDefault,
MaxContainerCount: 100,
MaxPerPodContainerCount: 2,
MinimumGCAge: 1 * time.Minute,
NetworkPluginDir: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/",
NetworkPluginName: "",
NodeStatusUpdateFrequency: 10 * time.Second,
OOMScoreAdj: qos.KubeletOomScoreAdj,
PodInfraContainerImage: dockertools.PodInfraContainerImage,
Port: ports.KubeletPort,
ReadOnlyPort: ports.KubeletReadOnlyPort,
RegisterNode: true, // will be ignored if no apiserver is configured
RegistryBurst: 10,
ResourceContainer: "/kubelet",
RktPath: "",
RootDirectory: defaultRootDir,
SyncFrequency: 10 * time.Second,
SystemContainer: "",
}
}
示例5: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
return &KubeletServer{
AuthPath: util.NewStringFlag("/var/lib/kubelet/kubernetes_auth"), // deprecated
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
SystemReserved: make(config.ConfigurationMap),
KubeReserved: make(config.ConfigurationMap),
KubeletConfiguration: componentconfig.KubeletConfiguration{
Address: "0.0.0.0",
CAdvisorPort: 4194,
VolumeStatsAggPeriod: unversioned.Duration{Duration: time.Minute},
CertDirectory: "/var/run/kubernetes",
CgroupRoot: "",
ConfigureCBR0: false,
ContainerRuntime: "docker",
CPUCFSQuota: true,
DockerExecHandlerName: "native",
EventBurst: 10,
EventRecordQPS: 5.0,
EnableCustomMetrics: false,
EnableDebuggingHandlers: true,
EnableServer: true,
FileCheckFrequency: unversioned.Duration{Duration: 20 * time.Second},
HealthzBindAddress: "127.0.0.1",
HealthzPort: 10248,
HostNetworkSources: kubetypes.AllSource,
HostPIDSources: kubetypes.AllSource,
HostIPCSources: kubetypes.AllSource,
HTTPCheckFrequency: unversioned.Duration{Duration: 20 * time.Second},
ImageMinimumGCAge: unversioned.Duration{Duration: 2 * time.Minute},
ImageGCHighThresholdPercent: 90,
ImageGCLowThresholdPercent: 80,
LowDiskSpaceThresholdMB: 256,
MasterServiceNamespace: api.NamespaceDefault,
MaxContainerCount: 240,
MaxPerPodContainerCount: 2,
MaxOpenFiles: 1000000,
MaxPods: 110,
NvidiaGPUs: 0,
MinimumGCAge: unversioned.Duration{Duration: 1 * time.Minute},
NetworkPluginDir: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/",
NetworkPluginName: "",
NonMasqueradeCIDR: "10.0.0.0/8",
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
NodeStatusUpdateFrequency: unversioned.Duration{Duration: 10 * time.Second},
NodeLabels: make(map[string]string),
OOMScoreAdj: int32(qos.KubeletOOMScoreAdj),
LockFilePath: "",
ExitOnLockContention: false,
PodInfraContainerImage: GetDefaultPodInfraContainerImage(),
Port: ports.KubeletPort,
ReadOnlyPort: ports.KubeletReadOnlyPort,
RegisterNode: true, // will be ignored if no apiserver is configured
RegisterSchedulable: true,
RegistryBurst: 10,
RegistryPullQPS: 5.0,
KubeletCgroups: "",
ResolverConfig: kubetypes.ResolvConfDefault,
RktPath: "",
RktAPIEndpoint: rkt.DefaultRktAPIServiceEndpoint,
RktStage1Image: "",
RootDirectory: defaultRootDir,
RuntimeCgroups: "",
SerializeImagePulls: true,
SeccompProfileRoot: filepath.Join(defaultRootDir, "seccomp"),
StreamingConnectionIdleTimeout: unversioned.Duration{Duration: 4 * time.Hour},
SyncFrequency: unversioned.Duration{Duration: 1 * time.Minute},
SystemCgroups: "",
ReconcileCIDR: true,
ContentType: "application/vnd.kubernetes.protobuf",
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
HairpinMode: componentconfig.PromiscuousBridge,
BabysitDaemons: false,
EvictionPressureTransitionPeriod: unversioned.Duration{Duration: 5 * time.Minute},
PodsPerCore: 0,
},
}
}
示例6: TestKubeletDefaults
func TestKubeletDefaults(t *testing.T) {
defaults := kubeletoptions.NewKubeletServer()
// This is a snapshot of the default config
// If the default changes (new fields are added, or default values change), we want to know
// Once we've reacted to the changes appropriately in BuildKubernetesNodeConfig(), update this expected default to match the new upstream defaults
expectedDefaults := &kubeletoptions.KubeletServer{
AuthPath: util.NewStringFlag(""),
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
KubeletConfiguration: componentconfig.KubeletConfiguration{
Address: "0.0.0.0", // overridden
AllowPrivileged: false, // overridden
CAdvisorPort: 4194, // disabled
VolumeStatsAggPeriod: unversioned.Duration{Duration: time.Minute},
CertDirectory: "/var/run/kubernetes",
CgroupRoot: "",
ClusterDNS: "", // overridden
ClusterDomain: "", // overridden
ConfigureCBR0: false,
ContainerRuntime: "docker",
Containerized: false, // overridden based on OPENSHIFT_CONTAINERIZED
CPUCFSQuota: true, // forced to true
DockerExecHandlerName: "native",
DockerEndpoint: "unix:///var/run/docker.sock",
EventBurst: 10,
EventRecordQPS: 5.0,
EnableCustomMetrics: false,
EnableDebuggingHandlers: true,
EnableServer: true,
EvictionHard: "memory.available<100Mi",
FileCheckFrequency: unversioned.Duration{Duration: 20 * time.Second}, // overridden
HealthzBindAddress: "127.0.0.1", // disabled
HealthzPort: 10248, // disabled
HostNetworkSources: []string{"*"}, // overridden
HostPIDSources: []string{"*"}, // overridden
HostIPCSources: []string{"*"}, // overridden
HTTPCheckFrequency: unversioned.Duration{Duration: 20 * time.Second}, // disabled
ImageMinimumGCAge: unversioned.Duration{Duration: 120 * time.Second},
ImageGCHighThresholdPercent: 90,
ImageGCLowThresholdPercent: 80,
IPTablesMasqueradeBit: 14,
IPTablesDropBit: 15,
LowDiskSpaceThresholdMB: 256,
MakeIPTablesUtilChains: true,
MasterServiceNamespace: "default",
MaxContainerCount: -1,
MaxPerPodContainerCount: 1,
MaxOpenFiles: 1000000,
MaxPods: 110, // overridden
MinimumGCAge: unversioned.Duration{},
NetworkPluginDir: "",
NetworkPluginName: "", // overridden
NonMasqueradeCIDR: "10.0.0.0/8",
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
NodeStatusUpdateFrequency: unversioned.Duration{Duration: 10 * time.Second},
NodeLabels: nil,
OOMScoreAdj: -999,
LockFilePath: "",
PodInfraContainerImage: "gcr.io/google_containers/pause-amd64:3.0", // overridden
Port: 10250, // overridden
ReadOnlyPort: 10255, // disabled
RegisterNode: true,
RegisterSchedulable: true,
RegistryBurst: 10,
RegistryPullQPS: 5.0,
ResolverConfig: kubetypes.ResolvConfDefault,
KubeletCgroups: "",
RktAPIEndpoint: rkt.DefaultRktAPIServiceEndpoint,
RktPath: "",
RktStage1Image: "",
RootDirectory: "/var/lib/kubelet", // overridden
RuntimeCgroups: "",
SerializeImagePulls: true,
StreamingConnectionIdleTimeout: unversioned.Duration{Duration: 4 * time.Hour},
SyncFrequency: unversioned.Duration{Duration: 1 * time.Minute},
SystemCgroups: "",
TLSCertFile: "", // overridden to prevent cert generation
TLSPrivateKeyFile: "", // overridden to prevent cert generation
ReconcileCIDR: true,
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ExperimentalFlannelOverlay: false,
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
HairpinMode: "promiscuous-bridge",
BabysitDaemons: false,
SeccompProfileRoot: "",
CloudProvider: "auto-detect",
RuntimeRequestTimeout: unversioned.Duration{Duration: 2 * time.Minute},
ContentType: "application/vnd.kubernetes.protobuf",
EnableControllerAttachDetach: true,
EvictionPressureTransitionPeriod: unversioned.Duration{Duration: 5 * time.Minute},
SystemReserved: utilconfig.ConfigurationMap{},
KubeReserved: utilconfig.ConfigurationMap{},
},
}
if !reflect.DeepEqual(defaults, expectedDefaults) {
//.........这里部分代码省略.........
示例7: NewKubeletServer
// NewKubeletServer will create a new KubeletServer with default values.
func NewKubeletServer() *KubeletServer {
return &KubeletServer{
AuthPath: util.NewStringFlag("/var/lib/kubelet/kubernetes_auth"), // deprecated
KubeConfig: util.NewStringFlag("/var/lib/kubelet/kubeconfig"),
DockerDaemonContainer: "/docker-daemon",
SystemReserved: make(util.ConfigurationMap),
KubeReserved: make(util.ConfigurationMap),
KubeletConfiguration: componentconfig.KubeletConfiguration{
Address: "0.0.0.0",
CAdvisorPort: 4194,
VolumeStatsAggPeriod: unversioned.Duration{time.Minute},
CertDirectory: "/var/run/kubernetes",
CgroupRoot: "",
ConfigureCBR0: false,
ContainerRuntime: "docker",
CPUCFSQuota: true,
DockerExecHandlerName: "native",
EventBurst: 10,
EventRecordQPS: 5.0,
EnableCustomMetrics: false,
EnableDebuggingHandlers: true,
EnableServer: true,
FileCheckFrequency: unversioned.Duration{20 * time.Second},
HealthzBindAddress: "127.0.0.1",
HealthzPort: 10248,
HostNetworkSources: kubetypes.AllSource,
HostPIDSources: kubetypes.AllSource,
HostIPCSources: kubetypes.AllSource,
HTTPCheckFrequency: unversioned.Duration{20 * time.Second},
ImageGCHighThresholdPercent: 90,
ImageGCLowThresholdPercent: 80,
LowDiskSpaceThresholdMB: 256,
MasterServiceNamespace: api.NamespaceDefault,
MaxContainerCount: 100,
MaxPerPodContainerCount: 2,
MaxOpenFiles: 1000000,
MaxPods: 40,
MinimumGCAge: unversioned.Duration{1 * time.Minute},
NetworkPluginDir: "/usr/libexec/kubernetes/kubelet-plugins/net/exec/",
NetworkPluginName: "",
NonMasqueradeCIDR: "10.0.0.0/8",
VolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/",
NodeStatusUpdateFrequency: unversioned.Duration{10 * time.Second},
NodeLabels: make(map[string]string),
OOMScoreAdj: qos.KubeletOOMScoreAdj,
PodInfraContainerImage: kubetypes.PodInfraContainerImage,
Port: ports.KubeletPort,
ReadOnlyPort: ports.KubeletReadOnlyPort,
RegisterNode: true, // will be ignored if no apiserver is configured
RegisterSchedulable: true,
RegistryBurst: 10,
RegistryPullQPS: 5.0,
ResourceContainer: "/kubelet",
RktPath: "",
RktStage1Image: "",
RootDirectory: defaultRootDir,
SerializeImagePulls: true,
StreamingConnectionIdleTimeout: unversioned.Duration{4 * time.Hour},
SyncFrequency: unversioned.Duration{1 * time.Minute},
SystemContainer: "",
ReconcileCIDR: true,
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
OutOfDiskTransitionFrequency: unversioned.Duration{5 * time.Minute},
HairpinMode: hairpinMode,
},
}
}