Skip to content

Commit

Permalink
Merge pull request #15 from lyft/configurable-kube-client
Browse files Browse the repository at this point in the history
Advanced options to configure kube client for large scale deployments
  • Loading branch information
matthewphsmith authored Sep 19, 2019
2 parents f9f1d75 + 4576992 commit 70b8d20
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flytepropeller/cmd/controller/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"fmt"
"os"

"github.com/lyft/flytepropeller/pkg/controller/executors"
"sigs.k8s.io/controller-runtime/pkg/cache"

"github.com/lyft/flytepropeller/pkg/controller/executors"

"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -36,11 +37,12 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"

restclient "k8s.io/client-go/rest"

clientset "github.com/lyft/flytepropeller/pkg/client/clientset/versioned"
informers "github.com/lyft/flytepropeller/pkg/client/informers/externalversions"
"github.com/lyft/flytepropeller/pkg/controller"
"github.com/lyft/flytepropeller/pkg/signals"
restclient "k8s.io/client-go/rest"
)

const (
Expand Down Expand Up @@ -134,6 +136,10 @@ func getKubeConfig(_ context.Context, cfg *config2.Config) (*kubernetes.Clientse
}
}

kubecfg.QPS = cfg.KubeConfig.QPS
kubecfg.Burst = cfg.KubeConfig.Burst
kubecfg.Timeout = cfg.KubeConfig.Timeout.Duration

kubeClient, err := kubernetes.NewForConfig(kubecfg)
if err != nil {
return nil, nil, errors.Wrapf(err, "Error building kubernetes clientset")
Expand Down
12 changes: 12 additions & 0 deletions flytepropeller/pkg/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ type Config struct {
GCInterval config.Duration `json:"gc-interval" pflag:"\"30m\",Run periodic GC every 30 minutes"`
LeaderElection LeaderElectionConfig `json:"leader-election,omitempty" pflag:",Config for leader election."`
PublishK8sEvents bool `json:"publish-k8s-events" pflag:",Enable events publishing to K8s events API."`
KubeConfig KubeClientConfig `json:"kube-client-config" pflag:",Configuration to control the Kubernetes client"`
}

type KubeClientConfig struct {
// QPS indicates the maximum QPS to the master from this client.
// If it's zero, the created RESTClient will use DefaultQPS: 5
QPS float32 `json:"qps" pflag:",Max QPS to the master for requests to KubeAPI. 0 defaults to 5."`
// Maximum burst for throttle.
// If it's zero, the created RESTClient will use DefaultBurst: 10.
Burst int `json:"burst" pflag:",Max burst rate for throttle. 0 defaults to 10"`
// The maximum length of time to wait before giving up on a server request. A value of zero means no timeout.
Timeout config.Duration `json:"timeout" pflag:",Max duration allowed for every request to KubeAPI before giving up. 0 implies no timeout."`
}

type CompositeQueueType = string
Expand Down

0 comments on commit 70b8d20

Please sign in to comment.