Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for calculateRangeOffset (0.36 sec)

  1. pkg/registry/core/service/portallocator/allocator.go

    	r.metrics = &metricsRecorder{}
    }
    
    // calculateRangeOffset estimates the offset used on the range for statically allocation based on
    // the following formula `min(max($min, rangeSize/$step), $max)`, described as ~never less than
    // $min or more than $max, with a graduated step function between them~. The function returns 0
    // if any of the parameters is invalid.
    func calculateRangeOffset(pr net.PortRange) int {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/allocator_test.go

    					Base: 30000,
    					Size: 8192,
    				},
    			},
    			want: 128,
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if got := calculateRangeOffset(tt.args.pr); got != tt.want {
    				t.Errorf("calculateRangeOffset() = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestNodePortMetrics(t *testing.T) {
    	clearMetrics()
    	// create node port allocator
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 14K bytes
    - Viewed (0)
  3. pkg/registry/core/service/ipallocator/bitmap.go

    }
    
    // calculateRangeOffset estimates the offset used on the range for statically allocation based on
    // the following formula `min(max($min, cidrSize/$step), $max)`, described as ~never less than
    // $min or more than $max, with a graduated step function between them~. The function returns 0
    // if any of the parameters is invalid.
    func calculateRangeOffset(cidr *net.IPNet) int {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 10.8K bytes
    - Viewed (0)
  4. pkg/registry/core/service/ipallocator/bitmap_test.go

    	r, err := NewInMemory(cidr)
    	if err != nil {
    		t.Fatal(err)
    	}
    	// allocate all addresses on the dynamic block
    	// subnet /25 = 128 ; dynamic block size is min(max(16,128/16),256) = 16
    	dynamicOffset := calculateRangeOffset(cidr)
    	dynamicBlockSize := r.max - dynamicOffset
    	for i := 0; i < dynamicBlockSize; i++ {
    		if _, err := r.AllocateNext(); err != nil {
    			t.Errorf("Unexpected error trying to allocate: %v", err)
    		}
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  5. pkg/registry/core/service/ipallocator/ipallocator.go

    	if family == api.IPv4Protocol {
    		ipLast = ipLast.Prev()
    	}
    	// KEP-3070: Reserve Service IP Ranges For Dynamic and Static IP Allocation
    	// calculate the subrange offset
    	rangeOffset := calculateRangeOffset(cidr)
    	offsetAddress, err := addOffsetAddress(ipFirst, uint64(rangeOffset))
    	if err != nil {
    		return nil, err
    	}
    	a := &Allocator{
    		cidr:            cidr,
    		prefix:          prefix,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 31 21:05:04 UTC 2023
    - 17K bytes
    - Viewed (0)
  6. pkg/registry/core/service/ipallocator/ipallocator_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    	defer r.Destroy()
    	// allocate all addresses on the dynamic block
    	// subnet /25 = 128 ; dynamic block size is min(max(16,128/16),256) = 16
    	dynamicOffset := calculateRangeOffset(cidr)
    	dynamicBlockSize := int(r.size) - dynamicOffset
    	for i := 0; i < dynamicBlockSize; i++ {
    		_, err := r.AllocateNext()
    		if err != nil {
    			t.Errorf("Unexpected error trying to allocate: %v", err)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jun 25 13:14:46 UTC 2023
    - 24.2K bytes
    - Viewed (0)
Back to top