Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for NewFromSnapshot (0.22 sec)

  1. pkg/registry/core/service/ipallocator/controller/repair_test.go

    		if err := r.runOnce(); err != nil {
    			t.Fatal(err)
    		}
    		after, err := ipallocator.NewFromSnapshot(ipregistry.updated)
    		if err != nil {
    			t.Fatal(err)
    		}
    		if !after.Has(netutils.ParseIPSloppy("192.168.1.10")) {
    			t.Errorf("expected ipallocator to still have leaked IP")
    		}
    		secondaryAfter, err := ipallocator.NewFromSnapshot(secondaryIPRegistry.updated)
    		if err != nil {
    			t.Fatal(err)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/controller/repair_test.go

    			t.Fatal(err)
    		}
    		after, err := portallocator.NewFromSnapshot(registry.updated)
    		if err != nil {
    			t.Fatal(err)
    		}
    		if !after.Has(111) {
    			t.Errorf("expected portallocator to still have leaked port")
    		}
    	}
    	// Run one more time to actually remove the leak.
    	if err := r.runOnce(); err != nil {
    		t.Fatal(err)
    	}
    	after, err := portallocator.NewFromSnapshot(registry.updated)
    	if err != nil {
    		t.Fatal(err)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 10.6K bytes
    - Viewed (0)
  3. pkg/registry/core/service/portallocator/allocator.go

    	return New(pr, func(max int, rangeSpec string, offset int) (allocator.Interface, error) {
    		return allocator.NewAllocationMapWithOffset(max, rangeSpec, offset), nil
    	})
    }
    
    // NewFromSnapshot allocates a PortAllocator and initializes it from a snapshot.
    func NewFromSnapshot(snap *api.RangeAllocation) (*PortAllocator, error) {
    	pr, err := net.ParsePortRange(snap.Range)
    	if err != nil {
    		return nil, err
    	}
    	r, err := NewInMemory(*pr)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  4. pkg/registry/core/service/ipallocator/bitmap.go

    		return allocator.NewAllocationMapWithOffset(max, rangeSpec, offset), nil
    	})
    }
    
    // NewFromSnapshot allocates a Range and initializes it from a snapshot.
    func NewFromSnapshot(snap *api.RangeAllocation) (*Range, error) {
    	_, ipnet, err := netutils.ParseCIDRSloppy(snap.Range)
    	if err != nil {
    		return nil, err
    	}
    	r, err := NewInMemory(ipnet)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 10.8K bytes
    - Viewed (0)
  5. pkg/registry/core/service/portallocator/controller/repair.go

    	}
    	// If not yet initialized.
    	if snapshot.Range == "" {
    		snapshot.Range = c.portRange.String()
    	}
    	// Create an allocator because it is easy to use.
    	stored, err := portallocator.NewFromSnapshot(snapshot)
    	if err != nil {
    		return fmt.Errorf("unable to rebuild allocator from snapshot: %v", err)
    	}
    
    	// We explicitly send no resource version, since the resource version
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 10.4K bytes
    - Viewed (0)
  6. pkg/registry/core/service/ipallocator/controller/repair.go

    			snapshot.Range = c.networkByFamily[family].String()
    		}
    	}
    
    	// Create an allocator because it is easy to use.
    	for family, snapshot := range snapshotByFamily {
    		stored, err := ipallocator.NewFromSnapshot(snapshot)
    		if err != nil {
    			return fmt.Errorf("unable to rebuild allocator from snapshots for family:%v with error:%v", family, err)
    		}
    
    		storedByFamily[family] = stored
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 13.8K bytes
    - Viewed (0)
  7. pkg/registry/core/service/portallocator/allocator_test.go

    		if err != nil {
    			t.Fatal(err)
    		}
    		allocated = append(allocated, p)
    	}
    
    	snapshot := api.RangeAllocation{}
    	if err = r.Snapshot(&snapshot); err != nil {
    		t.Fatal(err)
    	}
    
    	r, err = NewFromSnapshot(&snapshot)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	if x := r.Free(); x != 51 {
    		t.Fatalf("expected 51 free ports, got %d", x)
    	}
    	if x := r.Used(); x != 50 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 14K bytes
    - Viewed (0)
  8. pkg/registry/core/service/ipallocator/bitmap_test.go

    			t.Fatal(err)
    		}
    		allocated = append(allocated, ip)
    	}
    
    	snapshot := api.RangeAllocation{}
    	if err = r.Snapshot(&snapshot); err != nil {
    		t.Fatal(err)
    	}
    
    	r, err = NewFromSnapshot(&snapshot)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	if x := r.Free(); x != 126 {
    		t.Fatalf("expected 126 free IPs, got %d", x)
    	}
    	if x := r.Used(); x != 128 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 21.1K bytes
    - Viewed (0)
Back to top