util

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupIfPresent

func BackupIfPresent(fs afero.Afero, basePath string, logger log.Logger, ui cli.Ui) error

func BailIfPresent

func BailIfPresent(fs afero.Afero, basePath string, logger log.Logger) error

BailIfPresent returns an error if the path is present. Handy to prevent accidentally blowing away directories on the workstation.

func FindOnlySubdir

func FindOnlySubdir(dir string, fs afero.Afero) (string, error)

FindOnlySubdir finds the only subdirectory of a directory.

func GenerateNameFromMetadata added in v0.25.0

func GenerateNameFromMetadata(k8sYaml MinimalK8sYaml, idx int) string

func IsGithubURL

func IsGithubURL(url string) bool

returns true if this parses as a valid Github URL.

func IsK8sYaml added in v0.34.0

func IsK8sYaml(fs *afero.Afero, target string) bool

func IsLegalPath added in v0.34.0

func IsLegalPath(path string) error

IsLegalPath checks if the provided path is a relative path within the current working directory or within the os tempdir. If it is not, it returns an error.

func MaybeSplitMultidocYaml added in v0.28.0

func MaybeSplitMultidocYaml(ctx context.Context, fs afero.Afero, localPath string) error

this function is not perfect, and has known limitations. One of these is that it does not account for `\n---\n` in multiline strings.

func NewKubernetesResource added in v0.28.0

func NewKubernetesResource(in []byte) (*resource.Resource, error)

func ShouldAddFileToBase added in v0.34.0

func ShouldAddFileToBase(fs *afero.Afero, excludedBases []string, targetPath string) bool

func ToGroupVersionKind added in v0.32.0

func ToGroupVersionKind(in gvk.Gvk) schema.GroupVersionKind

func WritePostKustomizeFiles added in v0.33.0

func WritePostKustomizeFiles(debug log.Logger, FS afero.Afero, dest string, postKustomizeFiles []PostKustomizeFile) error

Types

type AssetUploader added in v0.16.0

type AssetUploader interface {
	UploadAssets(target string) error
}

func NewAssetUploader added in v0.16.0

func NewAssetUploader(
	logger log.Logger,
	client *http.Client,
) AssetUploader

type CAType added in v0.26.0

type CAType struct {
	Cert string
	Key  string
}

func MakeCA added in v0.26.0

func MakeCA(caKind string) (CAType, error)

type CertType added in v0.26.0

type CertType struct {
	Cert string
	Key  string
}

func MakeCert added in v0.26.0

func MakeCert(host []string, certKind, CACert, CAKey string) (CertType, error)

type GithubURL

type GithubURL struct {
	Owner  string
	Repo   string
	Ref    string
	Subdir string
	IsBlob bool
}

func ParseGithubURL

func ParseGithubURL(url string, defaultRef string) (GithubURL, error)

func (GithubURL) URL added in v0.30.0

func (g GithubURL) URL() string

type List added in v0.26.0

type List struct {
	APIVersion string           `json:"apiVersion" yaml:"apiVersion"`
	Path       string           `json:"path" yaml:"path"`
	Items      []MinimalK8sYaml `json:"items" yaml:"items"`
}

type ListK8sYaml added in v0.33.0

type ListK8sYaml struct {
	APIVersion string        `json:"apiVersion" yaml:"apiVersion"`
	Kind       string        `json:"kind" yaml:"kind" hcl:"kind"`
	Items      []interface{} `json:"items" yaml:"items"`
}

type MinimalK8sMetadata added in v0.26.0

type MinimalK8sMetadata struct {
	Name      string `json:"name" yaml:"name" hcl:"name"`
	Namespace string `json:"namespace" yaml:"namespace" hcl:"namespace"`
}

type MinimalK8sYaml added in v0.26.0

type MinimalK8sYaml struct {
	Kind     string             `json:"kind" yaml:"kind" hcl:"kind"`
	Metadata MinimalK8sMetadata `json:"metadata" yaml:"metadata" hcl:"metadata"`
}

type PostKustomizeFile added in v0.33.0

type PostKustomizeFile struct {
	Order   int
	Minimal MinimalK8sYaml
	Full    interface{}
}

func RebuildListYaml added in v0.33.0

func RebuildListYaml(debug log.Logger, lists []List, kustomizedYamlFiles []PostKustomizeFile) ([]PostKustomizeFile, error)

type PostKustomizeFileCollection added in v0.33.0

type PostKustomizeFileCollection []PostKustomizeFile

func (PostKustomizeFileCollection) Len added in v0.33.0

func (PostKustomizeFileCollection) Less added in v0.33.0

func (c PostKustomizeFileCollection) Less(i, j int) bool

func (PostKustomizeFileCollection) Swap added in v0.33.0

func (c PostKustomizeFileCollection) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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