filters

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterPackagesKind defines the kind used by the ClusterPackages resource.
	ClusterPackagesKind = "ClusterPackages"
	// ClusterPackagesGroup defines the group used by the ClusterPackages resource.
	ClusterPackagesGroup = "kpt.seek.com"
	// ClusterPackagesVersion defines the version used by the ClusterPackages resource.
	ClusterPackagesVersion = "v1alpha1"
	// ClusterPackagesAPIVersion defines the aggregate group/version used by the ClusterPackages resource.
	ClusterPackagesAPIVersion = ClusterPackagesGroup + "/" + ClusterPackagesVersion

	// SetByClusterOverride defines the set-by value used when Kpt packages setters are set by cluster-level variables.
	SetByClusterOverride = "cluster-override"
	// SetByPackageOverride defines the set-by value used when Kpt packages setters are set by package-level variables.
	SetByPackageOverride = "package-override"

	// AuthSockEnvVar defines the name of the environment variable to use to populate the auth socket to be used for
	// Git authentication via ssh agent. This auth socket should be bind mounted into the docker container that executes
	// this filter
	AuthSockEnvVar = "SSH_AUTH_SOCK"

	// HTTPSScheme defines the scheme that identifies https based repo urls
	HTTPSScheme = "https"
)

Variables

This section is empty.

Functions

func KptfileFilter

func KptfileFilter() kio.Filter

KptfileFilter provides a kio.Filter that returns only resource nodes that correspond to Kptfiles.

func NotKptfileFilter

func NotKptfileFilter() kio.Filter

NotKptfileFilter inverts KptfileFilter.

Types

type AuthMethod added in v0.0.3

type AuthMethod string

AuthMethod is a method of authenticating to Git repositories

const (
	AuthMethodKeyFile   AuthMethod = "keyFile"
	AuthMethodKeySecret AuthMethod = "keySecret"
	AuthMethodSSHAgent  AuthMethod = "sshAgent"
	AuthMethodNone      AuthMethod = "none"
)

type ClusterPackages

type ClusterPackages struct {
	// Standard Kubernetes metadata.
	yaml.ResourceMeta `json:",inline" yaml:",inline"`
	// Spec provides the resource specification.
	Spec ClusterPackagesSpec `yaml:"spec,omitempty"`
}

ClusterPackages defines the "client-side CRD" that is managed by the ClusterPackagesFilter. When the ClusterPackagesFilter sees a resource that matches this type, it transforms it into a stream of resources that consists of all of the resources contained in the referenced Kpt packages.

type ClusterPackagesFilter

type ClusterPackagesFilter struct {
	// CacheDir specifies a directory that is used by the filter to cache Git repositories.
	CacheDir string
	// GitPrivateKey specifies the the private key to use for Git.
	GitPrivateKey []byte
	// Logger specifies the logger to be used by the filter.
	Logger zerolog.Logger
	// AuthMethod specifies the method to use for authenticating to Git repositories
	AuthMethod AuthMethod
}

ClusterPackagesFilter defines a kio.Filter that processes ClusterPackages custom resources.

func (*ClusterPackagesFilter) Filter

func (f *ClusterPackagesFilter) Filter(input []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements kio.Filter.Filter.

type ClusterPackagesSpec

type ClusterPackagesSpec struct {
	// BaseDir specifies the base directory that packages should be written to.
	BaseDir string `yaml:"baseDir,omitempty"`
	// Variables specifies the list of cluster-level variable definitions. Kpt packages referenced in the
	// Packages list may define setters with these names and have their values overridden when they are fetched.
	Variables []Variable `yaml:"variables,omitempty"`
	// Packages specifies the list of Kpt packages that are installed by this cluster.
	Packages []Package `yaml:"packages,omitempty"`
}

ClusterPackagesSpec defines the main body of the ClusterPackages resource.

type HashDependencyFilter

type HashDependencyFilter struct {
	// Logger specifies the logger to be used by the filter.
	Logger zerolog.Logger
}

func (*HashDependencyFilter) Filter

func (dh *HashDependencyFilter) Filter(input []*yaml.RNode) ([]*yaml.RNode, error)

type Package

type Package struct {
	// Name specifies the name of the package. This name will be combined with the ClusterPackagesSpec.BaseDir
	// to form the directory that this package should be written to.
	Name string `yaml:"name,omitempty"`
	// Git specifies the upstream Git reference information for the package.
	Git kptfile.Git `yaml:"git,omitempty"`
	// Variables specifies the list of package-level variable definitions. In the case that a package has a setter
	// whose value is specified by both cluster-level and package-level variables, the package-level value will be used.
	Variables []Variable `yaml:"variables,omitempty"`
}

Package defines a Kpt package dependency.

type SetPackageFilter

type SetPackageFilter struct {
	// Name is the name of the setter.
	Name string
	// Value is the single value of the setter.
	Value string
	// ListValue is the list value of the setter.
	ListValues []string
	// SetBy specifies who executed the setter.
	SetBy string
}

SetPackageFilter provides a kio.Filter implementation that executes a setter on Kpt packages. On each invocation of the Filter function, SetPackageFilter expects to be given a single Kpt package, where exactly one of the resource nodes pertains to the Kptfile.

func (*SetPackageFilter) Filter

func (f *SetPackageFilter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements kio.Filter.

type TemplateContext

type TemplateContext struct {
	Values map[string]interface{}
}

TemplateContext provides the template context that provides all of the values that may be accessed within templated YAML values.

type TemplateFilter

type TemplateFilter struct{}

TemplateFilter provides a Kyaml filter that processes Kubernetes resources and renders the scalar node values as Go templates. The function config for this filter specifies Kptfiles whose setters are read to become the template context. On each invocation of the Filter function, SetPackageFilter expects to be given a single Kpt package, where exactly one of the resource nodes pertains to the Kptfile.

func (*TemplateFilter) Filter

func (f *TemplateFilter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements Kyaml's yaml.Filter.

type UpdatePathFilter

type UpdatePathFilter struct {
	// Func is the transformation function applied to the existing path annotation.
	Func func(string) (string, error)
}

UpdatePathFilter is a kio.Filter that performs a transformation on the `config.kubernetes.io/path` annotation of resource nodes. This can be used to change the path that resources will be written to.

func (*UpdatePathFilter) Filter

func (f *UpdatePathFilter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements kio.Filter.

type Variable

type Variable struct {
	// Name defines the setter key.
	Name string `yaml:"name,omitempty"`
	// Value defines the setter value.
	Value string `yaml:"value,omitempty"`
}

Variable defines the value for a Kpt package setter.

Jump to

Keyboard shortcuts

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