util

package
v0.61.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindEnvironmentNamespaceConflict added in v0.61.0

func FindEnvironmentNamespaceConflict(ctx context.Context, databaseClient database.Client, planeScope string, namespace string, excludeID string) (string, error)

FindEnvironmentNamespaceConflict reports whether any other environment in the plane already claims the given Kubernetes namespace, returning the conflicting environment's resource ID or an empty string when the namespace is free.

The search is plane-wide (recursive across every resource group) and covers both Applications.Core/environments and Radius.Core/environments, because a namespace is a cluster-scoped resource: two environments that share one would deploy into the same place regardless of which resource group or API version declared them. Scoping the search to a single resource group, as this check historically did, let callers bypass the constraint just by creating a second resource group.

excludeID is the resource ID of the environment being created or updated. It is skipped so that re-applying an unchanged environment does not conflict with its own stored record.

This check is best-effort with respect to concurrency: it reads the current state and the caller then writes, so two simultaneous creates naming the same namespace can both pass. The database enforces uniqueness on resource ID only and cannot express a cross-resource invariant, so closing that window would require a separate namespace-claim resource. The window is small (the environment PUT is synchronous) and the failure mode is the pre-existing one: a duplicate slips through and is caught the next time either environment is written.

func FindResources

func FindResources(ctx context.Context, rootScope, resourceType, filterKey, filterValue string, databaseClient database.Client) (*database.ObjectQueryResult, error)

FindResources searches for resources of a given type with a given filter key and value, and returns the query result.

func NamespaceConflictMessage added in v0.61.0

func NamespaceConflictMessage(namespace string, conflictingEnvironmentID string) string

NamespaceConflictMessage builds the error message returned when a Kubernetes namespace is already claimed by another environment. The conflicting environment's ID is included so an operator can find and resolve the collision.

func NamespaceImmutableMessage added in v0.61.0

func NamespaceImmutableMessage(currentNamespace string, requestedNamespace string) string

NamespaceImmutableMessage builds the error message returned when a request tries to change or clear the Kubernetes namespace of an environment that already has one. requestedNamespace is empty when the request drops the Kubernetes provider altogether.

Types

This section is empty.

Jump to

Keyboard shortcuts

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