kubectl

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const DeploymentAppYAML = `apiVersion: v1
kind: Pod
metadata:
  name: leeroy-app
spec:
  containers:
    - name: leeroy-app
      image: leeroy-app`
View Source
const DeploymentAppYAMLv1 = `apiVersion: v1
kind: Pod
metadata:
  name: leeroy-app
spec:
  containers:
    - image: leeroy-app:v1
      name: leeroy-app`
View Source
const DeploymentAppYAMLv2 = `apiVersion: v1
kind: Pod
metadata:
  name: leeroy-app
spec:
  containers:
    - image: leeroy-app:v2
      name: leeroy-app`
View Source
const DeploymentWebYAML = `apiVersion: v1
kind: Pod
metadata:
  name: leeroy-web
spec:
  containers:
    - name: leeroy-web
      image: leeroy-web`
View Source
const DeploymentWebYAMLv1 = `apiVersion: v1
kind: Pod
metadata:
  name: leeroy-web
spec:
  containers:
    - image: leeroy-web:v1
      name: leeroy-web`

Variables

View Source
var TestKubeConfig = "kubeconfig"
View Source
var TestKubeContext = "kubecontext"
View Source
var TestNamespace = "testNamespace"
View Source
var TestNamespace2 = "testNamespace2"
View Source
var TestNamespace2FromEnvTemplate = "test{{.MYENV}}ace2" // needs `MYENV=Namesp` environment variable

Functions

This section is empty.

Types

type CLI

type CLI struct {
	*kubectl.CLI
	Flags latest.KubectlFlags
	// contains filtered or unexported fields
}

CLI holds parameters to run kubectl.

func NewCLI

func NewCLI(cfg Config, flags latest.KubectlFlags, defaultNamespace string) CLI

func (*CLI) Apply

func (c *CLI) Apply(ctx context.Context, out io.Writer, manifests manifest.ManifestList) error

Apply runs `kubectl apply` on a list of manifests.

func (*CLI) Delete

func (c *CLI) Delete(ctx context.Context, out io.Writer, manifests manifest.ManifestList) error

Delete runs `kubectl delete` on a list of manifests.

func (*CLI) ReadManifests

func (c *CLI) ReadManifests(ctx context.Context, manifests []string) (manifest.ManifestList, error)

ReadManifests reads a list of manifests in yaml format.

func (*CLI) WaitForDeletions

func (c *CLI) WaitForDeletions(ctx context.Context, out io.Writer, manifests manifest.ManifestList) error

WaitForDeletions waits for resource marked for deletion to complete their deletion.

type Config

type Config interface {
	kubectl.Config
	kstatus.Config
	kloader.Config
	portforward.Config
	deploy.Config
	ForceDeploy() bool
	WaitForDeletions() config.WaitForDeletions
	Mode() config.RunMode
	HydratedManifests() []string
	GetNamespace() string
	DefaultPipeline() latest.Pipeline
	Tail() bool
	IsMultiCluster() bool
	PipelineForImage(imageName string) (latest.Pipeline, bool)
	JSONParseConfig() latest.JSONParseConfig
	EnablePlatformNodeAffinityInRenderedManifests() bool
	EnableGKEARMNodeTolerationInRenderedManifests() bool
}

type Deployer

type Deployer struct {
	*latest.KubectlDeploy
	// contains filtered or unexported fields
}

Deployer deploys workflows using kubectl CLI.

func NewDeployer

func NewDeployer(cfg Config, labeller *label.DefaultLabeller, d *latest.KubectlDeploy, artifacts []*latest.Artifact, configName string, customResourceSelectors []manifest.GroupKindSelector) (*Deployer, error)

NewDeployer returns a new Deployer for a DeployConfig filled with the needed configuration for `kubectl apply`

func (*Deployer) Cleanup

func (k *Deployer) Cleanup(ctx context.Context, out io.Writer, dryRun bool, manifestsByConfig manifest.ManifestListByConfig) error

Cleanup deletes what was deployed by calling Deploy.

func (*Deployer) ConfigName

func (k *Deployer) ConfigName() string

func (*Deployer) Dependencies

func (k *Deployer) Dependencies() ([]string, error)

Dependencies lists all the files that describe what needs to be deployed.

func (*Deployer) Deploy

func (k *Deployer) Deploy(ctx context.Context, out io.Writer, builds []graph.Artifact, manifestsByConfig manifest.ManifestListByConfig) error

Deploy templates the provided manifests with a simple `find and replace` and runs `kubectl apply` on those manifests

func (*Deployer) GetAccessor

func (k *Deployer) GetAccessor() access.Accessor

func (*Deployer) GetDebugger

func (k *Deployer) GetDebugger() debug.Debugger

func (*Deployer) GetLogger

func (k *Deployer) GetLogger() log.Logger

func (*Deployer) GetStatusMonitor

func (k *Deployer) GetStatusMonitor() status.Monitor

func (*Deployer) GetSyncer

func (k *Deployer) GetSyncer() sync.Syncer

func (*Deployer) HasRunnableHooks

func (k *Deployer) HasRunnableHooks() bool

func (*Deployer) PostDeployHooks

func (k *Deployer) PostDeployHooks(ctx context.Context, out io.Writer) error

func (*Deployer) PreDeployHooks

func (k *Deployer) PreDeployHooks(ctx context.Context, out io.Writer) error

func (*Deployer) RegisterLocalImages

func (k *Deployer) RegisterLocalImages(images []graph.Artifact)

func (*Deployer) TrackBuildArtifacts

func (k *Deployer) TrackBuildArtifacts(builds, deployedImages []graph.Artifact)

Jump to

Keyboard shortcuts

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