network

package
v1.16.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

README

Network

Purpose

pkg/handler/network handles the region network resource in both the deprecated v1 model and the preferred v2 model.

The v1 path is the older nested identity-scoped resource surface.

The v2 path is much more important architecturally. Network v2 is special: it provisions a service-principal identity, becomes an ownership root for later resources, carries quota allocation, and supports external references that can block deletion.

So this package is not just “CRUD for networks.” It is the point where the preferred flat API model starts building a new resource tree under a hidden service-principal root.

Distinctive Behaviour

  • v1 networks are direct children of an explicit Identity
  • v2 network creation provisions a service-principal identity implicitly
  • v2 network creation uses a saga because creation spans multiple dependent steps:
    • validate request
    • create service principal
    • generate network
    • create quota allocation
    • create network
  • v2 delete does not delete the visible network object directly; it deletes the hidden service-principal root and relies on cascading deletion
  • external references are represented as finalizers on the network and block delete until removed

Invariants And Guard Rails

  • v2 is the intended model; v1 is compatibility surface only.
  • Network v2 resources are labeled with ResourceAPIVersionLabel=2, and direct object access paths are gated accordingly.
  • v2 lists prefilter by organization/project/region before per-item RBAC.
  • Region access is enforced via region.CheckAccess before network creation, preventing callers from creating networks in regions they cannot see.
  • A Network v2 is the visible coordination point for a resource subtree whose real ownership root is the hidden service principal created for it.
  • Delete must respect both ownership cascade and explicit external references.

Caveats

  • The service principal created for Network v2 is implicit in the API even though it is central to the real ownership model.
  • v2 network deletion is intentionally indirect, which is correct architecturally but easy to miss from the API surface alone.
  • Some network behaviour still depends on transitional provider-specific status details downstream, especially for consumers like storage.

TODO

  • Revisit whether the hidden v2 service-principal concept should become an explicit API object in a future cleaner model.
  • Delete the deprecated v1 nested network surface once migration is complete.

Cross-Package Context

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	common.ClientArgs
}

Client provides a restful API for networks.

func New

func New(clientArgs common.ClientArgs) *Client

New creates a new client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, organizationID, projectID, identityID string, request *openapi.NetworkWrite) (*openapi.NetworkRead, error)

Create instantiates a new resource.

func (*Client) CreateV2 added in v1.10.0

func (c *Client) CreateV2(ctx context.Context, request *openapi.NetworkV2Create) (*openapi.NetworkV2Read, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, organizationID, projectID, networkID string) error

Delete a resource.

func (*Client) DeleteV2 added in v1.10.0

func (c *Client) DeleteV2(ctx context.Context, networkID string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, organizationID, projectID, networkID string) (*openapi.NetworkRead, error)

Get a resource.

func (*Client) GetRaw

func (c *Client) GetRaw(ctx context.Context, organizationID, projectID, networkID string) (*unikornv1.Network, error)

GetRaw gives access to the raw Kubernetes resource.

func (*Client) GetV2 added in v1.10.0

func (c *Client) GetV2(ctx context.Context, networkID string) (*openapi.NetworkV2Read, error)

func (*Client) GetV2Raw added in v1.10.0

func (c *Client) GetV2Raw(ctx context.Context, networkID string) (*regionv1.Network, error)

func (*Client) List

func (c *Client) List(ctx context.Context, organizationID string) (openapi.NetworksRead, error)

List returns an ordered list of all resources in scope.

func (*Client) ListV2 added in v1.10.0

func (*Client) ReferenceCreateV2 added in v1.16.0

func (c *Client) ReferenceCreateV2(ctx context.Context, networkID, reference string) error

ReferenceCreateV2 adds a external reference to the resource that blocks deletion until it has been removed.

func (*Client) ReferenceDeleteV2 added in v1.16.0

func (c *Client) ReferenceDeleteV2(ctx context.Context, networkID, reference string) error

ReferenceDeleteV2 removes an external reference from the resource.

func (*Client) Update added in v1.11.0

func (c *Client) Update(ctx context.Context, networkID string, request *openapi.NetworkV2Update) (*openapi.NetworkV2Read, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL