Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ExtractResourceValueByContainerName (0.26 sec)

  1. pkg/api/v1/resource/helpers.go

    	if resource == v1.ResourceCPU {
    		return requestQuantity.MilliValue()
    	}
    
    	return requestQuantity.Value()
    }
    
    // ExtractResourceValueByContainerName extracts the value of a resource
    // by providing container name
    func ExtractResourceValueByContainerName(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string) (string, error) {
    	container, err := findContainerInPod(pod, containerName)
    	if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 26 13:58:16 UTC 2023
    - 16.3K bytes
    - Viewed (0)
  2. pkg/api/v1/resource/helpers_test.go

    			pod:   getPod("foo", podResources{memoryRequest: "10Mi", memoryLimit: "100Mi"}),
    
    			expectedValue: "104857600",
    		},
    	}
    	as := assert.New(t)
    	for idx, tc := range cases {
    		actual, err := ExtractResourceValueByContainerName(tc.fs, tc.pod, tc.cName)
    		if tc.expectedError != nil {
    			as.Equal(tc.expectedError, err, "expected test case [%d] to fail with error %v; got %v", idx, tc.expectedError, err)
    		} else {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jul 07 22:26:13 UTC 2023
    - 38.3K bytes
    - Viewed (0)
Back to top