-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restore ability to run against secured etcd #21535
Merged
+270
−83
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ import ( | |
"k8s.io/kubernetes/pkg/genericapiserver" | ||
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client" | ||
"k8s.io/kubernetes/pkg/master/ports" | ||
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd" | ||
"k8s.io/kubernetes/pkg/util" | ||
utilnet "k8s.io/kubernetes/pkg/util/net" | ||
|
||
|
@@ -57,9 +58,8 @@ type APIServer struct { | |
EnableLogsSupport bool | ||
EnableProfiling bool | ||
EnableWatchCache bool | ||
EtcdPathPrefix string | ||
EtcdServerList []string | ||
EtcdServersOverrides []string | ||
EtcdConfig etcdstorage.EtcdConfig | ||
EventTTL time.Duration | ||
ExternalHost string | ||
KeystoneURL string | ||
|
@@ -100,13 +100,15 @@ func NewAPIServer() *APIServer { | |
AuthorizationMode: "AlwaysAllow", | ||
DeleteCollectionWorkers: 1, | ||
EnableLogsSupport: true, | ||
EtcdPathPrefix: genericapiserver.DefaultEtcdPathPrefix, | ||
EventTTL: 1 * time.Hour, | ||
MasterCount: 1, | ||
MasterServiceNamespace: api.NamespaceDefault, | ||
RuntimeConfig: make(util.ConfigurationMap), | ||
StorageVersions: registered.AllPreferredGroupVersions(), | ||
DefaultStorageVersions: registered.AllPreferredGroupVersions(), | ||
EtcdConfig: etcdstorage.EtcdConfig{ | ||
Prefix: genericapiserver.DefaultEtcdPathPrefix, | ||
}, | ||
EventTTL: 1 * time.Hour, | ||
MasterCount: 1, | ||
MasterServiceNamespace: api.NamespaceDefault, | ||
RuntimeConfig: make(util.ConfigurationMap), | ||
StorageVersions: registered.AllPreferredGroupVersions(), | ||
DefaultStorageVersions: registered.AllPreferredGroupVersions(), | ||
KubeletConfig: kubeletclient.KubeletClientConfig{ | ||
Port: ports.KubeletPort, | ||
EnableHttps: true, | ||
|
@@ -220,10 +222,13 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) { | |
fs.StringVar(&s.AuthorizationConfig.WebhookConfigFile, "authorization-webhook-config-file", s.AuthorizationConfig.WebhookConfigFile, "File with webhook configuration in kubeconfig format, used with --authorization-mode=Webhook. The API server will query the remote service to determine access on the API server's secure port.") | ||
fs.StringVar(&s.AdmissionControl, "admission-control", s.AdmissionControl, "Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: "+strings.Join(admission.GetPlugins(), ", ")) | ||
fs.StringVar(&s.AdmissionControlConfigFile, "admission-control-config-file", s.AdmissionControlConfigFile, "File with admission control configuration.") | ||
fs.StringSliceVar(&s.EtcdServerList, "etcd-servers", s.EtcdServerList, "List of etcd servers to watch (http://ip:port), comma separated. Mutually exclusive with -etcd-config") | ||
fs.StringSliceVar(&s.EtcdConfig.ServerList, "etcd-servers", s.EtcdConfig.ServerList, "List of etcd servers to watch (http://ip:port), comma separated. Mutually exclusive with -etcd-config") | ||
fs.StringSliceVar(&s.EtcdServersOverrides, "etcd-servers-overrides", s.EtcdServersOverrides, "Per-resource etcd servers overrides, comma separated. The individual override format: group/resource#servers, where servers are http://ip:port, semicolon separated.") | ||
fs.StringVar(&s.EtcdPathPrefix, "etcd-prefix", s.EtcdPathPrefix, "The prefix for all resource paths in etcd.") | ||
fs.BoolVar(&s.EtcdQuorumRead, "etcd-quorum-read", s.EtcdQuorumRead, "If true, enable quorum read") | ||
fs.StringVar(&s.EtcdConfig.Prefix, "etcd-prefix", s.EtcdConfig.Prefix, "The prefix for all resource paths in etcd.") | ||
fs.StringVar(&s.EtcdConfig.KeyFile, "etcd-keyfile", s.EtcdConfig.KeyFile, "SSL key file used to secure etcd communication") | ||
fs.StringVar(&s.EtcdConfig.CertFile, "etcd-certfile", s.EtcdConfig.CertFile, "SSL certification file used to secure etcd communication") | ||
fs.StringVar(&s.EtcdConfig.CAFile, "etcd-cafile", s.EtcdConfig.CAFile, "SSL Certificate Authority file used to secure etcd communication") | ||
fs.BoolVar(&s.EtcdConfig.Quorum, "etcd-quorum-read", s.EtcdConfig.Quorum, "If true, enable quorum read") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we were trying to maintain compatibility with 1.1 here... shouldn't these match the 1.1 flag where a config file is specified? |
||
fs.StringSliceVar(&s.CorsAllowedOriginList, "cors-allowed-origins", s.CorsAllowedOriginList, "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.") | ||
fs.BoolVar(&s.AllowPrivileged, "allow-privileged", s.AllowPrivileged, "If true, allow privileged containers.") | ||
fs.IPNetVar(&s.ServiceClusterIPRange, "service-cluster-ip-range", s.ServiceClusterIPRange, "A CIDR notation IP range from which to assign service cluster IPs. This must not overlap with any IP ranges assigned to nodes for pods.") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do the overrides interact with secured etcd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd have to set up all your etcd clusters to accept the same client cert for the overrides to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now
etcd-servers-overrides
has such format:extensions/deployments#http://ip1:port1;http://ip2:port2
, if we want to support certificates override, this format can get quite complicated, not that user friendly, I agree with @lavalamp you would have to set up all your etcd clusters to accept the same client cert.