Documentation ¶
Overview ¶
Package xpkg contains utilities for building and linting UXP packages.
Index ¶
- Constants
- func BuildPath(path, name string) string
- func FindXpkgInDir(fs afero.Fs, root string) (string, error)
- func FriendlyID(name, hash string) string
- func IsCRD(o runtime.Object) error
- func IsComposition(o runtime.Object) error
- func IsConfiguration(o runtime.Object) error
- func IsFunction(o runtime.Object) error
- func IsMutatingWebhookConfiguration(o runtime.Object) error
- func IsProvider(o runtime.Object) error
- func IsValidatingWebhookConfiguration(o runtime.Object) error
- func IsXRD(o runtime.Object) error
- func Label(annotation string) string
- func Layer(r io.Reader, fileName, annotation string, fileSize int64, mode os.FileMode, ...) (v1.Layer, error)
- func NewConfigurationLinter() linter.Linter
- func NewFunctionLinter() linter.Linter
- func NewProviderLinter() linter.Linter
- func OneMeta(pkg linter.Package) error
- func PackageValidSemver(o runtime.Object) error
- func ReplaceExt(path, ext string) string
- func SkipContains(pattern string) parser.FilterFn
- func ToDNSLabel(s string) string
- func ValidDep(pkg string) (bool, error)
- type AuthExtension
- type BuildOpt
- type Builder
- type Image
- type ImageMeta
- type InitContext
- type Option
- type Package
- type Writer
Constants ¶
const ( // JSONStreamFile is the name of the file in local Crossplane package // that contains the JSON stream representation of the Crossplane package. JSONStreamFile string = "package.ndjson" // MetaFile is the name of a Crossplane package metadata file. MetaFile string = "crossplane.yaml" // StreamFile is the name of the file in a Crossplane package image that // contains its YAML stream. StreamFile string = "package.yaml" // StreamFileMode determines the permissions on the stream file. StreamFileMode os.FileMode = 0o644 // XpkgExtension is the extension for compiled Crossplane packages. XpkgExtension string = ".xpkg" // XpkgMatchPattern is the match pattern for identifying compiled Crossplane // packages. XpkgMatchPattern string = "*" + XpkgExtension // XpkgExamplesFile is the name of the file in a Crossplane package image // that contains the examples YAML stream. XpkgExamplesFile string = ".up/examples.yaml" // AnnotationKey is the key value for xpkg annotations. AnnotationKey string = "io.crossplane.xpkg" // PackageAnnotation is the annotation value used for the package.yaml // layer. PackageAnnotation string = "base" // ExamplesAnnotation is the annotation value used for the examples.yaml // layer. ExamplesAnnotation string = "upbound" )
const (
ProviderConfigKind = "ProviderConfig"
)
Variables ¶
This section is empty.
Functions ¶
func BuildPath ¶
BuildPath builds a path for a compiled Crossplane package. If file name has extension it will be replaced.
func FindXpkgInDir ¶
FindXpkgInDir finds compiled Crossplane packages in a directory.
func FriendlyID ¶
FriendlyID builds a valid DNS label string made up of the name of a package and its image digest.
func IsComposition ¶
IsComposition checks that an object is a Composition.
func IsConfiguration ¶
IsConfiguration checks that an object is a Configuration meta type.
func IsFunction ¶ added in v0.25.0
IsFunction checks that an object is a Function meta type.
func IsMutatingWebhookConfiguration ¶ added in v0.25.0
IsMutatingWebhookConfiguration checks that an object is a MutatingWebhookConfiguration.
func IsProvider ¶
IsProvider checks that an object is a Provider meta type.
func IsValidatingWebhookConfiguration ¶ added in v0.25.0
IsValidatingWebhookConfiguration checks that an object is a MutatingWebhookConfiguration.
func Layer ¶ added in v0.25.0
func Layer(r io.Reader, fileName, annotation string, fileSize int64, mode os.FileMode, cfg *v1.Config) (v1.Layer, error)
Layer creates a v1.Layer that represetns the layer contents for the xpkg and adds a corresponding label to the image Config for the layer.
func NewConfigurationLinter ¶
NewConfigurationLinter is a convenience function for creating a package linter for configurations.
func NewFunctionLinter ¶ added in v0.25.0
NewFunctionLinter is a convenience function for creating a package linter for functions.
func NewProviderLinter ¶
NewProviderLinter is a convenience function for creating a package linter for providers.
func PackageValidSemver ¶
PackageValidSemver checks that the package uses valid semver ranges.
func ReplaceExt ¶ added in v0.25.0
ReplaceExt replaces the file extension of the given path.
func SkipContains ¶ added in v0.25.0
SkipContains supplies a FilterFn that skips paths that contain the give pattern.
func ToDNSLabel ¶
ToDNSLabel converts the string to a valid DNS label.
Types ¶
type AuthExtension ¶ added in v0.25.0
type AuthExtension struct { Version string `yaml:"version"` Discriminant string `yaml:"discriminant"` Sources []struct { Name string `yaml:"name"` Docs string `yaml:"docs"` AdditionalResources []struct { Type string `yaml:"type"` Ref string `yaml:"ref"` } `yaml:"additionalResources"` ShowFields []string `yaml:"showFields"` } `yaml:"sources"` }
type BuildOpt ¶ added in v0.25.0
type BuildOpt func(*buildOpts)
A BuildOpt modifies how a package is built.
func WithController ¶ added in v0.25.0
WithController sets the controller image that should serve as the base for the package.
type Builder ¶ added in v0.25.0
type Builder struct {
// contains filtered or unexported fields
}
Builder defines an xpkg Builder.
type ImageMeta ¶ added in v0.25.0
type ImageMeta struct { Repo string `json:"repo"` Registry string `json:"registry"` Version string `json:"version"` Digest string `json:"digest"` }
ImageMeta contains metadata information about the Package Image.
type InitContext ¶ added in v0.25.0
type InitContext struct { // Name of the package Name string // Controller Image (only applicable to Provider packages) CtrlImage string // Crossplane version this package is compatible with XPVersion string // Dependencies for this package DependsOn []metav1.Dependency }
InitContext defines the details we're interested in for populating a meta file.
type Option ¶ added in v0.25.0
type Option func(*Writer)
Option modifies the Writer.
func WithFileBody ¶ added in v0.25.0
WithFileBody specifies the file body that is used to populate the new meta file.
type Package ¶ added in v0.25.0
type Package string
Package represents the types of packages we support.
type Writer ¶ added in v0.25.0
type Writer struct {
// contains filtered or unexported fields
}
Writer defines a writer that is used for creating package meta files.
func NewFileWriter ¶ added in v0.25.0
NewFileWriter returns a new Writer.
func (*Writer) NewMetaFile ¶ added in v0.25.0
NewMetaFile creates a new meta file per the given options.