utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KlusterDetails

func KlusterDetails(klusterName string) (*model.KlusterDetails, error)

KlusterDetails gets the details of the kluster named klusterName

func Klusters

func Klusters() (*model.KlusterList, error)

Klusters lists all the available klusters

func ReadFile

func ReadFile(src string) ([]string, error)

ReadFile reads the contents of the file src as list of lines

func ToString

func ToString(lines []string) string

ToString joins the lines seperated by newline

func WriteLinesToFile

func WriteLinesToFile(dest string, lines []string) error

WriteLinesToFile write the list of lines to file dest

Types

type ExecResponse

type ExecResponse struct {
	Command        string
	StdOut         bytes.Buffer
	StdErr         bytes.Buffer
	StdOutErrLines []string
}

func NewExecUtil

func NewExecUtil() *ExecResponse

NewExecUtil returns a new exec utility to exec native process

func (*ExecResponse) Execute

func (execResponse *ExecResponse) Execute(commandArgs []string) error

Execute executes the commands with launchArgs as parameters

type GHRelease

type GHRelease struct {
	TagName    string `json:"tag_name"`
	Draft      bool   `json:"draft,omitempty"`
	PreRelease bool   `json:"prerelease,omitempty"`
}

GHRelease struct to hold the GH release info like tag and release type

type K3sVersionInfo

type K3sVersionInfo struct {
	Versions   []string
	CacheFile  string
	FromCache  bool
	ExpiryTime time.Duration
}

func NewK3sVersionUtil

func NewK3sVersionUtil(cacheFile string, expiryTime string) (*K3sVersionInfo, error)

NewK3sVersionUtil returns a new instance of K3sVersionInfo

func (*K3sVersionInfo) QueryAndCacheK3sReleases

func (k3sv *K3sVersionInfo) QueryAndCacheK3sReleases() error

QueryAndCacheK3sReleases queries the k3s releases via GitHub API and cache the release in a file $HOME/.kluster/cache/k3s-releases

type KubeConfigFile

type KubeConfigFile struct {
	FilePath string
	Config   *clientcmdapi.Config
}

func NewKubeConfigUtil

func NewKubeConfigUtil(filePath string) (*KubeConfigFile, error)

NewKubeConfigUtil instantiates a new utility to manipulate Kube Config

func (*KubeConfigFile) LoadKubeConfig

func (k *KubeConfigFile) LoadKubeConfig(configFiles ...string) error

LoadKubeConfig load the Kubeconfig file

func (*KubeConfigFile) RemoveEntriesFromKubeConfig

func (k *KubeConfigFile) RemoveEntriesFromKubeConfig(klusterName string) error

RemoveEntriesFromKubeConfig Removes the entries from kubeconfig clusters etc.,

func (*KubeConfigFile) WriteKubeConfig

func (k *KubeConfigFile) WriteKubeConfig(profileName string, kluster *model.Kluster) error

WriteKubeConfig writes the kubeconfig content of the cluster klusterName to file kubeConfigFile

func (*KubeConfigFile) WriteToFile

func (k *KubeConfigFile) WriteToFile() error

Jump to

Keyboard shortcuts

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