provider

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// labels
	LabelManagedBy          = "pipecd.dev/managed-by"            // Always be piped.
	LabelPiped              = "pipecd.dev/piped"                 // The id of piped handling this application.
	LabelApplication        = "pipecd.dev/application"           // The application this resource belongs to.
	LabelSyncReplace        = "pipecd.dev/sync-by-replace"       // Use replace instead of apply.
	LabelForceSyncReplace   = "pipecd.dev/force-sync-by-replace" // Use replace --force instead of apply.
	LabelCommitHash         = "pipecd.dev/commit-hash"           // Hash value of the deployed commit.
	LabelResourceKey        = "pipecd.dev/resource-key"          // The resource key generated by apiVersion, namespace and name. e.g. apps/v1/Deployment/namespace/demo-app
	LabelOriginalAPIVersion = "pipecd.dev/original-api-version"  // The api version defined in git configuration. e.g. apps/v1

	// annotations
	AnnotationOrder = "pipecd.dev/order" // The order number of resource used to sort them before using.

	// label/annotation values
	ManagedByPiped    = "piped"
	UseReplaceEnabled = "enabled"
)
View Source
const (
	KindDeployment = "Deployment"
	KindSecret     = "Secret"
	KindConfigMap  = "ConfigMap"

	DefaultNamespace = "default"
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func Diff

func Diff(old, new Manifest, logger *zap.Logger, opts ...diff.Option) (*diff.Result, error)

func IsKubernetesBuiltInResource

func IsKubernetesBuiltInResource(apiVersion string) bool

Types

type Helm

type Helm struct {
	// contains filtered or unexported fields
}

func NewHelm

func NewHelm(path string, logger *zap.Logger) *Helm

func (*Helm) TemplateLocalChart

func (h *Helm) TemplateLocalChart(ctx context.Context, appName, appDir, namespace, chartPath string, opts *config.InputHelmOptions) (string, error)

type Kustomize

type Kustomize struct {
	// contains filtered or unexported fields
}

func NewKustomize

func NewKustomize(path string, logger *zap.Logger) *Kustomize

func (*Kustomize) Template

func (c *Kustomize) Template(ctx context.Context, appName, appDir string, opts map[string]string) (string, error)

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func (*Loader) LoadManifests

func (l *Loader) LoadManifests(ctx context.Context, input LoaderInput) (manifests []Manifest, err error)

type LoaderInput

type LoaderInput struct {
	// for annotations to manage the application live state.
	PipedID    string
	CommitHash string
	AppID      string

	// for templating manifests
	AppName        string
	AppDir         string
	ConfigFilename string
	Manifests      []string

	Namespace        string
	TemplatingMethod TemplatingMethod

	KustomizeVersion string
	KustomizeOptions map[string]string

	HelmVersion string
	HelmChart   *config.InputHelmChart
	HelmOptions *config.InputHelmOptions

	Logger *zap.Logger
}

type Manifest

type Manifest struct {
	Key  ResourceKey
	Body *unstructured.Unstructured
}

Manifest represents a Kubernetes resource manifest.

func LoadManifestsFromYAMLFile

func LoadManifestsFromYAMLFile(path string) ([]Manifest, error)

LoadManifestsFromYAMLFile loads the manifests from the given file.

func LoadPlainYAMLManifests

func LoadPlainYAMLManifests(dir string, names []string, configFilename string) ([]Manifest, error)

func ParseManifests

func ParseManifests(data string) ([]Manifest, error)

ParseManifests parses the given data and returns a list of Manifest.

func (Manifest) AddAnnotations

func (m Manifest) AddAnnotations(annotations map[string]string)

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ResourceKey

type ResourceKey struct {
	APIVersion string
	Kind       string
	Namespace  string
	Name       string
}

func MakeResourceKey

func MakeResourceKey(obj *unstructured.Unstructured) ResourceKey

func (ResourceKey) IsConfigMap

func (k ResourceKey) IsConfigMap() bool

func (ResourceKey) IsSecret

func (k ResourceKey) IsSecret() bool

func (ResourceKey) ReadableString

func (k ResourceKey) ReadableString() string

func (ResourceKey) String

func (k ResourceKey) String() string

type TemplatingMethod

type TemplatingMethod string
const (
	TemplatingMethodHelm      TemplatingMethod = "helm"
	TemplatingMethodKustomize TemplatingMethod = "kustomize"
	TemplatingMethodNone      TemplatingMethod = "none"
)

type ToolRegistry

type ToolRegistry interface {
	Kustomize(ctx context.Context, version string) (string, error)
	Helm(ctx context.Context, version string) (string, error)
}

Jump to

Keyboard shortcuts

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