declcfg

package
v2.0.0-...-f0a61fb Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToModel

func ConvertToModel(cfg DeclarativeConfig) (model.Model, error)

func WalkFS

func WalkFS(root fs.FS, walkFn WalkFunc) error

WalkFS walks root using a gitignore-style filename matcher to skip files that match patterns found in .indexignore files found throughout the filesystem. It calls walkFn for each declarative config file it finds. If WalkFS encounters an error loading or parsing any file, the error will be immediately returned.

func WriteJSON

func WriteJSON(cfg DeclarativeConfig, w io.Writer) error

func WriteYAML

func WriteYAML(cfg DeclarativeConfig, w io.Writer) error

Types

type Bundle

type Bundle struct {
	Schema        string              `json:"schema"`
	Name          string              `json:"name"`
	Package       string              `json:"package"`
	Image         string              `json:"image"`
	Properties    []property.Property `json:"properties,omitempty" hash:"set"`
	RelatedImages []RelatedImage      `json:"relatedImages,omitempty" hash:"set"`

	// These fields are present so that we can continue serving
	// the GRPC API the way packageserver expects us to in a
	// backwards-compatible way. These are populated from
	// any `olm.bundle.object` properties.
	//
	// These fields will never be persisted in the bundle blob as
	// first class fields.
	CsvJSON string   `json:"-"`
	Objects []string `json:"-"`
}

Bundle specifies all metadata and data of a bundle object. Top-level fields are the source of truth, i.e. not CSV values.

Notes:

  • Any field slice type field or type containing a slice somewhere where two types/fields are equal if their contents are equal regardless of order must have a `hash:"set"` field tag for bundle comparison.
  • Any fields that have a `json:"-"` tag must be included in the equality evaluation in bundlesEqual().

type Channel

type Channel struct {
	Schema     string              `json:"schema"`
	Name       string              `json:"name"`
	Package    string              `json:"package"`
	Entries    []ChannelEntry      `json:"entries"`
	Properties []property.Property `json:"properties,omitempty" hash:"set"`
}

type ChannelEntry

type ChannelEntry struct {
	Name      string   `json:"name"`
	Replaces  string   `json:"replaces,omitempty"`
	Skips     []string `json:"skips,omitempty"`
	SkipRange string   `json:"skipRange,omitempty"`
}

type DeclarativeConfig

type DeclarativeConfig struct {
	Packages []Package
	Channels []Channel
	Bundles  []Bundle
	Others   []Meta
}

func ConvertFromModel

func ConvertFromModel(mpkgs model.Model) DeclarativeConfig

func LoadFS

func LoadFS(root fs.FS) (*DeclarativeConfig, error)

LoadFS loads a declarative config from the provided root FS. LoadFS walks the filesystem from root and uses a gitignore-style filename matcher to skip files that match patterns found in .indexignore files found throughout the filesystem. If LoadFS encounters an error loading or parsing any file, the error will be immediately returned.

type DiffGenerator

type DiffGenerator struct {
	Logger *logrus.Entry

	// SkipDependencies directs Run() to not include dependencies
	// of bundles included in the diff if true.
	SkipDependencies bool
	// Includer for adding catalog objects to Run() output.
	Includer DiffIncluder
	// IncludeAdditively catalog objects specified in Includer in headsOnly mode.
	IncludeAdditively bool
	// contains filtered or unexported fields
}

DiffGenerator configures how diffs are created via Run().

func (*DiffGenerator) Run

func (g *DiffGenerator) Run(oldModel, newModel model.Model) (model.Model, error)

Run returns a Model containing a subset of catalog objects in newModel: - If g.Includer contains objects:

  • If g.IncludeAdditively is false, a diff will be generated only on those objects, depending on the mode.
  • If g.IncludeAdditionally is true, the diff will contain included objects, plus those added by the mode.

- If in heads-only mode (oldModel == nil), then the heads of channels are added to the output. - If in latest mode, a diff between old and new Models is added to the output. - Dependencies are added in all modes if g.SkipDependencies is false.

type DiffIncludeChannel

type DiffIncludeChannel struct {
	// Name of channel.
	Name string
	// Versions of bundles.
	Versions []semver.Version
	// Bundles are bundle names to include.
	// Set this field only if the named bundle has no semantic version metadata.
	Bundles []string
}

DiffIncludeChannel specifies a channel, and optionally bundles and bundle versions to include.

type DiffIncludePackage

type DiffIncludePackage struct {
	// Name of package.
	Name string
	// Channels in package.
	Channels []DiffIncludeChannel
	// AllChannels contains bundle versions in package.
	// Upgrade graphs from all channels in the named package containing a version
	// from this field are included.
	AllChannels DiffIncludeChannel
}

DiffIncludePackage specifies a package, and optionally channels or a set of bundles from all channels (wrapped by a DiffIncludeChannel), to include.

type DiffIncluder

type DiffIncluder struct {
	// Packages to add.
	Packages []DiffIncludePackage
	Logger   *logrus.Entry
}

DiffIncluder knows how to add packages, channels, and bundles from a source to a destination model.Model.

func (DiffIncluder) Run

func (i DiffIncluder) Run(newModel, outputModel model.Model) error

Run adds all packages and channels in DiffIncluder with matching names directly, and all versions plus their upgrade graphs to channel heads, from newModel to outputModel.

type Icon

type Icon struct {
	Data      []byte `json:"base64data"`
	MediaType string `json:"mediatype"`
}

type Meta

type Meta struct {
	Schema  string
	Package string

	Blob json.RawMessage
}

func (Meta) MarshalJSON

func (m Meta) MarshalJSON() ([]byte, error)

func (*Meta) UnmarshalJSON

func (m *Meta) UnmarshalJSON(blob []byte) error

type Package

type Package struct {
	Schema         string              `json:"schema"`
	Name           string              `json:"name"`
	DefaultChannel string              `json:"defaultChannel"`
	Icon           *Icon               `json:"icon,omitempty"`
	Description    string              `json:"description,omitempty"`
	Properties     []property.Property `json:"properties,omitempty" hash:"set"`
}

type RelatedImage

type RelatedImage struct {
	Name  string `json:"name"`
	Image string `json:"image"`
}

type WalkFunc

type WalkFunc func(path string, cfg *DeclarativeConfig, err error) error

Jump to

Keyboard shortcuts

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