resolver

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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")
)
View Source
const (
	ResourceHierarchyRootResourceGroup = ResourceHierarchyRoot("ResourceGroup")
	ResourceHierarchyRootSubscription  = ResourceHierarchyRoot("Subscription")
	ResourceHierarchyRootTenant        = ResourceHierarchyRoot("Tenant")
	ResourceHierarchyRootARMID         = ResourceHierarchyRoot("ARMID")
	ResourceHierarchyRootOverride      = ResourceHierarchyRoot("Override")
)
View Source
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 added in v2.3.0

type OwnerDetails struct {
	Result ResolveOwnerResult
	Owner  genruntime.ARMMetaObject
	ARMID  string
}

func OwnerDetailsFromARM added in v2.3.0

func OwnerDetailsFromARM(armID string) OwnerDetails

func OwnerDetailsFromKubernetes added in v2.3.0

func OwnerDetailsFromKubernetes(owner genruntime.ARMMetaObject) OwnerDetails

func OwnerDetailsNotExpected added in v2.3.0

func OwnerDetailsNotExpected() OwnerDetails

func (OwnerDetails) FoundKubernetesOwner added in v2.3.0

func (det OwnerDetails) FoundKubernetesOwner() bool

type ResolveOwnerResult added in v2.3.0

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

ResolveAll resolves every reference on the provided genruntime.ARMMetaObject. This includes: owner, all resource references, and all secrets.

func (*Resolver) ResolveConfigMapReferences

ResolveConfigMapReferences resolves all provided secret references

func (*Resolver) ResolveOwner

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

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 added in v2.6.0

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 added in v2.6.0

ResolveSecretMapReferences resolves all provided secret map references

func (*Resolver) ResolveSecretReferences

ResolveSecretReferences resolves all provided secret references

func (*Resolver) Scheme

func (r *Resolver) Scheme() *runtime.Scheme

Scheme returns the current scheme from our client

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 added in v2.6.0

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 added in v2.6.0

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

Jump to

Keyboard shortcuts

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