Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ type Client struct {
schema *runtime.Scheme
restConfig *rest.Config
logger *log.Logger
// acceptOnlyJSONContentType
// use only JSON for interactions with kube-api
acceptOnlyJSONContentType bool
}

// ReloadDynamic creates new dynamic client with the new set of CRDs.
Expand All @@ -117,6 +120,16 @@ func (c *Client) WithConfigPath(path string) {
c.configPath = path
}

func (c *Client) WithAcceptOnlyJSONContentType(e bool) {
c.acceptOnlyJSONContentType = e
}

func (c *Client) WithLogger(logger *log.Logger) {
if logger != nil {
c.logger = logger
}
}

func (c *Client) WithRateLimiterSettings(qps float32, burst int) {
c.qps = qps
c.burst = burst
Expand Down Expand Up @@ -219,6 +232,10 @@ func (c *Client) Init() error {
return fmt.Errorf("failed to initialize kubernetes client: no valid configuration found")
}

if c.acceptOnlyJSONContentType {
config.AcceptContentTypes = "application/json"
}

c.defaultNamespace = defaultNs

if c.qps != 0 {
Expand Down
Loading