forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
68 lines (59 loc) · 2.51 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package server
import (
"github.com/kubernetes-incubator/service-catalog/pkg/registry/servicecatalog/server"
"github.com/spf13/pflag"
genericserveroptions "k8s.io/kubernetes/pkg/genericapiserver/options"
)
// ServiceCatalogServerOptions contains the aggregation of configuration structs for
// the service-catalog server. It contains everything needed to configure a basic API server.
// It is public so that integration tests can access it.
type ServiceCatalogServerOptions struct {
StorageTypeString string
// the runtime configuration of our server
GenericServerRunOptions *genericserveroptions.ServerRunOptions
// the https configuration. certs, etc
SecureServingOptions *genericserveroptions.SecureServingOptions
// authn for the API
AuthenticationOptions *genericserveroptions.DelegatingAuthenticationOptions
// authz for the API
AuthorizationOptions *genericserveroptions.DelegatingAuthorizationOptions
// InsecureOptions are options for serving insecurely.
InsecureServingOptions *genericserveroptions.ServingOptions
// EtcdOptions are options for serving with etcd as the backing store
EtcdOptions *EtcdOptions
// TPROptions are options for serving with TPR as the backing store
TPROptions *TPROptions
StopCh <-chan struct{}
}
func (s *ServiceCatalogServerOptions) addFlags(flags *pflag.FlagSet) {
flags.StringVar(
&s.StorageTypeString,
"storage-type",
"etcd",
"The type of backing storage this API server should use",
)
s.GenericServerRunOptions.AddUniversalFlags(flags)
s.SecureServingOptions.AddFlags(flags)
s.AuthenticationOptions.AddFlags(flags)
s.AuthorizationOptions.AddFlags(flags)
s.InsecureServingOptions.AddFlags(flags)
s.EtcdOptions.addFlags(flags)
s.TPROptions.addFlags(flags)
}
// StorageType returns the storage type configured on s, or a non-nil error if s holds an
// invalid storage type
func (s *ServiceCatalogServerOptions) StorageType() (server.StorageType, error) {
return server.StorageTypeFromString(s.StorageTypeString)
}