Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for ReadAtMost (0.24 sec)

  1. pkg/util/tail/tail.go

    import (
    	"io"
    	"os"
    )
    
    const (
    	// blockSize is the block size used in tail.
    	blockSize = 1024
    )
    
    // ReadAtMost reads at most max bytes from the end of the file identified by path or
    // returns an error. It returns true if the file was longer than max. It will
    // allocate up to max bytes.
    func ReadAtMost(path string, max int64) ([]byte, bool, error) {
    	f, err := os.Open(path)
    	if err != nil {
    		return nil, false, err
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 30 13:13:22 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  2. pkg/util/tail/tail_test.go

    			max:           4613,
    			longerThanMax: false,
    			expected:      string(testBytes),
    		},
    	}
    
    	for _, test := range testCases {
    		readAtMostBytes, longerThanMax, err := ReadAtMost(file.Name(), test.max)
    		if err != nil {
    			t.Fatalf("Unexpected failure %v", err)
    		}
    		if test.longerThanMax != longerThanMax {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 30 13:13:22 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  3. pkg/probe/http/http.go

    	headers := req.Header
    	res, err := client.Do(req)
    	if err != nil {
    		// Convert errors into failures to catch timeouts.
    		return probe.Failure, err.Error(), nil
    	}
    	defer res.Body.Close()
    	b, err := utilio.ReadAtMost(res.Body, maxRespBodyLength)
    	if err != nil {
    		if err == utilio.ErrLimitReached {
    			klog.V(4).Infof("Non fatal body truncation for %s, Response: %v", url.String(), *res)
    		} else {
    			return probe.Failure, "", err
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Feb 10 00:37:32 UTC 2023
    - 5K bytes
    - Viewed (0)
  4. pkg/kubelet/config/http.go

    	if err != nil {
    		return err
    	}
    	req.Header = s.header
    	resp, err := s.client.Do(req)
    	if err != nil {
    		return err
    	}
    	defer resp.Body.Close()
    	data, err := utilio.ReadAtMost(resp.Body, maxConfigLength)
    	if err != nil {
    		return err
    	}
    	if resp.StatusCode != http.StatusOK {
    		return fmt.Errorf("%v: %v", s.url, resp.Status)
    	}
    	if len(data) == 0 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 01 07:19:44 UTC 2021
    - 4.1K bytes
    - Viewed (0)
  5. pkg/kubelet/config/file.go

    				return
    			}
    			s.fileKeyMapping[filename] = objKey
    		}
    	}()
    
    	file, err := os.Open(filename)
    	if err != nil {
    		return pod, err
    	}
    	defer file.Close()
    
    	data, err := utilio.ReadAtMost(file, maxConfigLength)
    	if err != nil {
    		return pod, err
    	}
    
    	defaultFn := func(pod *api.Pod) error {
    		return s.applyDefaults(pod, filename)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 01 07:19:44 UTC 2021
    - 6.2K bytes
    - Viewed (0)
  6. pkg/kubelet/network/dns/dns.go

    // it into nameservers, searches and options, possibly returning an error.
    func parseResolvConf(reader io.Reader) (nameservers []string, searches []string, options []string, err error) {
    	file, err := utilio.ReadAtMost(reader, maxResolvConfLength)
    	if err != nil {
    		return nil, nil, nil, err
    	}
    
    	// Lines of the form "nameserver 1.2.3.4" accumulate.
    	nameservers = []string{}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 04 11:37:10 UTC 2023
    - 16.1K bytes
    - Viewed (0)
  7. pilot/cmd/pilot-agent/status/server.go

    		w.WriteHeader(http.StatusOK)
    		return
    	}
    	// We only write the status code to the response.
    	w.WriteHeader(response.StatusCode)
    	// Return the body from probe as well
    	b, _ := k8sUtilIo.ReadAtMost(response.Body, maxRespBodyLength)
    	_, _ = w.Write(b)
    }
    
    func (s *Server) handleAppProbeTCPSocket(w http.ResponseWriter, prober *Prober) {
    	timeout := time.Duration(prober.TimeoutSeconds) * time.Second
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu May 23 15:07:03 UTC 2024
    - 31.1K bytes
    - Viewed (0)
  8. pkg/kubelet/kuberuntime/kuberuntime_container.go

    	for _, mount := range status.Mounts {
    		if mount.ContainerPath != terminationMessagePath {
    			continue
    		}
    		path := mount.HostPath
    		data, _, err := tail.ReadAtMost(path, kubecontainer.MaxContainerTerminationMessageLength)
    		if err != nil {
    			if os.IsNotExist(err) {
    				return "", fallbackToLogs
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 04 06:25:43 UTC 2024
    - 54.7K bytes
    - Viewed (0)
Back to top