apply

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 30 Imported by: 12

Documentation

Overview

Copyright Red Hat

Copyright Red Hat

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncMap

func FuncMap() template.FuncMap

ApplierFuncMap adds the function map

func GenericFuncMap

func GenericFuncMap() map[string]interface{}

GenericFuncMap returns a copy of the basic function map as a map[string]interface{}.

func NewResourceCache

func NewResourceCache() resourceapply.ResourceCache

func TemplateFuncMap

func TemplateFuncMap(tmpl *template.Template) (funcMap template.FuncMap)

TemplateFuncMap generates function map for "include"

func WriteOutput

func WriteOutput(fileName string, output []string) (err error)

Types

type Applier

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

func (Applier) Apply added in v1.2.2

func (a Applier) Apply(reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	files ...string) ([]string, error)

func (Applier) ApplyCustomResource

func (a Applier) ApplyCustomResource(
	reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	name string) (string, error)

ApplyCustomResource applies a custom resource

func (Applier) ApplyCustomResources

func (a Applier) ApplyCustomResources(
	reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	files ...string) ([]string, error)

ApplyCustomResources applies custom resources

func (Applier) ApplyDeployment

func (a Applier) ApplyDeployment(
	reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	name string) (string, error)

ApplyDeployment apply a deployment

func (Applier) ApplyDeployments

func (a Applier) ApplyDeployments(
	reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	files ...string) ([]string, error)

ApplyDeployments applies a appsv1.Deployment template

func (Applier) ApplyDirectly

func (a Applier) ApplyDirectly(
	reader asset.ScenarioReader,
	values interface{},
	dryRun bool,
	headerFile string,
	files ...string) ([]string, error)

ApplyDirectly applies standard kubernetes resources.

func (Applier) GetCache

func (a Applier) GetCache() resourceapply.ResourceCache

func (*Applier) GetFileInfo added in v1.2.2

func (a *Applier) GetFileInfo(reader asset.ScenarioReader,
	values interface{},
	headerFile string,
	files ...string) ([]FileInfo, error)

func (Applier) MustTemplateAsset

func (a Applier) MustTemplateAsset(reader asset.ScenarioReader,
	values interface{},
	headerFile, name string) ([]byte, error)

MustTemplateAsset generates textual output for a template file name. The headerfile will be added to each file. Usually it contains nested template definitions as described https://golang.org/pkg/text/template/#hdr-Nested_template_definitions This allows to add functions which can be use in each file. The values object will be used to render the template

func (Applier) MustTemplateAssets

func (a Applier) MustTemplateAssets(reader asset.ScenarioReader,
	values interface{},
	headerFile string,
	files ...string) ([]string, error)

MustTemplateAssets render list of files

func (*Applier) Sort added in v1.2.2

func (a *Applier) Sort(reader asset.ScenarioReader,
	values interface{},
	headerFile string,
	files ...string) ([]string, error)

func (Applier) WithCache added in v1.2.5

func (a Applier) WithCache(cache resourceapply.ResourceCache) Applier

WithCache set a the cache instead of using the default cache created on the Build()

func (Applier) WithClient added in v1.2.5

func (a Applier) WithClient(
	kubeClient kubernetes.Interface,
	apiExtensionsClient apiextensionsclient.Interface,
	dynamicClient dynamic.Interface) Applier

WithClient adds the several clients to the applier

func (Applier) WithContext added in v1.2.5

func (a Applier) WithContext(ctx context.Context) Applier

WithContext set a the cache instead of using the default cache created on the Build()

func (Applier) WithKindOrder added in v1.2.5

func (a Applier) WithKindOrder(kindsOrder KindsOrder) Applier

WithKindOrder defines the order in which the files must be applied.

func (Applier) WithOwner added in v1.2.5

func (a Applier) WithOwner(owner runtime.Object,
	blockOwnerDeletion,
	controller bool,
	scheme *runtime.Scheme) Applier

WithOwner add an ownerref to the object

func (Applier) WithRestConfig added in v1.2.5

func (a Applier) WithRestConfig(cfg *rest.Config) Applier

WithRestConfig adds the clients based on the provided rest.Config

func (Applier) WithTemplateFuncMap added in v1.2.5

func (a Applier) WithTemplateFuncMap(fm template.FuncMap) Applier

WithTemplateFuncMap add template.FuncMap to the applier.

type ApplierBuilder

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

ApplierBuilder a builder to build the applier

func NewApplierBuilder

func NewApplierBuilder() *ApplierBuilder

New ApplyBuilder

func (*ApplierBuilder) Build

func (a *ApplierBuilder) Build() Applier

Build returns the builded applier

func (*ApplierBuilder) GetAPIExtensionClient

func (a *ApplierBuilder) GetAPIExtensionClient() apiextensionsclient.Interface

func (*ApplierBuilder) GetDynamicClient

func (a *ApplierBuilder) GetDynamicClient() dynamic.Interface

func (*ApplierBuilder) GetKubeClient

func (a *ApplierBuilder) GetKubeClient() kubernetes.Interface

func (*ApplierBuilder) WithCache

WithCache set a the cache instead of using the default cache created on the Build()

func (*ApplierBuilder) WithClient

func (a *ApplierBuilder) WithClient(
	kubeClient kubernetes.Interface,
	apiExtensionsClient apiextensionsclient.Interface,
	dynamicClient dynamic.Interface) *ApplierBuilder

WithClient adds the several clients to the applier

func (*ApplierBuilder) WithContext

func (a *ApplierBuilder) WithContext(ctx context.Context) *ApplierBuilder

WithContext set a the cache instead of using the default cache created on the Build()

func (*ApplierBuilder) WithKindOrder added in v1.2.2

func (a *ApplierBuilder) WithKindOrder(kindsOrder KindsOrder) *ApplierBuilder

WithKindOrder defines the order in which the files must be applied.

func (*ApplierBuilder) WithOwner

func (a *ApplierBuilder) WithOwner(owner runtime.Object,
	blockOwnerDeletion,
	controller bool,
	scheme *runtime.Scheme) *ApplierBuilder

WithOwner add an ownerref to the object

func (*ApplierBuilder) WithRestConfig added in v1.2.5

func (a *ApplierBuilder) WithRestConfig(cfg *rest.Config) *ApplierBuilder

WithRestConfig adds the clients based on the provided rest.Config

func (*ApplierBuilder) WithTemplateFuncMap

func (a *ApplierBuilder) WithTemplateFuncMap(fm template.FuncMap) *ApplierBuilder

WithTemplateFuncMap add template.FuncMap to the applier.

type FileInfo added in v1.2.2

type FileInfo struct {
	FileName   string
	Kind       string
	Name       string
	Namespace  string
	APIVersion string
}

type KindsOrder added in v1.2.2

type KindsOrder []string

KindsOrder ...

var DefaultCreateUpdateKindsOrder KindsOrder = []string{
	"Namespace",
	"NetworkPolicy",
	"ResourceQuota",
	"LimitRange",
	"PodSecurityPolicy",
	"PodDisruptionBudget",
	"ServiceAccount",
	"Secret",
	"SecretList",
	"ConfigMap",
	"StorageClass",
	"PersistentVolume",
	"PersistentVolumeClaim",
	"CustomResourceDefinition",
	"ClusterRole",
	"ClusterRoleList",
	"ClusterRoleBinding",
	"ClusterRoleBindingList",
	"Role",
	"RoleList",
	"RoleBinding",
	"RoleBindingList",
	"Service",
	"DaemonSet",
	"Pod",
	"ReplicationController",
	"ReplicaSet",
	"Deployment",
	"HorizontalPodAutoscaler",
	"StatefulSet",
	"Job",
	"CronJob",
	"Ingress",
	"APIService",
}

DefaultKindsOrder the default order

var NoCreateUpdateKindsOrder KindsOrder = []string{}

Jump to

Keyboard shortcuts

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