mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
move EtcdServersOverrides to EtcdOptions flags validate
This commit is contained in:
parent
c6d0726df8
commit
f380ac8cec
@ -618,16 +618,8 @@ func BuildStorageFactory(s *options.ServerRunOptions, apiResourceConfig *servers
|
|||||||
storageFactory.AddCohabitatingResources(extensions.Resource("podsecuritypolicies"), policy.Resource("podsecuritypolicies"))
|
storageFactory.AddCohabitatingResources(extensions.Resource("podsecuritypolicies"), policy.Resource("podsecuritypolicies"))
|
||||||
for _, override := range s.Etcd.EtcdServersOverrides {
|
for _, override := range s.Etcd.EtcdServersOverrides {
|
||||||
tokens := strings.Split(override, "#")
|
tokens := strings.Split(override, "#")
|
||||||
if len(tokens) != 2 {
|
|
||||||
glog.Errorf("invalid value of etcd server overrides: %s", override)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
apiresource := strings.Split(tokens[0], "/")
|
apiresource := strings.Split(tokens[0], "/")
|
||||||
if len(apiresource) != 2 {
|
|
||||||
glog.Errorf("invalid resource definition: %s", tokens[0])
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
group := apiresource[0]
|
group := apiresource[0]
|
||||||
resource := apiresource[1]
|
resource := apiresource[1]
|
||||||
groupResource := schema.GroupResource{Group: group, Resource: resource}
|
groupResource := schema.GroupResource{Group: group, Resource: resource}
|
||||||
|
@ -91,6 +91,21 @@ func (s *EtcdOptions) Validate() []error {
|
|||||||
allErrors = append(allErrors, fmt.Errorf("--storage-backend invalid, must be 'etcd3' or 'etcd2'. If not specified, it will default to 'etcd3'"))
|
allErrors = append(allErrors, fmt.Errorf("--storage-backend invalid, must be 'etcd3' or 'etcd2'. If not specified, it will default to 'etcd3'"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, override := range s.EtcdServersOverrides {
|
||||||
|
tokens := strings.Split(override, "#")
|
||||||
|
if len(tokens) != 2 {
|
||||||
|
allErrors = append(allErrors, fmt.Errorf("--etcd-servers-overrides invalid, must be of format: group/resource#servers, where servers are URLs, semicolon separated"))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
apiresource := strings.Split(tokens[0], "/")
|
||||||
|
if len(apiresource) != 2 {
|
||||||
|
allErrors = append(allErrors, fmt.Errorf("--etcd-servers-overrides invalid, must be of format: group/resource#servers, where servers are URLs, semicolon separated"))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return allErrors
|
return allErrors
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +117,7 @@ func (s *EtcdOptions) AddFlags(fs *pflag.FlagSet) {
|
|||||||
|
|
||||||
fs.StringSliceVar(&s.EtcdServersOverrides, "etcd-servers-overrides", s.EtcdServersOverrides, ""+
|
fs.StringSliceVar(&s.EtcdServersOverrides, "etcd-servers-overrides", s.EtcdServersOverrides, ""+
|
||||||
"Per-resource etcd servers overrides, comma separated. The individual override "+
|
"Per-resource etcd servers overrides, comma separated. The individual override "+
|
||||||
"format: group/resource#servers, where servers are http://ip:port, semicolon separated.")
|
"format: group/resource#servers, where servers are URLs, semicolon separated.")
|
||||||
|
|
||||||
fs.StringVar(&s.DefaultStorageMediaType, "storage-media-type", s.DefaultStorageMediaType, ""+
|
fs.StringVar(&s.DefaultStorageMediaType, "storage-media-type", s.DefaultStorageMediaType, ""+
|
||||||
"The media type to use to store objects in storage. "+
|
"The media type to use to store objects in storage. "+
|
||||||
|
Loading…
Reference in New Issue
Block a user