manifest

package
v1.39.18 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigConnectorResourceSelector = []GroupKindSelector{

	&wildcardGroupKind{Group: regexp.MustCompile(`([[:alpha:]]+\.)+cnrm\.cloud\.google\.com`)},
}

ConfigConnectorResourceSelector provides a resource selector for Google Cloud Config Connector resources See https://cloud.google.com/config-connector/docs/overview

View Source
var ManifestTmpDir = filepath.Join(os.TempDir(), manifestsStagingFolder)
View Source
var TransformAllowlist = map[apimachinery.GroupKind]latest.ResourceFilter{
	{Group: "", Kind: "Pod"}: {
		GroupKind: "Pod",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "", Kind: "Service"}: {
		GroupKind: "Service",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "apps", Kind: "DaemonSet"}: {
		GroupKind: "DaemonSet.apps",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "apps", Kind: "Deployment"}: {
		GroupKind: "Deployment.apps",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "apps", Kind: "ReplicaSet"}: {
		GroupKind: "ReplicaSet.apps",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "apps", Kind: "StatefulSet"}: {
		GroupKind: "StatefulSet.apps",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "batch", Kind: "CronJob"}: {
		GroupKind: "CronJob.batch",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "batch", Kind: "Job"}: {
		GroupKind: "Job.batch",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "extensions", Kind: "DaemonSet"}: {
		GroupKind: "DaemonSet.extensions",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "extensions", Kind: "Deployment"}: {
		GroupKind: "Deployment.extensions",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "extensions", Kind: "ReplicaSet"}: {
		GroupKind: "ReplicaSet.extensions",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "serving.knative.dev", Kind: "Service"}: {
		GroupKind: "Service.serving.knative.dev",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "agones.dev", Kind: "Fleet"}: {
		GroupKind: "Fleet.agones.dev",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "agones.dev", Kind: "GameServer"}: {
		GroupKind: "GameServer.agones.dev",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "argoproj.io", Kind: "Rollout"}: {
		GroupKind: "Rollout.argoproj.io",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "argoproj.io", Kind: "Workflow"}: {
		GroupKind: "Workflow.argoproj.io",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "argoproj.io", Kind: "CronWorkflow"}: {
		GroupKind: "CronWorkflow.argoproj.io",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "argoproj.io", Kind: "WorkflowTemplate"}: {
		GroupKind: "WorkflowTemplate.argoproj.io",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "argoproj.io", Kind: "ClusterWorkflowTemplate"}: {
		GroupKind: "ClusterWorkflowTemplate.argoproj.io",
		Image:     []string{".*"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "Connect"}: {
		GroupKind: "Connect.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "ControlCenter"}: {
		GroupKind: "ControlCenter.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "Kafka"}: {
		GroupKind: "Kafka.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "KsqlDB"}: {
		GroupKind: "KsqlDB.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "SchemaRegistry"}: {
		GroupKind: "SchemaRegistry.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
	{Group: "platform.confluent.io", Kind: "Zookeeper"}: {
		GroupKind: "Zookeeper.platform.confluent.io",
		Image:     []string{".spec.image.application", ".spec.image.init"},
		Labels:    []string{".*"},
	},
}

TransformAllowlist is the default allowlist of kinds that can be transformed by Skaffold.

View Source
var TransformDenylist = map[apimachinery.GroupKind]latest.ResourceFilter{
	{Group: "apps", Kind: "StatefulSet"}: {
		GroupKind: "StatefulSet.apps",
		Labels:    []string{".spec.volumeClaimTemplates.metadata.labels"},
	},
}

TransformDenylist is the default denylist on the set of kinds that can be transformed by Skaffold.

Functions

func AddTransform

func AddTransform(newTransform Transform)

AddTransform adds a transform to be applied when deploying.

func DownloadFromGCS

func DownloadFromGCS(manifests []string) (string, error)

DownloadFromGCS downloads all provided manifests from a remote GCS bucket, and returns a relative path pointing to the GCS temp dir.

func Write

func Write(manifests string, output string, manifestOut io.Writer) error

Write writes manifests to a file, a writer or a GCS bucket.

Types

type FieldVisitor

type FieldVisitor interface {
	// Visit is called for each transformable key contained in the object and may apply transformations/aggregations on it.
	// It should return true to allow recursive traversal or false when the entry was transformed.
	Visit(gk apimachinery.GroupKind, navpath string, object map[string]interface{}, key string, value interface{}, rs ResourceSelector) bool
}

FieldVisitor represents the aggregation/transformation that should be performed on each traversed field.

type GroupKindSelector added in v1.34.1

type GroupKindSelector interface {
	Matches(group, kind string) bool
}

type ManifestList

type ManifestList [][]byte

ManifestList is a list of yaml manifests.

func ApplyTransforms

func ApplyTransforms(manifests ManifestList, builds []graph.Artifact, insecureRegistries map[string]bool, debugHelpersRegistry string) (ManifestList, error)

ApplyTransforms applies all manifests transforms to the provided manifests.

func Load

func Load(in io.Reader) (ManifestList, error)

Load uses the Kubernetes `apimachinery` to split YAML content into a set of YAML documents.

func (*ManifestList) Append

func (l *ManifestList) Append(buf []byte)

Append appends the yaml manifests defined in the given buffer. `buf` can contain concatenated manifests without `---` separators because `kubectl create --dry-run -oyaml` produces such output.

func (*ManifestList) CollectNamespaces

func (l *ManifestList) CollectNamespaces() ([]string, error)

CollectNamespaces returns all the namespaces in the manifests.

func (*ManifestList) Diff

func (l *ManifestList) Diff(latest ManifestList) ManifestList

Diff computes the list of manifests that have changed.

func (*ManifestList) Filter added in v1.34.1

func (l *ManifestList) Filter(selectors ...GroupKindSelector) (ManifestList, error)

Filter returns the manifest list that match any of the given `GroupKindSelector` items

func (*ManifestList) GetImages

func (l *ManifestList) GetImages(rs ResourceSelector) ([]graph.Artifact, error)

GetImages gathers a map of base image names to the image with its tag

func (*ManifestList) Reader

func (l *ManifestList) Reader() io.Reader

Reader returns a reader on the raw yaml descriptors.

func (*ManifestList) ReplaceImages

func (l *ManifestList) ReplaceImages(ctx context.Context, builds []graph.Artifact, rs ResourceSelector) (ManifestList, error)

ReplaceImages replaces image names in a list of manifests. It doesn't replace images that are referenced by digest.

func (*ManifestList) ReplaceRemoteManifestImages added in v1.30.0

func (l *ManifestList) ReplaceRemoteManifestImages(ctx context.Context, builds []graph.Artifact, rs ResourceSelector) (ManifestList, error)

ReplaceRemoteManifestImages replaces all image names in a list containing remote manifests. This will even override images referenced by digest or with a different repository

func (*ManifestList) SelectResources added in v1.34.1

func (l *ManifestList) SelectResources(selectors ...GroupKindSelector) ([]unstructured.Unstructured, error)

SelectResources returns the resources defined in the manifest list that match any of the given `GroupKindSelector` items

func (*ManifestList) SetLabels

func (l *ManifestList) SetLabels(labels map[string]string, rs ResourceSelector) (ManifestList, error)

SetLabels add labels to a list of Kubernetes manifests.

func (*ManifestList) String

func (l *ManifestList) String() string

func (*ManifestList) Visit

func (l *ManifestList) Visit(visitor FieldVisitor, rs ResourceSelector) (ManifestList, error)

Visit recursively visits all transformable object fields within the manifests and lets the visitor apply transformations/aggregations on them.

type Registries

type Registries struct {
	InsecureRegistries   map[string]bool
	DebugHelpersRegistry string
}

type ResourceSelector added in v1.37.0

type ResourceSelector interface {
	// contains filtered or unexported methods
}

type ResourceSelectorImages added in v1.37.0

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

func NewResourceSelectorImages added in v1.37.0

func NewResourceSelectorImages(allowlist map[apimachinery.GroupKind]latest.ResourceFilter, denylist map[apimachinery.GroupKind]latest.ResourceFilter) *ResourceSelectorImages

type ResourceSelectorLabels added in v1.37.0

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

func NewResourceSelectorLabels added in v1.37.0

func NewResourceSelectorLabels(allowlist map[apimachinery.GroupKind]latest.ResourceFilter, denylist map[apimachinery.GroupKind]latest.ResourceFilter) *ResourceSelectorLabels

type Transform

type Transform func(l ManifestList, builds []graph.Artifact, registries Registries) (ManifestList, error)

func GetTransforms

func GetTransforms() []Transform

GetTransforms returns all manifest transforms.

Jump to

Keyboard shortcuts

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