tkgconfigbom

package
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 Imports: 17 Imported by: 0

Documentation

Overview

Package tkgconfigbom provides utilities to read and manipulate BOM files

Package tkgconfigbom provides utilities to read and manipulate BOM files

Index

Constants

View Source
const (
	TKGCorePackages                  = "tkg-core-packages"
	KappControllerPackageImagePrefix = "kapp-controller"
)

Variables

This section is empty.

Functions

func GetFullImagePath

func GetFullImagePath(image *ImageInfo, baseImageRepository string) string

GetFullImagePath return full image path with repository

func GetK8sVersionFromTkrBoM

func GetK8sVersionFromTkrBoM(bomConfig *BOMConfiguration) (string, error)

GetK8sVersionFromTkrBoM returns k8s version from TKr BoM file

func GetTKRBOMImageTagNameFromTKRVersion

func GetTKRBOMImageTagNameFromTKRVersion(tkrVersion string) string

GetTKRBOMImageTagNameFromTKRVersion returns TKr BOM InageTag Name from TKr Version

Types

type AMIInfo

type AMIInfo struct {
	ID       string                 `yaml:"id"`
	OSInfo   OSInfo                 `yaml:"osinfo"`
	Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}

AMIInfo defines the struct for AWS AMI information

type AWSVMImages

type AWSVMImages map[string][]AMIInfo

AWSVMImages defines the collection of AMI imformation

type AzureInfo

type AzureInfo struct {
	// Using Image ID
	ID string `json:"id" yaml:"id"`

	// Marketplace image
	Publisher       string `json:"publisher" yaml:"publisher"`
	Offer           string `json:"offer" yaml:"offer"`
	Sku             string `json:"sku" yaml:"sku"`
	ThirdPartyImage bool   `json:"thirdPartyImage" yaml:"thirdPartyImage,omitempty"`

	// Shared Gallery image
	ResourceGroup  string `json:"resourceGroup" yaml:"resourceGroup"`
	Name           string `json:"name" yaml:"name"`
	SubscriptionID string `json:"subscriptionID" yaml:"subscriptionID"`
	Gallery        string `json:"gallery" yaml:"gallery"`

	// Applies to both Shared Gallery and Marketplace images
	Version string `json:"version" yaml:"version"`

	// Os Info of the vm image mentioned
	OSInfo OSInfo `json:"osinfo" yaml:"osinfo"`

	Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}

AzureInfo defines the struct for Azure VM Image information

type BOMConfiguration

type BOMConfiguration struct {
	Default               *defaultInfo                `yaml:"default"`
	Release               *ReleaseInfo                `yaml:"release"`
	Components            map[string][]*ComponentInfo `yaml:"components"`
	KindKubeadmConfigSpec []string                    `yaml:"kindKubeadmConfigSpec"`
	KubeadmConfigSpec     *kubeadmConfig              `yaml:"kubeadmConfigSpec"`
	OVA                   []*ovaInfo                  `yaml:"ova"`
	AMI                   map[string][]AMIInfo        `yaml:"ami,omitempty"`
	Azure                 []AzureInfo                 `yaml:"azure,omitempty"`
	ImageConfig           *imageConfig                `yaml:"imageConfig"`
	Extensions            map[string]*extensionInfo   `yaml:"extensions,omitempty"`
	TKRBOM                *tkrBOMInfo                 `yaml:"tkr-bom"`
	TKRCompatibility      *tkrCompatibilityInfo       `yaml:"tkr-compatibility"`
	TKRPackageRepo        *tkrPackageRepo             `yaml:"tkr-package-repo"`
	TKRPackage            *tkrPackage                 `yaml:"tkr-package"`

	ProvidersVersionMap map[string]string
}

BOMConfiguration defines the struct to represent BOM information

func (*BOMConfiguration) GetOVAVersions

func (b *BOMConfiguration) GetOVAVersions() []string

GetOVAVersions returns the list of OVA versions from TKR BOM

type BomNotPresent

type BomNotPresent struct {
	// contains filtered or unexported fields
}

BomNotPresent is an error type to return when BOM is not present locally

func NewBomNotPresent

func NewBomNotPresent(message string) BomNotPresent

NewBomNotPresent returns a struct of type BomNotPresent

func (BomNotPresent) Error

func (e BomNotPresent) Error() string

type Client

type Client interface {
	// GetBOMConfigurationFromTkrVersion gets BoM configuration based on TKr version
	GetBOMConfigurationFromTkrVersion(tkrVersion string) (*BOMConfiguration, error)
	// GetDefaultBOMConfiguration reads BOM file from ~/.tkg/bom/${TKGDefaultBOMFileName} location
	GetDefaultTkgBOMConfiguration() (*BOMConfiguration, error)
	GetDefaultTkrBOMConfiguration() (*BOMConfiguration, error)
	// GetDefaultClusterAPIProviders return default cluster api providers from BOM file
	// return sequence: coreProvider, bootstrapProvider, controlPlaneProvider, error
	GetDefaultClusterAPIProviders() (string, string, string, error)
	// GetDefaultK8sVersion return default k8s version from BOM file
	GetDefaultK8sVersion() (string, error)
	// GetK8sVersionFromTkrVersion returns k8s version from TKr version
	GetK8sVersionFromTkrVersion(tkrVersion string) (string, error)
	// GetDefaultTKGReleaseVersion return default tkg release version from BOM file
	GetDefaultTKGReleaseVersion() (string, error)
	// GetAvailableK8sVersionsFromBOMFiles returns list of supported K8s versions parsing BOM files
	GetAvailableK8sVersionsFromBOMFiles() ([]string, error)
	// GetCurrentTKGVersion returns current TKG CLI version
	GetCurrentTKGVersion() string
	GetCustomRepository() (string, error)
	IsCustomRepositorySkipTLSVerify() bool
	GetAutoscalerImageForK8sVersion(k8sVersion string) (string, error)
	// Downloads the default BOM files from the registry
	DownloadDefaultBOMFilesFromRegistry(bomRepo string, bomRegistry registry.Registry) error
	// Downloads the TKG Compatibility file from the registry
	DownloadTKGCompatibilityFileFromRegistry(repo string, resource string, bomRegistry registry.Registry) error
	// Initializes the registry for downloading the bom files
	InitBOMRegistry() (registry.Registry, error)
	// GetDefaultTKRVersion return default TKr version from default TKG BOM file
	GetDefaultTKRVersion() (string, error)
	// GetDefaultBoMFilePath returns path of default BoM file
	GetDefaultBoMFilePath() (string, error)
	// GetDefaultBoMFileName returns name of default BoM file
	GetDefaultBoMFileName() (string, error)
	// GetManagementPackageRepositoryImage returns management package repository image
	GetManagementPackageRepositoryImage() (string, error)
	// GetManagementPackagesVersion returns version of management packages
	GetManagementPackagesVersion() (string, error)
	// GetKappControllerPackageImage returns kapp-controller package image
	GetKappControllerPackageImage() (string, error)
}

Client implements TKG configuration updater functions

func New

func New(configDir string, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter) Client

New creates new tkg configuration bom client

type ComponentInfo

type ComponentInfo struct {
	Version  string                 `yaml:"version"`
	Images   map[string]*ImageInfo  `yaml:"images,omitempty"`
	Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}

ComponentInfo represents a BOM components information

type DNSAddOnType

type DNSAddOnType string

DNSAddOnType defines string identifying DNS add-on types

type ImageInfo

type ImageInfo struct {
	ImagePath       string `yaml:"imagePath"`
	Tag             string `yaml:"tag"`
	ImageRepository string `yaml:"imageRepository"`
}

ImageInfo defines the struct for the container images in BOM

type ManagementClusterPluginVersion

type ManagementClusterPluginVersion struct {
	Version                 string                    `yaml:"version"`
	SupportedTKGBOMVersions []TKGSupportedBOMVersions `yaml:"supportedTKGBomVersions"`
}

ManagementClusterPluginVersion contains management cluster plugin version and the supported TKG BOM versions.

type OSInfo

type OSInfo struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
	Arch    string `yaml:"arch"`
}

OSInfo defines the struct for OS information

type ReleaseInfo

type ReleaseInfo struct {
	Version string `yaml:"version"`
}

ReleaseInfo represents the release version information

type TKGCompatibilityMetadata

type TKGCompatibilityMetadata struct {
	Version                         string                           `yaml:"version"`
	ManagementClusterPluginVersions []ManagementClusterPluginVersion `yaml:"managementClusterPluginVersions"`
}

TKGCompatibilityMetadata contains Tanzu CLI supported TKG BOM version matrix

type TKGSupportedBOMVersions

type TKGSupportedBOMVersions struct {
	ImagePath string `yaml:"imagePath"`
	ImageTag  string `yaml:"tag"`
}

TKGSupportedBOMVersions contains ImagePath and Tag name of supported BOM.

Jump to

Keyboard shortcuts

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