kptfile

package
v0.39.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Overview

Package pkgfile contains functions for working with KptFile instances.

Index

Constants

View Source
const (
	KptFileName       = "Kptfile"
	KptFileGroup      = "kpt.dev"
	KptFileVersion    = "v1alpha1"
	KptFileAPIVersion = KptFileGroup + "/" + KptFileVersion
)

KptFileName is the name of the KptFile

Variables

View Source
var TypeMeta = yaml.ResourceMeta{
	TypeMeta: yaml.TypeMeta{
		APIVersion: KptFileAPIVersion,
		Kind:       KptFileName,
	},
}

TypeMeta is the TypeMeta for KptFile instances.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Name            string `yaml:"name,omitempty"`
	Upstream        `yaml:",inline,omitempty"`
	EnsureNotExists bool       `yaml:"ensureNotExists,omitempty"`
	Strategy        string     `yaml:"updateStrategy,omitempty"`
	Functions       []Function `yaml:"functions,omitempty"`
	AutoSet         bool       `yaml:"autoSet,omitempty"`
}

type Function

type Function struct {
	Config yaml.Node `yaml:"config,omitempty"`
	Image  string    `yaml:"image,omitempty"`
}

type Functions

type Functions struct {
	// AutoRunStarlark will cause starlark functions to automatically be run.
	AutoRunStarlark bool `yaml:"autoRunStarlark,omitempty"`

	// StarlarkFunctions is a list of starlark functions to run
	StarlarkFunctions []StarlarkFunction `yaml:"starlarkFunctions,omitempty"`
}

type Git

type Git struct {
	// Commit is the git commit that the package was fetched at
	Commit string `yaml:"commit,omitempty"`

	// Repo is the git repository the package was cloned from.  e.g. https://
	Repo string `yaml:"repo,omitempty"`

	// RepoDirectory is the sub directory of the git repository that the package was cloned from
	Directory string `yaml:"directory,omitempty"`

	// Ref is the git ref the package was cloned from
	Ref string `yaml:"ref,omitempty"`
}

Git contains information on the origin of packages cloned from a git repository.

type Inventory

type Inventory struct {
	Namespace string `yaml:"namespace,omitempty"`
	Name      string `yaml:"name,omitempty"`
	// Unique label to identify inventory object in cluster.
	InventoryID string            `yaml:"inventoryID,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

Inventory encapsulates the parameters for the inventory object. All of the the parameters are required if any are set.

type KptFile

type KptFile struct {
	yaml.ResourceMeta `yaml:",inline"`

	// CloneFrom records where the package was originally cloned from
	Upstream Upstream `yaml:"upstream,omitempty"`

	// PackageMeta contains information about the package
	PackageMeta PackageMeta `yaml:"packageMetadata,omitempty"`

	Dependencies []Dependency `yaml:"dependencies,omitempty"`

	// OpenAPI contains additional schema for the resources in this package
	// Uses interface{} instead of Node to work around yaml serialization issues
	// See https://github.com/go-yaml/yaml/issues/518 and
	// https://github.com/go-yaml/yaml/issues/575
	OpenAPI interface{} `yaml:"openAPI,omitempty"`

	// Functions contains configuration for running functions
	Functions Functions `yaml:"functions,omitempty"`

	// Parameters for inventory object.
	Inventory *Inventory `yaml:"inventory,omitempty"`
}

KptFile contains information about a package managed with kpt

func (*KptFile) MergeOpenAPI

func (updatedKf *KptFile) MergeOpenAPI(localKf, originalKf KptFile) error

MergeOpenAPI adds the OpenAPI definitions from localKf to updatedKf. It takes originalKf as a reference for 3-way merge This function is very complex due to serialization issues with yaml.Node.

type OriginType

type OriginType string

OriginType defines the type of origin for a package

const (
	// GitOrigin specifies a package as having been cloned from a git repository
	GitOrigin   OriginType = "git"
	StdinOrigin OriginType = "stdin"
)

type PackageMeta

type PackageMeta struct {
	// URL is the location of the package.  e.g. https://github.com/example/com
	URL string `yaml:"url,omitempty"`

	// Email is the email of the package maintainer
	Email string `yaml:"email,omitempty"`

	// License is the package license
	License string `yaml:"license,omitempty"`

	// Version is the package version
	Version string `yaml:"version,omitempty"`

	// Tags can be indexed and are metadata about the package
	Tags []string `yaml:"tags,omitempty"`

	// Man is the path to documentation about the package
	Man string `yaml:"man,omitempty"`

	// ShortDescription contains a short description of the package.
	ShortDescription string `yaml:"shortDescription,omitempty"`
}

type StarlarkFunction

type StarlarkFunction struct {
	// Name is the name that will be given to the program
	Name string `yaml:"name,omitempty"`
	// Path is the path to the *.star script to run
	Path string `yaml:"path,omitempty"`
}

type Stdin

type Stdin struct {
	FilenamePattern string `yaml:"filenamePattern,omitempty"`

	Original string `yaml:"original,omitempty"`
}

type Upstream

type Upstream struct {
	// Type is the type of origin.
	Type OriginType `yaml:"type,omitempty"`

	// Git contains information on the origin of packages cloned from a git repository.
	Git Git `yaml:"git,omitempty"`

	Stdin Stdin `yaml:"stdin,omitempty"`
}

Upstream defines where a package was cloned from

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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