Skip to content

Commit

Permalink
Merge commit 'refs/pull/51/head' of github.com:TremoloSecurity/kube-o…
Browse files Browse the repository at this point in the history
…idc-proxy

for TremoloSecurity#65 merging PR for testing
  • Loading branch information
mlbiam committed Jan 9, 2025
2 parents 2a14939 + d8142dd commit fb4f33b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/app/options/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

type ClientOptions struct {
*genericclioptions.ConfigFlags

KubeClientQPS float32
KubeClientBurst int
}

func NewClientOptions(nfs *cliflag.NamedFlagSets) *ClientOptions {
Expand All @@ -27,6 +30,15 @@ func NewClientOptions(nfs *cliflag.NamedFlagSets) *ClientOptions {

func (c *ClientOptions) AddFlags(fs *pflag.FlagSet) *ClientOptions {
c.ConfigFlags.AddFlags(fs)

// Extra flags
fs.Float32Var(&c.KubeClientQPS, "kube-client-qps", c.KubeClientQPS, "Sets the QPS on the app "+
"kubernetes client, this will configure throttling on requests sent to the apiserver "+
"(If not set, it will use client default ones)")
fs.IntVar(&c.KubeClientBurst, "kube-client-burst", c.KubeClientBurst, "Sets the burst on the app "+
"kubernetes client, this will configure throttling on requests sent to the apiserver"+
"(If not set, it will use client default ones)")

return c
}

Expand Down
8 changes: 8 additions & 0 deletions cmd/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ func buildRunCommand(stopCh <-chan struct{}, opts *options.Options) *cobra.Comma
}
}

// Set client throttling settings for Kubernetes clients.
if opts.Client.KubeClientBurst > 0 {
restConfig.Burst = opts.Client.KubeClientBurst
}
if opts.Client.KubeClientQPS > 0 {
restConfig.QPS = opts.Client.KubeClientQPS
}

// Initialise token reviewer if enabled
var tokenReviewer *tokenreview.TokenReview
if opts.App.TokenPassthrough.Enabled {
Expand Down

0 comments on commit fb4f33b

Please sign in to comment.