mirror of https://github.com/k3s-io/k3s
move storage serialization type to etcd options
parent
cc75d51897
commit
b410b387ee
|
@ -94,7 +94,7 @@ func NewServerRunOptions() *ServerRunOptions {
|
||||||
ServiceNodePortRange: DefaultServiceNodePortRange,
|
ServiceNodePortRange: DefaultServiceNodePortRange,
|
||||||
}
|
}
|
||||||
// Overwrite the default for storage data format.
|
// Overwrite the default for storage data format.
|
||||||
s.GenericServerRunOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
s.Etcd.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ func Run(s *options.ServerRunOptions) error {
|
||||||
return fmt.Errorf("error generating storage version map: %s", err)
|
return fmt.Errorf("error generating storage version map: %s", err)
|
||||||
}
|
}
|
||||||
storageFactory, err := kubeapiserver.BuildDefaultStorageFactory(
|
storageFactory, err := kubeapiserver.BuildDefaultStorageFactory(
|
||||||
s.Etcd.StorageConfig, s.GenericServerRunOptions.DefaultStorageMediaType, api.Codecs,
|
s.Etcd.StorageConfig, s.Etcd.DefaultStorageMediaType, api.Codecs,
|
||||||
genericapiserver.NewDefaultResourceEncodingConfig(api.Registry), storageGroupsToEncodingVersion,
|
genericapiserver.NewDefaultResourceEncodingConfig(api.Registry), storageGroupsToEncodingVersion,
|
||||||
// FIXME: this GroupVersionResource override should be configurable
|
// FIXME: this GroupVersionResource override should be configurable
|
||||||
[]schema.GroupVersionResource{batch.Resource("cronjobs").WithVersion("v2alpha1")},
|
[]schema.GroupVersionResource{batch.Resource("cronjobs").WithVersion("v2alpha1")},
|
||||||
|
|
|
@ -63,7 +63,7 @@ func NewServerRunOptions() *ServerRunOptions {
|
||||||
EventTTL: 1 * time.Hour,
|
EventTTL: 1 * time.Hour,
|
||||||
}
|
}
|
||||||
// Overwrite the default for storage data format.
|
// Overwrite the default for storage data format.
|
||||||
s.GenericServerRunOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
s.Etcd.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ func Run(s *options.ServerRunOptions) error {
|
||||||
return fmt.Errorf("error generating storage version map: %s", err)
|
return fmt.Errorf("error generating storage version map: %s", err)
|
||||||
}
|
}
|
||||||
storageFactory, err := kubeapiserver.BuildDefaultStorageFactory(
|
storageFactory, err := kubeapiserver.BuildDefaultStorageFactory(
|
||||||
s.Etcd.StorageConfig, s.GenericServerRunOptions.DefaultStorageMediaType, api.Codecs,
|
s.Etcd.StorageConfig, s.Etcd.DefaultStorageMediaType, api.Codecs,
|
||||||
genericapiserver.NewDefaultResourceEncodingConfig(api.Registry), storageGroupsToEncodingVersion,
|
genericapiserver.NewDefaultResourceEncodingConfig(api.Registry), storageGroupsToEncodingVersion,
|
||||||
[]schema.GroupVersionResource{}, resourceConfig, s.GenericServerRunOptions.RuntimeConfig)
|
[]schema.GroupVersionResource{}, resourceConfig, s.GenericServerRunOptions.RuntimeConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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'.")
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,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
|
||||||
|
@ -59,7 +56,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,
|
||||||
|
@ -131,10 +127,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.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue