Documentation ¶
Index ¶
- Constants
- type ConfigMapResolver
- type OwnerDetails
- type ResolveOwnerResult
- type Resolver
- func (r *Resolver) IndexStorageTypes(scheme *runtime.Scheme, objs []*registration.StorageType) error
- func (r *Resolver) ResolveAll(ctx context.Context, metaObject genruntime.ARMMetaObject) (ResourceHierarchy, genruntime.ConvertToARMResolvedDetails, error)
- func (r *Resolver) ResolveConfigMapReferences(ctx context.Context, refs set.Set[genruntime.NamespacedConfigMapReference]) (genruntime.Resolved[genruntime.ConfigMapReference, string], error)
- func (r *Resolver) ResolveOwner(ctx context.Context, obj genruntime.ARMOwnedMetaObject) (OwnerDetails, error)
- func (r *Resolver) ResolveReference(ctx context.Context, ref genruntime.NamespacedResourceReference) (genruntime.ARMMetaObject, error)
- func (r *Resolver) ResolveReferenceToARMID(ctx context.Context, ref genruntime.NamespacedResourceReference) (string, error)
- func (r *Resolver) ResolveReferencesToARMIDs(ctx context.Context, refs map[genruntime.NamespacedResourceReference]struct{}) (genruntime.Resolved[genruntime.ResourceReference, string], error)
- func (r *Resolver) ResolveResourceConfigMapReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.Resolved[genruntime.ConfigMapReference, string], error)
- func (r *Resolver) ResolveResourceHierarchy(ctx context.Context, obj genruntime.ARMMetaObject) (ResourceHierarchy, error)
- func (r *Resolver) ResolveResourceReferences(ctx context.Context, metaObject genruntime.ARMMetaObject) (genruntime.Resolved[genruntime.ResourceReference, string], error)
- func (r *Resolver) ResolveResourceSecretMapReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.Resolved[genruntime.SecretMapReference, map[string]string], error)
- func (r *Resolver) ResolveResourceSecretReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.Resolved[genruntime.SecretReference, string], error)
- func (r *Resolver) ResolveSecretMapReferences(ctx context.Context, refs set.Set[genruntime.NamespacedSecretMapReference]) (genruntime.Resolved[genruntime.SecretMapReference, map[string]string], error)
- func (r *Resolver) ResolveSecretReferences(ctx context.Context, refs set.Set[genruntime.NamespacedSecretReference]) (genruntime.Resolved[genruntime.SecretReference, string], error)
- func (r *Resolver) Scheme() *runtime.Scheme
- type ResourceHierarchy
- type ResourceHierarchyRoot
- type SecretMapResolver
- type SecretResolver
Constants ¶
const ( // OwnerFoundKubernetes indicates the owner was found in Kubernetes. OwnerFoundKubernetes = ResolveOwnerResult("OwnerFoundKubernetes") // OwnerFoundARM indicates the owner is an ARM ID. The resource the ARM ID points to may or may not exist in Azure currently. OwnerFoundARM = ResolveOwnerResult("OwnerFoundARM") // OwnerNotExpected indicates that this resource is not expected to have any owner. (Example: ResourceGroup) OwnerNotExpected = ResolveOwnerResult("OwnerNotExpected") )
const ( ResourceHierarchyRootResourceGroup = ResourceHierarchyRoot("ResourceGroup") ResourceHierarchyRootSubscription = ResourceHierarchyRoot("Subscription") ResourceHierarchyRootTenant = ResourceHierarchyRoot("Tenant") ResourceHierarchyRootARMID = ResourceHierarchyRoot("ARMID") ResourceHierarchyRootOverride = ResourceHierarchyRoot("Override") )
const ( ResourceGroupKind = "ResourceGroup" ResourceGroupGroup = "resources.azure.com" )
If we wanted to type-assert we'd have to solve some circular dependency problems... for now this is ok.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigMapResolver ¶
type ConfigMapResolver interface { ResolveConfigMapReference(ctx context.Context, ref genruntime.NamespacedConfigMapReference) (string, error) ResolveConfigMapReferences(ctx context.Context, refs set.Set[genruntime.NamespacedConfigMapReference]) (genruntime.Resolved[genruntime.ConfigMapReference, string], error) }
ConfigMapResolver is a configmap resolver
func NewKubeConfigMapResolver ¶
func NewKubeConfigMapResolver(client kubeclient.Client) ConfigMapResolver
type OwnerDetails ¶
type OwnerDetails struct { Result ResolveOwnerResult Owner genruntime.ARMMetaObject ARMID string }
func OwnerDetailsFromARM ¶
func OwnerDetailsFromARM(armID string) OwnerDetails
func OwnerDetailsFromKubernetes ¶
func OwnerDetailsFromKubernetes(owner genruntime.ARMMetaObject) OwnerDetails
func OwnerDetailsNotExpected ¶
func OwnerDetailsNotExpected() OwnerDetails
func (OwnerDetails) FoundKubernetesOwner ¶
func (det OwnerDetails) FoundKubernetesOwner() bool
type ResolveOwnerResult ¶
type ResolveOwnerResult string
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(client kubeclient.Client) *Resolver
func (*Resolver) IndexStorageTypes ¶
func (r *Resolver) IndexStorageTypes(scheme *runtime.Scheme, objs []*registration.StorageType) error
func (*Resolver) ResolveAll ¶
func (r *Resolver) ResolveAll(ctx context.Context, metaObject genruntime.ARMMetaObject) (ResourceHierarchy, genruntime.ConvertToARMResolvedDetails, error)
ResolveAll resolves every reference on the provided genruntime.ARMMetaObject. This includes: owner, all resource references, and all secrets.
func (*Resolver) ResolveConfigMapReferences ¶
func (r *Resolver) ResolveConfigMapReferences( ctx context.Context, refs set.Set[genruntime.NamespacedConfigMapReference], ) (genruntime.Resolved[genruntime.ConfigMapReference, string], error)
ResolveConfigMapReferences resolves all provided secret references
func (*Resolver) ResolveOwner ¶
func (r *Resolver) ResolveOwner(ctx context.Context, obj genruntime.ARMOwnedMetaObject) (OwnerDetails, error)
ResolveOwner returns an OwnerDetails describing more information about the owner of the provided resource. If the resource is supposed to have an owner but doesn't, this returns an ReferenceNotFound error. If the resource is not supposed to have an owner (for example, ResourceGroup) or the owner points to a raw ARM ID this returns an OwnerDetails with the OwnerDetails.Result set appropriately.
func (*Resolver) ResolveReference ¶
func (r *Resolver) ResolveReference(ctx context.Context, ref genruntime.NamespacedResourceReference) (genruntime.ARMMetaObject, error)
ResolveReference resolves a reference, or returns an error if the reference is not pointing to a KubernetesResource
func (*Resolver) ResolveReferenceToARMID ¶
func (r *Resolver) ResolveReferenceToARMID(ctx context.Context, ref genruntime.NamespacedResourceReference) (string, error)
ResolveReferenceToARMID gets a references ARM ID. If the reference is just pointing to an ARM resource then the ARMID is returned. If the reference is pointing to a Kubernetes resource, that resource is looked up and its ARM ID is computed.
func (*Resolver) ResolveReferencesToARMIDs ¶
func (r *Resolver) ResolveReferencesToARMIDs(ctx context.Context, refs map[genruntime.NamespacedResourceReference]struct{}) (genruntime.Resolved[genruntime.ResourceReference, string], error)
ResolveReferencesToARMIDs resolves all provided references to their ARM IDs.
func (*Resolver) ResolveResourceConfigMapReferences ¶
func (r *Resolver) ResolveResourceConfigMapReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.Resolved[genruntime.ConfigMapReference, string], error)
ResolveResourceConfigMapReferences resolves the specified genruntime.MetaObject's configmap references.
func (*Resolver) ResolveResourceHierarchy ¶
func (r *Resolver) ResolveResourceHierarchy(ctx context.Context, obj genruntime.ARMMetaObject) (ResourceHierarchy, error)
ResolveResourceHierarchy gets the resource hierarchy for a given resource. The result is a slice of resources, with the uppermost parent at position 0 and the resource itself at position len(slice)-1. Note that there is NO GUARANTEE that this hierarchy is "complete". It may root up to a resource which uses the ARMID field of owner.
func (*Resolver) ResolveResourceReferences ¶
func (r *Resolver) ResolveResourceReferences(ctx context.Context, metaObject genruntime.ARMMetaObject) (genruntime.Resolved[genruntime.ResourceReference, string], error)
ResolveResourceReferences resolves every reference found on the specified genruntime.ARMMetaObject to its corresponding ARM ID.
func (*Resolver) ResolveResourceSecretMapReferences ¶
func (r *Resolver) ResolveResourceSecretMapReferences( ctx context.Context, metaObject genruntime.MetaObject, ) (genruntime.Resolved[genruntime.SecretMapReference, map[string]string], error)
ResolveResourceSecretMapReferences resolves all the specified genruntime.MetaObject's secret maps.
func (*Resolver) ResolveResourceSecretReferences ¶
func (r *Resolver) ResolveResourceSecretReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.Resolved[genruntime.SecretReference, string], error)
ResolveResourceSecretReferences resolves all of the specified genruntime.MetaObject's secret references.
func (*Resolver) ResolveSecretMapReferences ¶
func (r *Resolver) ResolveSecretMapReferences( ctx context.Context, refs set.Set[genruntime.NamespacedSecretMapReference], ) (genruntime.Resolved[genruntime.SecretMapReference, map[string]string], error)
ResolveSecretMapReferences resolves all provided secret map references
func (*Resolver) ResolveSecretReferences ¶
func (r *Resolver) ResolveSecretReferences( ctx context.Context, refs set.Set[genruntime.NamespacedSecretReference], ) (genruntime.Resolved[genruntime.SecretReference, string], error)
ResolveSecretReferences resolves all provided secret references
type ResourceHierarchy ¶
type ResourceHierarchy []genruntime.ARMMetaObject
func (ResourceHierarchy) AzureName ¶
func (h ResourceHierarchy) AzureName() string
AzureName returns the Azure name for use in creating a resource.
func (ResourceHierarchy) FullyQualifiedARMID ¶
func (h ResourceHierarchy) FullyQualifiedARMID(subscriptionID string) (string, error)
TODO: It's a bit awkward that this takes a subscriptionID parameter but does nothing with it in the tenant scope case FullyQualifiedARMID returns the fully qualified ARM ID of the resource
func (ResourceHierarchy) Location ¶
func (h ResourceHierarchy) Location() (string, error)
Location returns the location root of the hierarchy, or an error if the root is not a subscription.
func (ResourceHierarchy) ResourceGroup ¶
func (h ResourceHierarchy) ResourceGroup() (string, error)
ResourceGroup returns the resource group that the hierarchy is in, or an error if the hierarchy is not rooted in a resource group.
type ResourceHierarchyRoot ¶
type ResourceHierarchyRoot string
type SecretMapResolver ¶
type SecretMapResolver interface { // ResolveSecretMapReference takes a secret reference and returns the actual secret values. ResolveSecretMapReference( ctx context.Context, ref genruntime.NamespacedSecretMapReference, ) (map[string]string, error) // ResolveSecretMapReferences takes a collection of secret references and returns a map of ref -> value // for each secret reference. ResolveSecretMapReferences( ctx context.Context, refs set.Set[genruntime.NamespacedSecretMapReference], ) (genruntime.Resolved[genruntime.SecretMapReference, map[string]string], error) }
SecretMapResolver is a secret collection resolver
func NewKubeSecretMapResolver ¶
func NewKubeSecretMapResolver(client kubeclient.Client) SecretMapResolver
type SecretResolver ¶
type SecretResolver interface { ResolveSecretReference(ctx context.Context, ref genruntime.NamespacedSecretReference) (string, error) ResolveSecretReferences(ctx context.Context, refs set.Set[genruntime.NamespacedSecretReference]) (genruntime.Resolved[genruntime.SecretReference, string], error) }
SecretResolver is a secret resolver
func NewKubeSecretResolver ¶
func NewKubeSecretResolver(client kubeclient.Client) SecretResolver