Skip to content

Commit

Permalink
Merge pull request kcp-dev#253 from imjasonh/oidc
Browse files Browse the repository at this point in the history
Support OIDC authentication flags
  • Loading branch information
imjasonh authored Dec 7, 2021
2 parents 5f8389d + 2c230cd commit 31fe4c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (

"github.com/spf13/pflag"

kubeoptions "k8s.io/kubernetes/pkg/kubeapiserver/options"

"github.com/kcp-dev/kcp/pkg/etcd"
"github.com/kcp-dev/kcp/pkg/reconciler/cluster"
)
Expand All @@ -41,6 +43,7 @@ func DefaultConfig() *Config {
ProfilerAddress: "",
ShardKubeconfigFile: "",
EnableSharding: false,
Authentication: kubeoptions.NewBuiltInAuthenticationOptions().WithAll(),
}
}

Expand All @@ -59,6 +62,7 @@ type Config struct {
ProfilerAddress string
ShardKubeconfigFile string
EnableSharding bool
Authentication *kubeoptions.BuiltInAuthenticationOptions
}

func BindOptions(c *Config, fs *pflag.FlagSet) *Config {
Expand All @@ -80,5 +84,6 @@ func BindOptions(c *Config, fs *pflag.FlagSet) *Config {

c.ClusterControllerOptions = cluster.BindOptions(c.ClusterControllerOptions, fs)

c.Authentication.AddFlags(fs)
return c
}
3 changes: 3 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ func (s *Server) Run(ctx context.Context) error {
}

serverOptions := options.NewServerRunOptions()

serverOptions.Authentication = s.cfg.Authentication

host, port, err := net.SplitHostPort(s.cfg.Listen)
if err != nil {
return fmt.Errorf("--listen must be of format host:port: %w", err)
Expand Down

0 comments on commit 31fe4c8

Please sign in to comment.