kubernetes

package
v0.0.0-...-5b0754e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartConfig

type ChartConfig struct {
	Name             string         `json:"name"`
	Description      string         `json:"description"`
	GitRepo          string         `yaml:"gitRepo" json:"gitRepo"`
	Directory        string         `json:"directory"`
	CatalystDefaults map[string]any `yaml:"catalystDefaults" json:"catalystDefaults,omitempty"`
}

func (*ChartConfig) GetDetails

func (chartConfig *ChartConfig) GetDetails() (*ChartDetails, error)

func (*ChartConfig) LoadInstance

func (chartConfig *ChartConfig) LoadInstance(mergeCatalystDefaults bool) (*chart.Chart, error)

type ChartDetails

type ChartDetails struct {
	ChartConfig
	DefaultValues map[string]any `json:"defaultValues"`
}

type HelmClient

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

func NewHelmClient

func NewHelmClient(
	helmWrapper HelmClientWrapper,
	knownCharts KnownCharts,
) *HelmClient

func (*HelmClient) DeleteRelease

func (hc *HelmClient) DeleteRelease(relName string) (*release.UninstallReleaseResponse, error)

func (*HelmClient) DeployChart

func (hc *HelmClient) DeployChart(env *model.Environment) error

func (*HelmClient) GetDeployments

func (hc *HelmClient) GetDeployments(relName string) ([]any, error)

GetDeployments Use utils.Get to extract values from the returned nested structures

func (*HelmClient) GetRelease

func (hc *HelmClient) GetRelease(relName string, getResourceInfo bool) (*release.Release, error)

type HelmClientWrapper

type HelmClientWrapper interface {
	InjectClient(actionConfig *action.Configuration)
	GetRelease(relName string, getResourceInfo bool) (*release.Release, error)
	InstallRelease(relName string, chart *chart.Chart, vals map[string]interface{}) (*release.Release, error)
	UpgradeRelease(relName string, chart *chart.Chart, vals map[string]interface{}) (*release.Release, error)
	UninstallRelease(relName string) (*release.UninstallReleaseResponse, error)
}

func NewHelmWrapper

func NewHelmWrapper(kubeConfig string) HelmClientWrapper

type HelmWrapperImp

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

func (*HelmWrapperImp) GetRelease

func (wi *HelmWrapperImp) GetRelease(relName string, getResourceInfo bool) (*release.Release, error)

func (*HelmWrapperImp) InjectClient

func (wi *HelmWrapperImp) InjectClient(actionConfig *action.Configuration)

func (*HelmWrapperImp) InstallRelease

func (wi *HelmWrapperImp) InstallRelease(
	relName string,
	chart *chart.Chart,
	vals map[string]interface{},
) (*release.Release, error)

func (*HelmWrapperImp) UninstallRelease

func (wi *HelmWrapperImp) UninstallRelease(relName string) (*release.UninstallReleaseResponse, error)

func (*HelmWrapperImp) UpgradeRelease

func (wi *HelmWrapperImp) UpgradeRelease(
	relName string,
	chart *chart.Chart,
	vals map[string]interface{},
) (*release.Release, error)

type KnownCharts

type KnownCharts struct {
	Charts []ChartConfig
	// ChartConfig name -> ChartConfig
	ByName map[string]*ChartConfig
}

func (*KnownCharts) LoadConfigs

func (cc *KnownCharts) LoadConfigs() error

type KubeClientWrapper

type KubeClientWrapper interface {
	InjectClient(client *kubernetes.Clientset)
	EnsureNamespace()
	GetPods(namespace string, options metav1.ListOptions) (*v1.PodList, error)
	StreamPodLogs(namespace string, podName string, options *v1.PodLogOptions) (io.ReadCloser, error)
}

func NewKubeWrapper

func NewKubeWrapper(kubeConfig string) KubeClientWrapper

type KubeWrapperImp

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

func (*KubeWrapperImp) EnsureNamespace

func (wi *KubeWrapperImp) EnsureNamespace()

func (*KubeWrapperImp) GetPods

func (wi *KubeWrapperImp) GetPods(namespace string, options metav1.ListOptions) (*v1.PodList, error)

func (*KubeWrapperImp) InjectClient

func (wi *KubeWrapperImp) InjectClient(client *kubernetes.Clientset)

func (*KubeWrapperImp) StreamPodLogs

func (wi *KubeWrapperImp) StreamPodLogs(
	namespace string,
	podName string,
	options *v1.PodLogOptions,
) (io.ReadCloser, error)

type KubernetesClient

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

func NewKubernetesClient

func NewKubernetesClient(kubeWrapper KubeClientWrapper) *KubernetesClient

func (*KubernetesClient) GetLogs

func (kc *KubernetesClient) GetLogs(pod *v1.Pod) ([]PodLogs, error)

func (*KubernetesClient) GetPods

func (kc *KubernetesClient) GetPods(labelSelector string) (*v1.PodList, error)

func (*KubernetesClient) PodLogStream

func (kc *KubernetesClient) PodLogStream(pod *v1.Pod, containerName string, follow bool) (io.ReadCloser, error)

func (*KubernetesClient) StreamContainerLogs

func (kc *KubernetesClient) StreamContainerLogs(pod *v1.Pod, containerName string, logChan chan PodContainerLogs) error

type LogEntry

type LogEntry struct {
	Timestamp string `json:"timestamp"`
	Log       string `json:"log"`
}

type PodContainerLogs

type PodContainerLogs struct {
	Name string     `json:"name"`
	Logs []LogEntry `json:"logs"`
}

type PodLogs

type PodLogs struct {
	Pod        string             `json:"pod"`
	Containers []PodContainerLogs `json:"containers"`
}

Jump to

Keyboard shortcuts

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