tkr

module
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0

README

TKR Service

This is the top level directory for the TKR Service.

TKR Resolver Library

Usage:

import (
  "github.com/vmware-tanzu/tanzu-framework/tkr/resolver"
  "github.com/vmware-tanzu/tanzu-framework/tkr/resolver/data"
)

// skip ...

tkrResolver := resolver.New()
tkrResolver.Add( /* tkr1, tkr2, tkr3, osImage1, osImage2, osImage3 */)

// skip ...
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: map[string]data.OSImageQuery{
    "md1": {
      K8sVersionPrefix: k8sVersionPrefix,
      TKRSelector:      tkrSelector,
      OSImageSelector:  osImageSelector,
    },
  },
}

result := tkrResolver.Resolve(query)

The primary client of the Resolver package will be the TKR Resolver webhook on CAPI Cluster objects. This webhook will have two parts: the cache reconciler and the webhook handler.

The cache reconciler will list all TKRs and OSImages on initialization and populate the cache. It would then watch TKRs and OSImages and simply Add() or Remove() on incoming updates, thereby providing background cache refresh and invalidation.

This will make the webhook handler efficient by avoiding unnecessary work (fetching data and populating indexes) on every webhook request.

The provided CachingResolver implementation is safe for concurrent use.

Directories

Path Synopsis
controller
tkr-source/compatibility
Package compatibility provides the TKR Compatibility reconciler.
Package compatibility provides the TKR Compatibility reconciler.
tkr-source/constants
Package constants provides constant variables
Package constants provides constant variables
tkr-source/fetcher
Package fetcher provides implementation of the Fetcher component of the TKR Source Controller responsible for fetching TKR BOM, TKR compatibility and TKR package repository OCI images.
Package fetcher provides implementation of the Fetcher component of the TKR Source Controller responsible for fetching TKR BOM, TKR compatibility and TKR package repository OCI images.
tkr-source/pkgcr
Package pkgcr provides the TKR Package reconciler: it installs yet uninstalled TKR packages.
Package pkgcr provides the TKR Package reconciler: it installs yet uninstalled TKR packages.
tkr-source/registry
Package registry provides the Registry interface and implementation.
Package registry provides the Registry interface and implementation.
tkr-source/registry/internal/registry
Package registry defines a Registry interface and client for working for imkpkg images.
Package registry defines a Registry interface and client for working for imkpkg images.
tkr-status/clusterstatus
Package clusterstatus provides the reconciler for the Cluster UpdatesAvailable status controller.
Package clusterstatus provides the reconciler for the Cluster UpdatesAvailable status controller.
tkr-status/tkr
Package tkr provides the reconciler for the TKR labeling controller / TKR resolver cache refresher.
Package tkr provides the reconciler for the TKR labeling controller / TKR resolver cache refresher.
Package resolver provides the implementation of the TKR resolver.
Package resolver provides the implementation of the TKR resolver.
data
Package data provides data types for the TKR Resolver.
Package data provides data types for the TKR Resolver.
internal
Package internal contains the implementation of the TKR Resolver.
Package internal contains the implementation of the TKR Resolver.
util
osimage
Package osimage provides helper functions to work with OSImage data.
Package osimage provides helper functions to work with OSImage data.
resolution
Package resolution provides helper functions for TKR resolution, e.g.
Package resolution provides helper functions for TKR resolution, e.g.
webhook
cluster/tkr-resolver/cache
Package cache provides cache.Reconciler that updates the cache based on the watched objects' state.
Package cache provides cache.Reconciler that updates the cache based on the watched objects' state.
cluster/tkr-resolver/cluster
Package cluster provides the TKR Resolver mutating webhook on CAPI Cluster.
Package cluster provides the TKR Resolver mutating webhook on CAPI Cluster.

Jump to

Keyboard shortcuts

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