reckoner

package
v1.4.1-0...-109f576 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportOutput

func ImportOutput(release, namespace, repository string) (string, error)

Types

type Client

type Client struct {
	// KubClient is kubernetes client interface. Will be populated in the cilent.Init() function
	KubeClient kubernetes.Interface
	// Helm is a reckoner helm client. Will be populated in the client.Init() function
	Helm helm.Client
	// The version of Reckoner that is being used
	ReckonerVersion string
	// CourseFile will be populated in the client.Init() function
	CourseFile course.FileV2
	// PlotAll should be set to true if operating on all releases in the course
	PlotAll bool
	// Releases is a list of releases to operate on if PlotAll is false
	Releases []string
	// BaseDirectory is the directory where the course file is located
	BaseDirectory string
	// DryRun is a flag to indicate if the client should be run in dry run mode
	DryRun bool
	// CreateNamespaces is a flag to indicate if the client should create namespaces
	CreateNamespaces bool
	// ContinueOnError is a flag to indicate if the client should continue if one release fails
	ContinueOnError bool
	// Errors is a counter of errors encountered during the use of this cilent
	Errors int
	// HelmArgs is a list of helm args to pass to helm when running commands
	HelmArgs []string
	// Schema is a byte slice representation of the coursev2 json schema
	Schema []byte
	// OutputDirectory is the directory which will contain each YAML manifest in a separate file
	OutputDirectory string
}

Client is a configuration struct

func (*Client) Continue

func (c *Client) Continue() bool

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(namespace string, annotations, labels map[string]string, runningNamespaceList *v1.NamespaceList) error

CreateNamespace creates a kubernetes namespace with the given annotations and labels

func (*Client) CreateOrPatchNamespace

func (c *Client) CreateOrPatchNamespace(overWrite bool, namespaceName string, namespaceMgmt course.NamespaceConfig, namespaces *v1.NamespaceList) error

CreateOrPatchNamespace creates or patches namespace based on the configurations

func (*Client) Diff

func (c *Client) Diff() error

Diff gathers a given release's manifest and templates and outputs a string of diffs if there are any or reports that there are no diffs.

func (*Client) GetManifests

func (c *Client) GetManifests() (string, error)

func (*Client) Init

func (c *Client) Init(fileName string, initKubeClient bool) error

Init initializes a client. Attempts to open a v2 schema course file If getClient is true, attempts to get a Kubernetes client from config

func (*Client) NamespaceManagement

func (c *Client) NamespaceManagement() error

NamespaceManagement manages namespace names, annotations and labels

func (*Client) PatchNamespace

func (c *Client) PatchNamespace(namespace string, annotations, labels map[string]string) error

PatchNamespace patches a kubernetes namespace with the given annotations and labels

func (*Client) Plot

func (c *Client) Plot() error

Plot actually plots the releases

func (Client) TemplateAll

func (c Client) TemplateAll() (fullOutput string, err error)

TemplateAll runs the same as plot but runs template instead

func (Client) TemplateRelease

func (c Client) TemplateRelease(releaseName string) (string, error)

TemplateRelease does the same thing as TemplateAll but only for one release

func (*Client) Update

func (c *Client) Update() error

func (Client) UpdateHelmRepos

func (c Client) UpdateHelmRepos() error

UpdateHelmRepos updates Helm repos TODO actually return an error if any are encountered

func (*Client) WriteArgoApplications

func (c *Client) WriteArgoApplications(outputDir string) (err error)

func (*Client) WriteSplitYaml

func (c *Client) WriteSplitYaml(in []byte, basePath string, releaseName string) (err error)

type ImportInfo

type ImportInfo struct {
	Chart     string
	Version   string
	Name      string
	Namespace string
}

type ImportValues

type ImportValues map[string]interface{}

type Manifest

type Manifest struct {
	Source   string
	Kind     string
	Metadata Metadata
	Content  string
}

Manifest represents a single kubernetes yaml manifest from a helm release. It could be from a 'template' command or 'get' command.

func ManifestUnmarshal

func ManifestUnmarshal(in string) ([]Manifest, error)

ManifestUnmarshal converts a manifest string that includes all resources from a chart and breaks them up into their individual resource manifests.

Returns a slice of Manifest structs.

func (*Manifest) UnmarshalYAML

func (m *Manifest) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML satisfies the yaml.Unmarshaler interface for a Manifest object. This ensures that a manifest object can properly pull the Source, Kind, and Metadata fields and then populates the contents field with the raw yaml, not including the Source comment.

type ManifestDiff

type ManifestDiff struct {
	ReleaseName string
	Kind        string
	Name        string
	Source      string
	Diff        string
	NewFile     bool
}

ManifestDiff is a struct that contains the diff between a manifest (from 'helm get manifest') and a template (from 'helm template') The fields help identify the which resource is being diffed from the helm chart.

func (ManifestDiff) String

func (md ManifestDiff) String() string

String returns a string representation of the ManifestDiff

type Metadata

type Metadata struct {
	Name string
}

Metadata only includes a Name field for a given resource.

Jump to

Keyboard shortcuts

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