product

package
v0.0.0-...-7cac148 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package product provides the description and parser for the top-level product.meta file and the package.meta files that can be provided for individual components.

product.meta is a JSON file that lives in the root directory that describes the collections that make up automate. These collections can be base functionality, like postgres and elasticsearch, or things the user might want to deploy like workflow or chef-server. An example product.meta JSON blob:

{
	"packages": [
		"origin/pkg-core",
		"origin/svc-core",
		"origin/prod"
	],
	"collections": [
		{
			"name": "core",
			"type": "base",
			"services": [
				"origin/svc-core"
			],
			"packages": [
				"origin/pkg-core"
			]
		},
		{
			"name": "prod-1.0",
			"aliases": ["prod"],
			"type": "product",
			"dependencies": ["core"],
			"services": [
				"origin/prod"
			]
		}
	]
}

Additional information about the pkg-core package could be provided in a package.meta file if needed. For example, we may want to describe its binlinks:

{
	"name": "origin/pkg-core",
	"binlinks": ["core-cli"]
}

To see what metadata can be provided, see the PackageMetadata struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapSpec

type BootstrapSpec struct {
	Type       BootstrapType `json:"type"`
	Path       string        `json:"path,omitempty"`
	Optional   bool          `json:"optional"`
	SecretSpec string        `json:"secret_spec,omitempty"`
}

type BootstrapType

type BootstrapType string
const (
	BootstrapTypeFile   BootstrapType = "file"
	BootstrapTypeSecret BootstrapType = "secret"
)

type Collection

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

	// Aliases is a list of alternative names that can be used for the
	// collection. As an example, we might want to allow both chef-server
	// and chef-infra-server
	Aliases []string `json:"aliases"`

	// Type is one of base or product. Products can be deployed, where as
	// base collections can be included in other collections as deps
	Type CollectionType `json:"type"`

	// Services is the list of packages that will be deployed as services
	// for the collection.
	Services []PackageName `json:"services"`

	// Packages is a list of packages that are needed for this collection.
	// They will likely be providing binlinks for the user
	Packages []PackageName `json:"packages"`

	// Dependencies is a list of collections this collection depends on.
	Dependencies []string `json:"dependencies"`

	// Hidden allows adding collections that we don't want to present to the
	// user
	Hidden bool `json:"hidden"`
}

Collection is a group of services and packages that provide some desired functionality. For example, postgres requires 3 services to fully work in Automate: postgresql, a sidecar, and a tcp gateway. Collections can be of type base, meaning they are deployed as part of other collections. The other type is product, which allows them to be deployed by users (automate, chef-server, workflow, etc).

type CollectionType

type CollectionType string
const (
	// BaseType is a collection that may not be directly
	// deployed by the user. It provides a way to group
	// services which may be depended upon by other products.
	BaseType CollectionType = "base"

	// ProductType is a collection that can be deployed by the user.
	ProductType CollectionType = "product"
)

type DeletedPackage

type DeletedPackage struct {
	// Origin is the habitat origin this package belongs to
	Origin string
	// Name is the habitat name of the package
	Name string
	// Version is the habitat package version
	Version string
	// Release is the habitat build release
	Release string
}

DeletedPackage represents a deleted package or service and the last version and release.

func (*DeletedPackage) MarshalText

func (p *DeletedPackage) MarshalText() ([]byte, error)

func (DeletedPackage) String

func (p DeletedPackage) String() string

func (*DeletedPackage) UnmarshalText

func (p *DeletedPackage) UnmarshalText(text []byte) error

type Metadata

type Metadata struct {
	Packages        []*Package       `json:"packages"`
	DeletedPackages []DeletedPackage `json:"deleted_packages"`
	Collections     []*Collection    `json:"collections"`
}

Metadata is the top level metadata the describes the automate collections and its packages.

func Parse

func Parse(repoRootPath string) (*Metadata, error)

Parse parses the root level product.meta along with the package.meta files that may be provided by each component.

type Package

type Package struct {
	Name PackageName `json:"name"`

	Metadata *PackageMetadata `json:"metadata"`
}

Package represents a package/service along with its metadata

type PackageMetadata

type PackageMetadata struct {
	Name PackageName `json:"name"`

	// DataService is set to true if this service is a data service.
	// For example, postgres, elasticsearch, s3
	DataService bool `json:"data_service"`

	// A list of binaries to be binlinked when the package is deployed
	Binlinks []string `json:"binlinks"`

	// UsesPlatformScaffolding is set to true if the service uses the platform
	// scaffolding for config
	UsesPlatformScaffolding bool `json:"uses_platform_scaffolding"`

	Bootstrap []BootstrapSpec `json:"bootstrap"`
}

PackageMetadata is a set of metadata that components may optionally provide.

type PackageName

type PackageName struct {
	// Origin is the habitat origin this package belongs to
	Origin string
	// Name is the habitat name of the package
	Name string
}

PackageName represents a package or service by origin/name

func (*PackageName) MarshalText

func (p *PackageName) MarshalText() ([]byte, error)

func (PackageName) String

func (p PackageName) String() string

func (*PackageName) UnmarshalText

func (p *PackageName) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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