kube

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client contains the Kubernetes client for connecting to the cluster hosting ArgoCD

func NewClient

func NewClient() (*Client, error)

NewClient returns a Client ready to call the local Kubernetes API

func (*Client) ReadSecret

func (c *Client) ReadSecret(name string) ([]byte, error)

ReadSecret reads the specified Secret from the defined namespace, otherwise defaults to `argocd` and returns a YAML []byte containing its data, decoded from base64

type Resource

type Resource struct {
	Kind         string
	TemplateData map[string]interface{} // The template as read from YAML
	Backend      types.Backend

	Data        map[string]interface{} // The data to replace with, from Vault
	Annotations map[string]string
	// contains filtered or unexported fields
}

A Resource is the basis for all Templates

type Template

type Template struct {
	Resource
}

Template is the template for Kubernetes

func NewTemplate

func NewTemplate(template unstructured.Unstructured, backend types.Backend) (*Template, error)

NewTemplate returns a *Template given the template's data, and a VaultType

func (*Template) Replace

func (t *Template) Replace() error

Replace will replace the <placeholders> in the Template's data with values from Vault. It will return an aggregrate of any errors encountered during the replacements. For both non-Secret resources and Secrets with <placeholder>'s in `stringData`, the value in Vault is emitted as-is For Secret's with <placeholder>'s in `.data`, the value in Vault is emitted as base64 For any hard-coded strings that aren't <placeholder>'s, the string is emitted as-is

func (*Template) ToYAML

func (t *Template) ToYAML() (string, error)

ToYAML serializes the completed template into YAML to be consumed by Kubernetes

Jump to

Keyboard shortcuts

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