mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-12 21:40:29 +00:00
add authentication/authorization to kubernetes-discovery
This commit is contained in:
@@ -40,8 +40,10 @@ import (
|
||||
const defaultEtcdPathPrefix = "/registry/kubernetes.io/kubernetes-discovery"
|
||||
|
||||
type DiscoveryServerOptions struct {
|
||||
Etcd *genericoptions.EtcdOptions
|
||||
SecureServing *genericoptions.SecureServingOptions
|
||||
Etcd *genericoptions.EtcdOptions
|
||||
SecureServing *genericoptions.SecureServingOptions
|
||||
Authentication *genericoptions.DelegatingAuthenticationOptions
|
||||
Authorization *genericoptions.DelegatingAuthorizationOptions
|
||||
|
||||
StdOut io.Writer
|
||||
StdErr io.Writer
|
||||
@@ -50,8 +52,10 @@ type DiscoveryServerOptions struct {
|
||||
// NewCommandStartMaster provides a CLI handler for 'start master' command
|
||||
func NewCommandStartDiscoveryServer(out, err io.Writer) *cobra.Command {
|
||||
o := &DiscoveryServerOptions{
|
||||
Etcd: genericoptions.NewEtcdOptions(),
|
||||
SecureServing: genericoptions.NewSecureServingOptions(),
|
||||
Etcd: genericoptions.NewEtcdOptions(),
|
||||
SecureServing: genericoptions.NewSecureServingOptions(),
|
||||
Authentication: genericoptions.NewDelegatingAuthenticationOptions(),
|
||||
Authorization: genericoptions.NewDelegatingAuthorizationOptions(),
|
||||
|
||||
StdOut: out,
|
||||
StdErr: err,
|
||||
@@ -73,6 +77,8 @@ func NewCommandStartDiscoveryServer(out, err io.Writer) *cobra.Command {
|
||||
flags := cmd.Flags()
|
||||
o.Etcd.AddFlags(flags)
|
||||
o.SecureServing.AddFlags(flags)
|
||||
o.Authentication.AddFlags(flags)
|
||||
o.Authorization.AddFlags(flags)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -100,6 +106,12 @@ func (o DiscoveryServerOptions) RunDiscoveryServer() error {
|
||||
if _, err := genericAPIServerConfig.ApplySecureServingOptions(o.SecureServing); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := genericAPIServerConfig.ApplyDelegatingAuthenticationOptions(o.Authentication); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := genericAPIServerConfig.ApplyDelegatingAuthorizationOptions(o.Authorization); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var err error
|
||||
privilegedLoopbackToken := uuid.NewRandom().String()
|
||||
|
||||
Reference in New Issue
Block a user