move storage serialization type to etcd options

This commit is contained in:
deads2k 2017-02-07 13:34:02 -05:00
parent 2e34520350
commit 5566a0ef65
2 changed files with 10 additions and 9 deletions

View File

@ -33,6 +33,10 @@ type EtcdOptions struct {
StorageConfig storagebackend.Config StorageConfig storagebackend.Config
EtcdServersOverrides []string EtcdServersOverrides []string
// To enable protobuf as storage format, it is enough
// to set it to "application/vnd.kubernetes.protobuf".
DefaultStorageMediaType string
} }
func NewEtcdOptions(scheme *runtime.Scheme) *EtcdOptions { func NewEtcdOptions(scheme *runtime.Scheme) *EtcdOptions {
@ -44,6 +48,7 @@ func NewEtcdOptions(scheme *runtime.Scheme) *EtcdOptions {
DeserializationCacheSize: 0, DeserializationCacheSize: 0,
Copier: scheme, Copier: scheme,
}, },
DefaultStorageMediaType: "application/json",
} }
} }
@ -62,6 +67,10 @@ func (s *EtcdOptions) AddFlags(fs *pflag.FlagSet) {
"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 http://ip:port, semicolon separated.")
fs.StringVar(&s.DefaultStorageMediaType, "storage-media-type", s.DefaultStorageMediaType, ""+
"The media type to use to store objects in storage. Defaults to application/json. "+
"Some resources may only support a specific media type and will ignore this setting.")
fs.StringVar(&s.StorageConfig.Type, "storage-backend", s.StorageConfig.Type, fs.StringVar(&s.StorageConfig.Type, "storage-backend", s.StorageConfig.Type,
"The storage backend for persistence. Options: 'etcd3' (default), 'etcd2'.") "The storage backend for persistence. Options: 'etcd3' (default), 'etcd2'.")

View File

@ -38,10 +38,7 @@ type ServerRunOptions struct {
AdmissionControlConfigFile string AdmissionControlConfigFile string
AdvertiseAddress net.IP AdvertiseAddress net.IP
CorsAllowedOriginList []string CorsAllowedOriginList []string
// To enable protobuf as storage format, it is enough
// to set it to "application/vnd.kubernetes.protobuf".
DefaultStorageMediaType string
DeleteCollectionWorkers int DeleteCollectionWorkers int
EnableWatchCache bool EnableWatchCache bool
ExternalHost string ExternalHost string
@ -57,7 +54,6 @@ func NewServerRunOptions() *ServerRunOptions {
return &ServerRunOptions{ return &ServerRunOptions{
AdmissionControl: "AlwaysAdmit", AdmissionControl: "AlwaysAdmit",
DefaultStorageMediaType: "application/json",
DeleteCollectionWorkers: 1, DeleteCollectionWorkers: 1,
EnableWatchCache: true, EnableWatchCache: true,
MaxRequestsInFlight: defaults.MaxRequestsInFlight, MaxRequestsInFlight: defaults.MaxRequestsInFlight,
@ -128,10 +124,6 @@ func (s *ServerRunOptions) AddUniversalFlags(fs *pflag.FlagSet) {
"List of allowed origins for CORS, comma separated. An allowed origin can be a regular "+ "List of allowed origins for CORS, comma separated. An allowed origin can be a regular "+
"expression to support subdomain matching. If this list is empty CORS will not be enabled.") "expression to support subdomain matching. If this list is empty CORS will not be enabled.")
fs.StringVar(&s.DefaultStorageMediaType, "storage-media-type", s.DefaultStorageMediaType, ""+
"The media type to use to store objects in storage. Defaults to application/json. "+
"Some resources may only support a specific media type and will ignore this setting.")
fs.IntVar(&s.DeleteCollectionWorkers, "delete-collection-workers", s.DeleteCollectionWorkers, fs.IntVar(&s.DeleteCollectionWorkers, "delete-collection-workers", s.DeleteCollectionWorkers,
"Number of workers spawned for DeleteCollection call. These are used to speed up namespace cleanup.") "Number of workers spawned for DeleteCollection call. These are used to speed up namespace cleanup.")