Documentation ¶
Index ¶
- Constants
- func BuildExternalOutputResources(outputResources []OutputResource) []map[string]any
- func NewLocalID(prefix string, ids ...string) string
- type BasicDaprResourceProperties
- type BasicResourceProperties
- type ComputedValueReference
- type DeploymentDataModel
- type DeploymentOutput
- type EnvironmentCompute
- type EnvironmentComputeKind
- type IdentitySettingKind
- type IdentitySettings
- type KubernetesComputeProperties
- type OutputResource
- type RadiusResourceModel
- type RecipeStatus
- type Resource
- type ResourceStatus
- type SecretValueReference
Constants ¶
const ( LocalIDAzureCosmosAccount = "AzureCosmosAccount" LocalIDAzureCosmosDBMongo = "AzureCosmosDBMongo" LocalIDDaprStateStoreAzureStorage = "DaprStateStoreAzureStorage" LocalIDDaprSecretStoreAzureKeyVault = "DaprSecretStoreAzureKeyVault" LocalIDDaprPubSubBrokerKafka = "DaprPubSubBrokerKafka" LocalIDDeployment = "Deployment" LocalIDGateway = "Gateway" LocalIDHttpRoute = "HttpRoute" LocalIDKeyVault = "KeyVault" LocalIDSecret = "Secret" LocalIDConfigMap = "ConfigMap" LocalIDSecretProviderClass = "SecretProviderClass" LocalIDServiceAccount = "ServiceAccount" LocalIDKubernetesRole = "KubernetesRole" LocalIDKubernetesRoleBinding = "KubernetesRoleBinding" LocalIDService = "Service" LocalIDUserAssignedManagedIdentity = "UserAssignedManagedIdentity" LocalIDFederatedIdentity = "FederatedIdentity" LocalIDRoleAssignmentPrefix = "RoleAssignment" // Obsolete when we remove AppModelV1 LocalIDRoleAssignmentKVKeys = "RoleAssignment-KVKeys" )
Represents local IDs used for output resources
Variables ¶
This section is empty.
Functions ¶
func BuildExternalOutputResources ¶
func BuildExternalOutputResources(outputResources []OutputResource) []map[string]any
BuildExternalOutputResources builds a slice of maps containing the LocalID, Provider and Identity of each OutputResource.
func NewLocalID ¶
NewLocalID generates a unique string based on the input parameter ids using a stable hashing algorithm.
Most LocalIDs are a 1:1 mapping with Radius resource. This is a little tricky for role assignments because we need to key them on the resource ID of the target resource X the role being assigned. For example if the user switches their keyvault 'a' for a different instance 'b' we want to delete the original role assignments and create new ones.
Types ¶
type BasicDaprResourceProperties ¶
type BasicDaprResourceProperties struct { // ComponentName represents the name of the component. ComponentName string `json:"componentName,omitempty"` }
BasicDaprResourceProperties is the basic resource properties for dapr resources.
type BasicResourceProperties ¶
type BasicResourceProperties struct { // Environment represents the id of environment resource. Environment string `json:"environment,omitempty"` // Application represents the id of application resource. Application string `json:"application,omitempty"` // Status represents the resource status. Status ResourceStatus `json:"status,omitempty"` }
BasicResourceProperties is the basic resource model for Radius resources.
func (*BasicResourceProperties) EqualLinkedResource ¶
func (b *BasicResourceProperties) EqualLinkedResource(prop *BasicResourceProperties) bool
Method EqualLinkedResource compares two BasicResourceProperties objects and returns true if their Application and Environment fields are equal (i.e. resource belongs to the same env and app).
func (*BasicResourceProperties) IsGlobalScopedResource ¶ added in v0.31.0
func (b *BasicResourceProperties) IsGlobalScopedResource() bool
Method IsGlobalScopedResource checks if resource is global scoped.
type ComputedValueReference ¶
type ComputedValueReference struct { // LocalID specifies the output resource to be used for lookup. Does not apply with `.Value` LocalID string // Value specifies a static value to copy to computed values. Value any // PropertyReference specifies a property key to look up in the resource's *persisted properties*. PropertyReference string // JSONPointer specifies a JSON Pointer that cn be used to look up the value in the resource's body. JSONPointer string // Transformer transforms datamodel resource with the computed values. Transformer func(v1.DataModelInterface, map[string]any) error }
ComputedValueReference represents a non-secret value that can accessed once the output resources have been deployed.
type DeploymentDataModel ¶
type DeploymentDataModel interface { v1.ResourceDataModel ApplyDeploymentOutput(deploymentOutput DeploymentOutput) error OutputResources() []OutputResource }
DeploymentDataModel is the interface that wraps existing data models and enables us to use in generic deployment backend controllers.
type DeploymentOutput ¶
type DeploymentOutput struct { DeployedOutputResources []OutputResource ComputedValues map[string]any SecretValues map[string]SecretValueReference }
DeploymentOutput is the output details of a deployment.
type EnvironmentCompute ¶
type EnvironmentCompute struct { Kind EnvironmentComputeKind `json:"kind"` KubernetesCompute KubernetesComputeProperties `json:"kubernetes,omitempty"` // Environment-level identity that can be used by any resource in the environment. // Resources can specify its own identities and they will override the environment-level identity. Identity *IdentitySettings `json:"identity,omitempty"` }
EnvironmentCompute represents the compute resource of Environment.
type EnvironmentComputeKind ¶
type EnvironmentComputeKind string
EnvironmentComputeKind is the type of compute resource.
const ( // UnknownComputeKind represents kubernetes compute resource type. UnknownComputeKind EnvironmentComputeKind = "unknown" // KubernetesComputeKind represents kubernetes compute resource type. KubernetesComputeKind EnvironmentComputeKind = "kubernetes" )
type IdentitySettingKind ¶
type IdentitySettingKind string
IdentitySettingKind represents the kind of identity setting.
const ( // IdentityNone represents unknown identity. IdentityNone IdentitySettingKind = "None" // AzureIdentityWorkload represents Azure Workload identity. AzureIdentityWorkload IdentitySettingKind = "azure.com.workload" )
type IdentitySettings ¶
type IdentitySettings struct { // Kind represents the type of authentication. Kind IdentitySettingKind `json:"kind"` // OIDCIssuer represents the name of OIDC issuer. OIDCIssuer string `json:"oidcIssuer,omitempty"` // Resource represents the resource id of managed identity. Resource string `json:"resource,omitempty"` }
IdentitySettings represents the identity info to access azure resource, such as Key vault.
func (*IdentitySettings) Validate ¶
func (is *IdentitySettings) Validate() error
Validate checks if the IdentitySettings struct is nil and if the Kind is AzureIdentityWorkload, checks if the OIDCIssuer is empty and if the Resource is not empty. It returns an error if any of these conditions are not met.
type KubernetesComputeProperties ¶
type KubernetesComputeProperties struct { // ResourceID represents the resource ID for kubernetes compute resource. ResourceID string `json:"resourceId,omitempty"` // Namespace represents Kubernetes namespace. Namespace string `json:"namespace"` }
KubernetesComputeProperties represents the kubernetes compute of the environment.
type OutputResource ¶
type OutputResource struct { // LocalID is a logical identifier scoped to the owning Radius resource. This is only needed or used // when a resource has a dependency relationship. LocalIDs do not have any particular format or meaning // beyond being compared to determine dependency relationships. LocalID string `json:"localID"` // ID is the UCP resource ID of the underlying resource. ID resources.ID `json:"id"` // RadiusManaged determines whether Radius manages the lifecycle of the underlying resource. RadiusManaged *bool `json:"radiusManaged"` // CreateResource describes data that will be used to create a resource. This is never saved to the database. CreateResource *Resource `json:"-"` }
OutputResource represents the output of rendering a resource
func GetGCOutputResources ¶
func GetGCOutputResources(after []OutputResource, before []OutputResource) []OutputResource
GetGCOutputResources [GC stands for Garbage Collection] compares two slices of OutputResource and returns a slice of OutputResource that contains the elements that are in the "before" slice but not in the "after".
func NewKubernetesOutputResource ¶
func NewKubernetesOutputResource(localID string, obj runtime.Object, objectMeta metav1.ObjectMeta) OutputResource
NewKubernetesOutputResource creates an OutputResource object with the given resourceType, localID, obj and objectMeta.
func OrderOutputResources ¶
func OrderOutputResources(outputResources []OutputResource) ([]OutputResource, error)
OrderOutputResources orders the given OutputResources based on their dependencies (i.e. deployment order) and returns the ordered OutputResources or an error.
func (OutputResource) GetDependencies ¶
func (resource OutputResource) GetDependencies() ([]string, error)
GetDependencies returns a slice of strings containing the LocalIDs of the OutputResource's dependencies, or an error if any of the dependencies are missing a LocalID.
func (OutputResource) GetResourceType ¶
func (or OutputResource) GetResourceType() resourcemodel.ResourceType
GetResourceType returns the ResourceType of the OutputResource.
func (OutputResource) IsRadiusManaged ¶
func (resource OutputResource) IsRadiusManaged() bool
IsRadiusManaged checks if the RadiusManaged field of the OutputResource struct is set and returns its value.
func (OutputResource) Key ¶
func (resource OutputResource) Key() string
Key localID of the output resource is used as the key in DependencyItem for output resources.
type RadiusResourceModel ¶
type RadiusResourceModel interface { v1.ResourceDataModel ApplyDeploymentOutput(deploymentOutput DeploymentOutput) error OutputResources() []OutputResource ResourceMetadata() *BasicResourceProperties }
RadiusResourceModel represents the interface of radius resource type. TODO: Replace DeploymentDataModel with RadiusResourceModel later when link rp leverages generic.
type RecipeStatus ¶ added in v0.27.0
type RecipeStatus struct { // TemplateKind specifies the kind of template used for the recipe. TemplateKind string `json:"templateKind,omitempty"` // TemplatePath specifies the path of the template used for the recipe. TemplatePath string `json:"templatePath,omitempty"` // TemplateVersion specifies the version of the template used for the recipe. TemplateVersion string `json:"templateVersion,omitempty"` }
RecipeStatus defines the status of the recipe
type Resource ¶
type Resource struct { // Data is the arbitrary data that will be passed to the handler. Data any // ResourceType is the type of resource that will be created. This is used for dispatching to the correct handler. ResourceType resourcemodel.ResourceType // Dependencies is the set of LocalIDs of the resources that are required to be deployed before this resource can be deployed. Dependencies []string }
Resource describes data that will be used to create a resource. This data is not saved to the database.
func (Resource) ExistDependency ¶
ExistDependency checks if the given id is in the Dependencies of the Resource and returns true if it is, false otherwise.
type ResourceStatus ¶
type ResourceStatus struct { // Compute represents a resource presented in the underlying platform. Compute *EnvironmentCompute `json:"compute,omitempty"` // OutputResources represents the output resources associated with the radius resource. OutputResources []OutputResource `json:"outputResources,omitempty"` Recipe *RecipeStatus `json:"recipe,omitempty"` }
ResourceStatus represents the output status of Radius resource.
func (*ResourceStatus) DeepCopy ¶
func (in *ResourceStatus) DeepCopy(out *ResourceStatus)
DeepCopy copies the contents of the ResourceStatus struct from in to out.
type SecretValueReference ¶
type SecretValueReference struct { // Value is the secret value itself Value string }
SecretValueReference represents a secret value that can accessed on the output resources have been deployed.