bom

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: UPL-1.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindKV

func FindKV(kvs []KeyValue, key string) string

FindKV searches an array of KeyValue structs for a Key and returns the Value if found, or returns an empty string

Types

type Bom

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

Bom contains information related to the bill of materials along with structures to process it. The bom file is verrazzano-bom.json and it mainly has image information.

func NewBOMFromJSON added in v1.4.0

func NewBOMFromJSON(jsonBom []byte) (Bom, error)

NewBOMFromJSON Create a new BOM instance from a JSON payload

func NewBom

func NewBom(bomPath string) (Bom, error)

Create a new BOM instance from a JSON file

func (*Bom) BuildImageOverrides

func (b *Bom) BuildImageOverrides(subComponentName string) ([]KeyValue, error)

BuildImageOverrides builds the image overrides array for the subComponent. Each override has an array of 1-n Helm Key:Value pairs

func (*Bom) BuildImageStrings added in v1.3.0

func (b *Bom) BuildImageStrings(subComponentName string) ([]KeyValue, []string, error)

BuildImageStrings builds the image overrides array for the subComponent. Each override has an array of 1-n Helm Key:Value pairs Also return the set of fully constructed image names

func (*Bom) FindImage added in v1.5.0

func (b *Bom) FindImage(subcomponentName, imageName string) (BomImage, error)

func (*Bom) GetComponent added in v1.4.0

func (b *Bom) GetComponent(componentName string) (*BomComponent, error)

GetComponent gets the BOM component

func (*Bom) GetComponentVersion added in v1.5.0

func (b *Bom) GetComponentVersion(componentName string) (string, error)

func (*Bom) GetImageNameList added in v1.3.0

func (b *Bom) GetImageNameList(subComponentName string) ([]string, error)

GetImageNameList build the image names and return a list of image names

func (*Bom) GetRegistry

func (b *Bom) GetRegistry() string

GetRegistry Gets the registry name

func (*Bom) GetSubcomponent

func (b *Bom) GetSubcomponent(subComponentName string) (*BomSubComponent, error)

GetSubcomponent gets the bom subcomponent

func (*Bom) GetSubcomponentImageCount

func (b *Bom) GetSubcomponentImageCount(subComponentName string) int

GetSubcomponentImageCount returns the number of subcomponent images

func (*Bom) GetSubcomponentImages

func (b *Bom) GetSubcomponentImages(subComponentName string) ([]BomImage, error)

GetSubcomponentImages the imageBoms for a subcomponent

func (*Bom) GetSupportedKubernetesVersion added in v1.5.0

func (b *Bom) GetSupportedKubernetesVersion() []string

GetSupportedKubernetesVersion gets supported Kubernetes versions

func (*Bom) GetVersion

func (b *Bom) GetVersion() string

GetVersion gets the BOM product version

func (*Bom) ResolveRegistry

func (b *Bom) ResolveRegistry(sc *BomSubComponent, img BomImage) string

ResolveRegistry resolves the registry name using the ENV var if it exists.

func (*Bom) ResolveRepo

func (b *Bom) ResolveRepo(sc *BomSubComponent, img BomImage) string

ResolveRepo resolves the repository name using the ENV var if it exists.

type BomComponent

type BomComponent struct {
	// The name of the component, for example: Istio
	Name string `json:"name"`
	// Version of the component
	Version string `json:"version,omitempty"`
	// SubComponents is the array of subcomponents in the component
	SubComponents []BomSubComponent `json:"subcomponents"`
}

BomComponent represents a high level component, such as Istio. Each component has one or more subcomponents.

type BomDoc

type BomDoc struct {
	// Registry is the top level registry URI which contains the image repositories.
	// An example is ghcr.io
	Registry string `json:"registry"`

	// Version is the verrazzano version corresponding to the build
	Version string `json:"version"`

	// Components is the array of component boms
	Components []BomComponent `json:"components"`

	// SupportedKubernetesVersions is the array of supported Kubernetes versions
	SupportedKubernetesVersions []string `json:"supportedKubernetesVersions"`
}

BomDoc contains product metadata for components installed by Verrazzano. Currently, this metadata only describes images and image repositories. This information is needed by the helm charts and used during install/upgrade.

type BomImage

type BomImage struct {
	// ImageName specifies the name of the image tag, such as `nginx-ingress-controller`
	ImageName string `json:"image"`

	// ImageTag specifies the name of the image tag, such as `0.46.0-20210510134749-abc2d2088`
	ImageTag string `json:"tag"`

	// Registry is the image registry. It can be used to override the subcomponent registry
	Registry string `json:"registry,omitempty"`

	// Repository is the image repository. It can be used to override the subcomponent repository
	Repository string `json:"repository,omitempty"`

	// HelmRegistryKey is the helm template Key which identifies the registry for an image.  An example is
	// `image.registry` in external-dns.  The default is empty string.
	HelmRegistryKey string `json:"helmRegKey"`

	// HelmRepoKey is the helm template Key which stores the value of the repository for an image.
	HelmRepoKey string `json:"helmRepoKey"`

	// HelmImageKey is the helm template Key which identifies the base image name, without the registry or parent repo
	// parts of the path.  For example, if the full image name is myreg.io/foo/bar/myimage:v1.0, the value of this key
	// will be "myimage".  See the Istio proxyv2 entry in the BOM file for an example.
	HelmImageKey string `json:"helmImageKey"`

	// HelmTagKey is the helm template Key which stores the value of the image tag.  For example,
	// if the full image name is myreg.io/foo/bar/myimage:v1.0, the value of this key will be "v1.0"
	HelmTagKey string `json:"helmTagKey"`

	// HelmFullImageKey is the helm path Key which identifies the image name without the registry or tag.  For example,
	// if the full image name is myreg.io/foo/bar/myimage:v1.0, the value of this key will be
	// "foo/bar/myimage".
	HelmFullImageKey string `json:"helmFullImageKey"`

	// HelmRegistryAndRepoKey is a helm Key which stores the registry and repo parts of the image path.  For example,
	// if the full image name is myreg.io/foo/bar/myimage:v1.0 the value of this key will be "myreg.io/foo/bar".
	// See `image.repository` in the external-dns component
	HelmRegistryAndRepoKey string `json:"helmRegistryAndRepoKey"`
}

BomImage describes a single image used by one of the helm charts. This structure is needed to render the helm chart manifest, so the image fields are correctly populated in the resulting YAML. There is no helm standard which specifies the keys for image information used by a template, each product usually has a custom way to do this. The helm keys fields in this structure specify those custom keys.

type BomSubComponent

type BomSubComponent struct {
	Name string `json:"name"`

	// Repository is the name of the repository within a registry.  This is combined
	// with the registry Value to form the image URL prefix, for example: ghcr.io/verrazzano,
	// where ghci.io is the registry and Verrazzano is the repository name.
	Repository string `json:"repository"`

	// Override the registry within a subcomponent
	Registry string `json:"registry"`

	// Images is the array of images for this subcomponent
	Images []BomImage `json:"images"`
}

BomSubComponent contains the bom information for a single helm chart. Istio is an example of a component with several subcomponents.

type KeyValue

type KeyValue struct {
	Key       string
	Value     string
	SetString bool // for --set-string
	SetFile   bool // for --set-file
	IsFile    bool // for -f
}

keyVal defines the Key, Value pair used to override a single helm Value

Jump to

Keyboard shortcuts

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