lcm

package
v0.0.0-...-2799a0c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

* Copyright Skyramp Authors 2024

Index

Constants

This section is empty.

Variables

View Source
var (
	DockerEngineAPIVersion = "1.44"
)

Functions

func InstallHelmChart

func InstallHelmChart(
	namespace, deploymentName string,
	helmOptions *types.HelmOptions,
	releaseName, kubeconfigPath, k8sContext string,
	values map[string]interface{},
) error

func IsInDefaultBridgeNetwork

func IsInDefaultBridgeNetwork(container *dockerTypes.ContainerJSON) bool

func NewK8sConfig

func NewK8sConfig(configPath, context string) (*restclient.Config, error)

func RemoveSkyrampWorkerInDocker

func RemoveSkyrampWorkerInDocker(containerName string) error

Helper method that will bring down skyramp worker in a docker network

func RunSkyrampWorkerInDockerNetwork

func RunSkyrampWorkerInDockerNetwork(image, tag string, hostPort int, targetNetworkName string) error

Helper method that will bring up skyramp worker in a docker network

func UninstallHelmChart

func UninstallHelmChart(namespace, releaseName, kubeconfigPath string) error

Types

type DockerLCM

type DockerLCM struct {

	// docker container object
	Container *dockerTypes.ContainerJSON
	// docker network ID that the work is in
	NetworkID string
	// docker network name
	NetworkName string
	// contains filtered or unexported fields
}

func NewDockerLCM

func NewDockerLCM() (*DockerLCM, error)

generic docker LCM to communicate with docker API

func (*DockerLCM) FindContainerByBoundAddress

func (d *DockerLCM) FindContainerByBoundAddress(address string) (*dockerTypes.ContainerJSON, error)

find container in docker using address and IP there could be some edges cases that this does not properly handle

func (*DockerLCM) FindNetworkByName

func (d *DockerLCM) FindNetworkByName(networkName string) (*dockerTypes.NetworkResource, error)

func (*DockerLCM) RestartWithNewPorts

func (d *DockerLCM) RestartWithNewPorts(container *dockerTypes.ContainerJSON, ports []int) error

exposing new ports requires recreating container this applies to standalone container, that does not belong to docker network

type K8SLCM

type K8SLCM struct {
	Namespace     string // Namespace to deploy
	LabelSelector string // labels for filter

	// Results for cache
	Deployments []*apiAppsv1.Deployment
	Services    []*apiCorev1.Service
	ConfigMaps  []*apiCorev1.ConfigMap
	// contains filtered or unexported fields
}

func NewK8SLCM

func NewK8SLCM(configPath, context, namespace string, labelMap map[string]string, option *LCMOption) (*K8SLCM, error)

func (*K8SLCM) ExecCommand

func (l *K8SLCM) ExecCommand(ctx context.Context, namespace, podName, containerName, dir, command string) (string, error)

exec sh command over k8s api

func (*K8SLCM) GetClientSet

func (l *K8SLCM) GetClientSet() *kubernetes.Clientset

func (*K8SLCM) GetDeployments

func (l *K8SLCM) GetDeployments(deployments []string) ([]*apiAppsv1.Deployment, error)

func (*K8SLCM) GetPodName

func (l *K8SLCM) GetPodName(deploymentName string) (string, error)

func (*K8SLCM) GetWorkerPodName

func (l *K8SLCM) GetWorkerPodName() (string, error)

type LCMOption

type LCMOption struct {
	DeployIngress bool
}

Jump to

Keyboard shortcuts

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