mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #96552 from pandaamanda/klog_fmt
use klog.Info and klog.Warning when had no format
This commit is contained in:
commit
8bf42039e6
@ -335,7 +335,7 @@ func makeLeaderElectionConfig(config componentbaseconfig.LeaderElectionConfigura
|
||||
// TODO remove masterOverride when CLI flags are removed.
|
||||
func createKubeConfig(config componentbaseconfig.ClientConnectionConfiguration, masterOverride string) (*restclient.Config, error) {
|
||||
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
|
||||
klog.Warningf("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
|
||||
klog.Warning("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
|
||||
}
|
||||
|
||||
// This creates a client, first loading any specified kubeconfig
|
||||
|
@ -332,7 +332,7 @@ func (rc *reconciler) reportMultiAttachError(volumeToAttach cache.VolumeToAttach
|
||||
// Log detailed message to system admin
|
||||
nodeList := strings.Join(otherNodesStr, ", ")
|
||||
detailedMsg := volumeToAttach.GenerateMsgDetailed("Multi-Attach error", fmt.Sprintf("Volume is already exclusively attached to node %s and can't be attached to another", nodeList))
|
||||
klog.Warningf(detailedMsg)
|
||||
klog.Warning(detailedMsg)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
klet.configMapManager = configMapManager
|
||||
|
||||
if klet.experimentalHostUserNamespaceDefaulting {
|
||||
klog.Infof("Experimental host user namespace defaulting is enabled.")
|
||||
klog.Info("Experimental host user namespace defaulting is enabled.")
|
||||
}
|
||||
|
||||
machineInfo, err := klet.cadvisor.MachineInfo()
|
||||
|
@ -204,9 +204,9 @@ func sortGroupDiscoveryByKubeAwareVersion(gd []metav1.GroupVersionForDiscovery)
|
||||
func (c *DiscoveryController) Run(stopCh <-chan struct{}, synchedCh chan<- struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
defer klog.Infof("Shutting down DiscoveryController")
|
||||
defer klog.Info("Shutting down DiscoveryController")
|
||||
|
||||
klog.Infof("Starting DiscoveryController")
|
||||
klog.Info("Starting DiscoveryController")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, c.crdsSynced) {
|
||||
utilruntime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
|
||||
|
@ -73,8 +73,8 @@ func (ec *EstablishingController) Run(stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer ec.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting EstablishingController")
|
||||
defer klog.Infof("Shutting down EstablishingController")
|
||||
klog.Info("Starting EstablishingController")
|
||||
defer klog.Info("Shutting down EstablishingController")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, ec.crdSynced) {
|
||||
return
|
||||
|
@ -263,8 +263,8 @@ func (c *CRDFinalizer) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting CRDFinalizer")
|
||||
defer klog.Infof("Shutting down CRDFinalizer")
|
||||
klog.Info("Starting CRDFinalizer")
|
||||
defer klog.Info("Shutting down CRDFinalizer")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, c.crdSynced) {
|
||||
return
|
||||
|
@ -288,8 +288,8 @@ func (c *NamingConditionController) Run(stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting NamingConditionController")
|
||||
defer klog.Infof("Shutting down NamingConditionController")
|
||||
klog.Info("Starting NamingConditionController")
|
||||
defer klog.Info("Shutting down NamingConditionController")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, c.crdSynced) {
|
||||
return
|
||||
|
@ -131,7 +131,7 @@ func SetTransportDefaults(t *http.Transport) *http.Transport {
|
||||
t = SetOldTransportDefaults(t)
|
||||
// Allow clients to disable http2 if needed.
|
||||
if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 {
|
||||
klog.Infof("HTTP2 has been explicitly disabled")
|
||||
klog.Info("HTTP2 has been explicitly disabled")
|
||||
} else if allowsHTTP2(t) {
|
||||
if err := configureHTTP2Transport(t); err != nil {
|
||||
klog.Warningf("Transport failed http2 configuration: %v", err)
|
||||
|
@ -69,7 +69,7 @@ func dialURL(ctx context.Context, url *url.URL, transport http.RoundTripper) (ne
|
||||
}
|
||||
if tlsConfig == nil {
|
||||
// tls.Client requires non-nil config
|
||||
klog.Warningf("using custom dialer with no TLSClientConfig. Defaulting to InsecureSkipVerify")
|
||||
klog.Warning("using custom dialer with no TLSClientConfig. Defaulting to InsecureSkipVerify")
|
||||
// tls.Handshake() requires ServerName or InsecureSkipVerify
|
||||
tlsConfig = &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
// is invoked to serve the request.
|
||||
func WithAuthentication(handler http.Handler, auth authenticator.Request, failed http.Handler, apiAuds authenticator.Audiences) http.Handler {
|
||||
if auth == nil {
|
||||
klog.Warningf("Authentication is disabled")
|
||||
klog.Warning("Authentication is disabled")
|
||||
return handler
|
||||
}
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
@ -44,7 +44,7 @@ const (
|
||||
// WithAuthorizationCheck passes all authorized requests on to handler, and returns a forbidden error otherwise.
|
||||
func WithAuthorization(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler {
|
||||
if a == nil {
|
||||
klog.Warningf("Authorization is disabled")
|
||||
klog.Warning("Authorization is disabled")
|
||||
return handler
|
||||
}
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
@ -334,8 +334,8 @@ func (s *DelegatingAuthenticationOptions) ApplyTo(authenticationInfo *server.Aut
|
||||
if err != nil {
|
||||
if s.TolerateInClusterLookupFailure {
|
||||
klog.Warningf("Error looking up in-cluster authentication configuration: %v", err)
|
||||
klog.Warningf("Continuing without authentication configuration. This may treat all requests as anonymous.")
|
||||
klog.Warningf("To require authentication configuration lookup to succeed, set --authentication-tolerate-lookup-failure=false")
|
||||
klog.Warning("Continuing without authentication configuration. This may treat all requests as anonymous.")
|
||||
klog.Warning("To require authentication configuration lookup to succeed, set --authentication-tolerate-lookup-failure=false")
|
||||
} else {
|
||||
return fmt.Errorf("unable to load configmap based request-header-client-ca-file: %v", err)
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ func (s *DelegatingAuthorizationOptions) toAuthorizer(client kubernetes.Interfac
|
||||
}
|
||||
|
||||
if client == nil {
|
||||
klog.Warningf("No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work.")
|
||||
klog.Warning("No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work.")
|
||||
} else {
|
||||
cfg := authorizerfactory.DelegatingAuthorizerConfig{
|
||||
SubjectAccessReviewClient: client.AuthorizationV1().SubjectAccessReviews(),
|
||||
|
@ -612,7 +612,7 @@ func (config *inClusterClientConfig) Possible() bool {
|
||||
// to the default config.
|
||||
func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*restclient.Config, error) {
|
||||
if kubeconfigPath == "" && masterUrl == "" {
|
||||
klog.Warningf("Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.")
|
||||
klog.Warning("Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.")
|
||||
kubeconfig, err := restclient.InClusterConfig()
|
||||
if err == nil {
|
||||
return kubeconfig, nil
|
||||
|
@ -426,7 +426,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
||||
|
||||
}
|
||||
if rt.levels[debugRequestHeaders] {
|
||||
klog.Infof("Request Headers:")
|
||||
klog.Info("Request Headers:")
|
||||
for key, values := range reqInfo.RequestHeaders {
|
||||
for _, value := range values {
|
||||
value = maskValue(key, value)
|
||||
@ -448,7 +448,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
||||
klog.Infof("Response Status: %s in %d milliseconds", reqInfo.ResponseStatus, reqInfo.Duration.Nanoseconds()/int64(time.Millisecond))
|
||||
}
|
||||
if rt.levels[debugResponseHeaders] {
|
||||
klog.Infof("Response Headers:")
|
||||
klog.Info("Response Headers:")
|
||||
for key, values := range reqInfo.ResponseHeaders {
|
||||
for _, value := range values {
|
||||
klog.Infof(" %s: %s", key, value)
|
||||
|
@ -133,7 +133,7 @@ type conversionFuncMap map[conversionPair]*types.Type
|
||||
// Returns all manually-defined conversion functions in the package.
|
||||
func getManualConversionFunctions(context *generator.Context, pkg *types.Package, manualMap conversionFuncMap) {
|
||||
if pkg == nil {
|
||||
klog.Warningf("Skipping nil package passed to getManualConversionFunctions")
|
||||
klog.Warning("Skipping nil package passed to getManualConversionFunctions")
|
||||
return
|
||||
}
|
||||
klog.V(5).Infof("Scanning for conversion functions in %v", pkg.Name)
|
||||
@ -641,7 +641,7 @@ func (g *genConversion) Init(c *generator.Context, w io.Writer) error {
|
||||
if klog.V(5).Enabled() {
|
||||
if m, ok := g.useUnsafe.(equalMemoryTypes); ok {
|
||||
var result []string
|
||||
klog.Infof("All objects without identical memory layout:")
|
||||
klog.Info("All objects without identical memory layout:")
|
||||
for k, v := range m {
|
||||
if v {
|
||||
continue
|
||||
|
@ -94,8 +94,8 @@ func (c *APIServiceRegistrationController) Run(stopCh <-chan struct{}, handlerSy
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting APIServiceRegistrationController")
|
||||
defer klog.Infof("Shutting down APIServiceRegistrationController")
|
||||
klog.Info("Starting APIServiceRegistrationController")
|
||||
defer klog.Info("Shutting down APIServiceRegistrationController")
|
||||
|
||||
if !controllers.WaitForCacheSync("APIServiceRegistrationController", stopCh, c.apiServiceSynced) {
|
||||
return
|
||||
|
@ -138,8 +138,8 @@ func (c *autoRegisterController) Run(threadiness int, stopCh <-chan struct{}) {
|
||||
// make sure the work queue is shutdown which will trigger workers to end
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting autoregister controller")
|
||||
defer klog.Infof("Shutting down autoregister controller")
|
||||
klog.Info("Starting autoregister controller")
|
||||
defer klog.Info("Shutting down autoregister controller")
|
||||
|
||||
// wait for your secondary caches to fill before starting your work
|
||||
if !controllers.WaitForCacheSync("autoregister", stopCh, c.apiServiceSynced) {
|
||||
|
@ -80,8 +80,8 @@ func (c *AggregationController) Run(stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting OpenAPI AggregationController")
|
||||
defer klog.Infof("Shutting down OpenAPI AggregationController")
|
||||
klog.Info("Starting OpenAPI AggregationController")
|
||||
defer klog.Info("Shutting down OpenAPI AggregationController")
|
||||
|
||||
go wait.Until(c.runWorker, time.Second, stopCh)
|
||||
|
||||
|
@ -472,8 +472,8 @@ func (c *AvailableConditionController) Run(threadiness int, stopCh <-chan struct
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting AvailableConditionController")
|
||||
defer klog.Infof("Shutting down AvailableConditionController")
|
||||
klog.Info("Starting AvailableConditionController")
|
||||
defer klog.Info("Shutting down AvailableConditionController")
|
||||
|
||||
if !controllers.WaitForCacheSync("AvailableConditionController", stopCh, c.apiServiceSynced, c.servicesSynced, c.endpointsSynced) {
|
||||
return
|
||||
|
@ -407,7 +407,7 @@ func (g *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyDat
|
||||
// GetAllCurrentZones returns all the zones in which k8s nodes are currently running
|
||||
func (g *Cloud) GetAllCurrentZones() (sets.String, error) {
|
||||
if g.nodeInformerSynced == nil {
|
||||
klog.Warningf("Cloud object does not have informers set, should only happen in E2E binary.")
|
||||
klog.Warning("Cloud object does not have informers set, should only happen in E2E binary.")
|
||||
return g.GetAllZonesFromCloudProvider()
|
||||
}
|
||||
g.nodeZonesLock.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user