client

package
v0.4.0-rc5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package client has been copied from kubectl code almost verbatim Some methods have been moved from k/k into the utils.go file to remove the dependency on K/K https://github.com/kubernetes/kubernetes/blob/v1.13.1/pkg/kubectl/cmd/apply/apply.go

Index

Constants

View Source
const LastAppliedAnnotation = "faros.pusher.com/last-applied-configuration"

LastAppliedAnnotation is the annotation name used by faros for the last applied config

Variables

This section is empty.

Functions

This section is empty.

Types

type Applier

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

Applier is a client that can perform a three-way-merge Based on the `kubectl apply` command

func NewApplier

func NewApplier(config *rest.Config, options Options) (*Applier, error)

NewApplier constucts a new Applier client

func (*Applier) Apply

func (a *Applier) Apply(ctx context.Context, opts *ApplyOptions, modified runtime.Object) error

Apply performs a strategic three way merge update to the resource if it exists, else it creates the resource

type ApplyOptions

type ApplyOptions struct {
	Overwrite           *bool // Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration
	ForceDeletion       *bool
	CascadeDeletion     *bool
	DeletionTimeout     *time.Duration
	DeletionGracePeriod *int
	ServerDryRun        *bool
}

ApplyOptions defines the possible options for the Apply command

func (*ApplyOptions) Complete

func (a *ApplyOptions) Complete()

Complete defaults valus within the ApplyOptions struct

type Client

type Client interface {
	Apply(context.Context, *ApplyOptions, runtime.Object) error
}

Client defines the interface for the Applier

type Options

type Options struct {
	// Scheme, if provided, will be used to map go structs to GroupVersionKinds
	Scheme *runtime.Scheme

	// Mapper, if provided, will be used to map GroupVersionKinds to Resources
	Mapper meta.RESTMapper
}

Options are creation options for a Applier

type Patcher

type Patcher struct {
	Mapping       *meta.RESTMapping
	Helper        *resource.Helper
	DynamicClient dynamic.Interface

	Overwrite bool
	BackOff   clockwork.Clock

	Force        bool
	Cascade      bool
	Timeout      time.Duration
	GracePeriod  int
	ServerDryRun bool

	// If set, forces the patch against a specific resourceVersion
	ResourceVersion *string

	// Number of retries to make if the patch fails with conflict
	Retries int

	OpenapiSchema openapi.Resources
}

Patcher is used to perform a three-way-merge on runtime.Objects

func (*Patcher) Patch

func (p *Patcher) Patch(current runtime.Object, modified []byte, source, namespace, name string, errOut io.Writer) ([]byte, runtime.Object, error)

Patch performs a strategic three way merge patch on the given object.

Current should be the runtime.Object as fetched from the API Modified is the current desired state as raw JSON source is the filename of the original resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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