MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / initClient

Function initClient

cmd/postgres-operator/main.go:47–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45}
46
47func initClient() (*rest.Config, error) {
48 config, err := runtime.GetConfig()
49
50 if err == nil && userAgent == "" {
51 err = errors.New("call initVersion first")
52 }
53 if err == nil {
54 config.UserAgent = userAgent
55 config.Wrap(otelTransportWrapper())
56
57 // Log Kubernetes API warnings encountered by client-go at a high verbosity.
58 // See [rest.WarningLogger].
59 handler := runtime.WarningHandler(func(ctx context.Context, code int, _ string, message string) {
60 if code == 299 && len(message) != 0 {
61 logging.FromContext(ctx).V(2).WithName("client-go").Info(message)
62 }
63 })
64 config.WarningHandler = handler
65 config.WarningHandlerWithContext = handler
66 }
67
68 return config, err
69}
70
71func initLogging() {
72 debug := strings.TrimSpace(os.Getenv("CRUNCHY_DEBUG"))

Callers 1

mainFunction · 0.85

Calls 6

GetConfigFunction · 0.92
WarningHandlerFuncType · 0.92
FromContextFunction · 0.92
otelTransportWrapperFunction · 0.85
InfoMethod · 0.80
WithNameMethod · 0.80

Tested by

no test coverage detected