resolver

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package resolver provides the implementation of the TKR resolver.

Example
package main

import (
	"k8s.io/apimachinery/pkg/labels"

	"github.com/vmware-tanzu/tanzu-framework/pkg/v2/tkr/resolver"
	"github.com/vmware-tanzu/tanzu-framework/pkg/v2/tkr/resolver/data"
)

func main() {
	tkrResolver := resolver.New()

	k8sVersionPrefix := "1.22"
	tkrSelector, _ := labels.Parse("!deprecated")
	osImageSelector, _ := labels.Parse("os-name=ubuntu,ami-region=us-west-2")

	query := data.Query{
		ControlPlane: &data.OSImageQuery{
			K8sVersionPrefix: k8sVersionPrefix,
			TKRSelector:      tkrSelector,
			OSImageSelector:  osImageSelector,
		},
		MachineDeployments: []*data.OSImageQuery{
			{
				K8sVersionPrefix: k8sVersionPrefix,
				TKRSelector:      tkrSelector,
				OSImageSelector:  osImageSelector,
			},
		},
	}

	result := tkrResolver.Resolve(query)

	println("KubernetesVersion", result.ControlPlane.K8sVersion)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Add TanzuKubernetesRelease or OSImage objects to the resolver cache.
	Add(objects ...interface{})

	// Remove TanzuKubernetesRelease or OSImage objects from the resolver cache.
	Remove(objects ...interface{})

	// Get an object by name and obj type.
	Get(name string, obj interface{}) interface{}
}

Cache holds TKRs and OSImages to be used by the Resolver.

type CachingResolver

type CachingResolver interface {
	Resolver
	Cache
}

CachingResolver combines Resolver and Cache (for convenience).

func New

func New() CachingResolver

New returns a newly created instance of the TKR CachingResolver implementation. It is safe for concurrent use.

type Resolver

type Resolver interface {
	// Resolve returns TKRs and OSImages satisfying query constraints.
	Resolve(query data.Query) data.Result
}

Resolver resolves TKRs and OSImages.

Directories

Path Synopsis
Package data provides data types for the TKR Resolver.
Package data provides data types for the TKR Resolver.
Package internal contains the implementation of the TKR Resolver.
Package internal contains the implementation of the TKR Resolver.

Jump to

Keyboard shortcuts

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