eci

package
v0.0.0-...-03fcf0c Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VOL_TYPE_NFS              = "NFSVolume"
	VOL_TYPE_EMPTYDIR         = "EmptyDirVolume"
	VOL_TYPE_CONFIGFILEVOLUME = "ConfigFileVolume"
)
View Source
const (
	CreateContainerGroupAction    = "CreateContainerGroup"
	DeleteContainerGroupAction    = "DeleteContainerGroup"
	DescribeContainerGroupsAction = "DescribeContainerGroups"
)

Variables

View Source
var (
	SiteId    = os.Getenv("SITE_ID")
	ClusterId = os.Getenv("CLUSTER_ID")
	NodeId    = os.Getenv("DEFAULT_NODE_ID")
	NodeName  string
	PrivateId = os.Getenv("PRIVATE_ID")
	MaxPods   = os.Getenv("MAX_PODS")
)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth,omitempty"`
	Email         string `json:"email,omitempty"`
	ServerAddress string `json:"serveraddress,omitempty"`
	IdentityToken string `json:"identitytoken,omitempty"`
	RegistryToken string `json:"registrytoken,omitempty"`
}

AuthConfig is the secret returned from an ImageRegistryCredential

type ConfigFileToPath

type ConfigFileToPath struct {
	Content string `json:"content"`
	Path    string `json:"path"`
}

type ContainerGroup

type ContainerGroup struct {
	ContainerGroupId   string          `json:"container_group_id"`
	ContainerGroupName string          `json:"container_group_name"`
	TaskId             string          `json:"task_id"`
	TaskState          string          `json:"task_state"`
	PodName            string          `json:"pod_name"`
	Namespace          string          `json:"namespace"`
	SiteId             string          `json:"site_id"`
	Memory             float64         `json:"memory"`
	Cpu                float64         `json:"cpu"`
	PrivateId          string          `json:"private_id"`
	RestartPolicy      string          `json:"restart_policy"`
	IntranetIp         string          `json:"intranet_ip"`
	Status             string          `json:"status"`
	CreationTime       string          `json:"creation_time"`
	SucceededTime      string          `json:"succeeded_time"`
	Volumes            []Volume        `json:"volumes"`
	Events             []Event         `json:"events" `
	Containers         []ContainerInfo `json:"containers"`
}

type ContainerGroupResp

type ContainerGroupResp struct {
	Eci []ContainerGroup `json:"eci"`
}

type ContainerInfo

type ContainerInfo struct {
	Id              string           `json:"id,omitempty"`
	Name            string           `json:"name"`
	Image           string           `json:"image"`
	ImageVersion    string           `json:"version"`
	ImagePullPolicy string           `json:"image_pull_policy"`
	WorkingDir      string           `json:"working_dir"`
	Arg             []string         `json:"arg"`
	Command         []string         `json:"command"`
	Memory          float64          `json:"memory"`
	Cpu             float64          `json:"cpu"`
	Ports           []ContainerPort  `json:"ports"`
	EnvironmentVars []EnvironmentVar `json:"environment_var"`
	VolumeMounts    []VolumeMount    `json:"volume_mounts"`
	RestartCount    int              `json:"restart_count,omitempty"`
	PreviousState   *ContainerState  `json:"previous_state,omitempty"`
	CurrentState    *ContainerState  `json:"current_state,omitempty"`
}

type ContainerPort

type ContainerPort struct {
	Port     int    `json:"port"`
	Protocol string `json:"protocol"`
}

type ContainerState

type ContainerState struct {
	State        string `json:"state"`
	DetailStatus string `json:"detail_status"`
	ExitCode     int    `json:"exit_code"`
	StartTime    string `json:"start_time"`
	FinishTime   string `json:"finish_time"`
}

type CreateContainerGroup

type CreateContainerGroup struct {
	SiteId                     string                    `json:"site_id"`
	ClusterId                  string                    `json:"cluster_id"`
	NodeId                     string                    `json:"node_id"`
	NodeName                   string                    `json:"node_name,omitempty"`
	Namespace                  string                    `json:"namespace"`
	BillMethod                 int                       `json:"bill_method"`
	OwnerReferences            interface{}               `json:"owner_references"`
	ContainerGroupName         string                    `json:"name"`
	ContainerGroupInstanceType string                    `json:"container_groupInstance_type,omitempty"`
	PodName                    string                    `json:"pod_name"`
	Cpu                        float64                   `json:"cpu"`
	Memory                     float64                   `json:"memory"`
	RestartPolicy              string                    `json:"restart_policy"`
	Amount                     int                       `json:"amount,omitempty"`
	StorageType                string                    `json:"ephemeral_storage_type"`
	StorageSize                int                       `json:"ephemeral_storage_size"`
	PublicIp                   []string                  `json:"public_ip,omitempty"`
	PrivateId                  string                    `json:"private_pipe_id"`
	Container                  []ContainerInfo           `json:"container"`
	InitContainer              []ContainerInfo           `json:"init_container"`
	Volumes                    []Volume                  `json:"volumes"`
	ImageRegistryCredentials   []ImageRegistryCredential `json:"image_registry_credential"`
	CreationTimestamp          string                    `json:"creation_timestamp"`
}

type DeleteContainerGroup

type DeleteContainerGroup struct {
	ContainerGroupId string `json:"container_group_id"`
}

type DescribeContainerGroupsRequest

type DescribeContainerGroupsRequest struct {
	SiteId             string `json:"site_id"`
	Limit              int    `json:"limit,omitempty"`
	NodeName           string `json:"node_name,omitempty"`
	NodeId             string `json:"node_id,omitempty"`
	ContainerGroupName string `json:"container_group_name,omitempty"`
	ContainerGroupId   string `json:"container_group_id,omitempty"`
	Namespace          string `json:"namespace,omitempty"`
}

type DescribeContainerLogRequest

type DescribeContainerLogRequest struct {
}

type ECIProvider

type ECIProvider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ECIProvider implements the virtual-kubelet provider interface and communicates with Alibaba Cloud's ECI APIs.

func NewECIProvider

func NewECIProvider(rm *manager.ResourceManager, nodeName, operatingSystem string, internalIP string, daemonEndpointPort int32) (*ECIProvider, error)

NewECIProvider creates a new ECIProvider.

func (*ECIProvider) Capacity

func (p *ECIProvider) Capacity(ctx context.Context) v1.ResourceList

Capacity returns a resource list containing the capacity limits set for ECI.

func (*ECIProvider) CreatePod

func (p *ECIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error

CreatePod accepts a Pod definition and creates an ECI deployment

func (*ECIProvider) DeletePod

func (p *ECIProvider) DeletePod(ctx context.Context, pod *v1.Pod) error

DeletePod deletes the specified pod out of ECI.

func (*ECIProvider) GetCgs

func (p *ECIProvider) GetCgs(ctx context.Context, namespace, name string) ([]ContainerGroup, int, error)

func (*ECIProvider) GetContainerLogs

func (p *ECIProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)

GetContainerLogs returns the logs of a pod by name that is running inside ECI.

func (*ECIProvider) GetPod

func (p *ECIProvider) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error)

func (*ECIProvider) GetPodByCondition

func (p *ECIProvider) GetPodByCondition(ctx context.Context, source, namespace, name string) (*v1.Pod, error)

func (*ECIProvider) GetPodStatus

func (p *ECIProvider) GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error)

GetPodStatus returns the status of a pod by name that is running inside ECI returns nil if a pod by that name is not found.

func (*ECIProvider) GetPods

func (p *ECIProvider) GetPods(ctx context.Context) ([]*v1.Pod, error)

GetPods returns a list of all pods known to be running within ECI.

func (*ECIProvider) NodeAddresses

func (p *ECIProvider) NodeAddresses(ctx context.Context) []v1.NodeAddress

NodeAddresses returns a list of addresses for the node status within Kubernetes.

func (*ECIProvider) NodeConditions

func (p *ECIProvider) NodeConditions(ctx context.Context) []v1.NodeCondition

NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), for updates to the node status within Kubernetes.

func (*ECIProvider) NodeDaemonEndpoints

func (p *ECIProvider) NodeDaemonEndpoints(ctx context.Context) *v1.NodeDaemonEndpoints

NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status within Kubernetes.

func (*ECIProvider) OperatingSystem

func (p *ECIProvider) OperatingSystem() string

OperatingSystem returns the operating system that was provided by the config.

func (*ECIProvider) RunInContainer

func (p *ECIProvider) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error

RunInContainer executes a command in a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.

func (*ECIProvider) UpdatePod

func (p *ECIProvider) UpdatePod(ctx context.Context, pod *v1.Pod) error

UpdatePod Update Annotations

type EnvironmentVar

type EnvironmentVar struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Event

type Event struct {
	Count          int    `json:"count"`
	Type           string `json:"type"`
	Name           string `json:"name"`
	Message        string `json:"message"`
	FirstTimestamp string `json:"first_timestamp"`
	LastTimestamp  string `json:"last_timestamp"`
}

type ImageRegistryCredential

type ImageRegistryCredential struct {
	Server   string `json:"server"`
	UserName string `json:"user_name"`
	Password string `json:"password"`
}

type Volume

type Volume struct {
	Type                 string             `json:"type"`
	Name                 string             `json:"name"`
	NfsVolumePath        string             `json:"nfs_volume_path"`
	NfsVolumeServer      string             `json:"nfs_volume_server"`
	NfsVolumeReadOnly    bool               `json:"nfs_volume_read_only"`
	EmptyDirVolumeEnable bool               `json:"empty_dir_volume_enable"`
	ConfigFileToPaths    []ConfigFileToPath `json:"config_file_to_paths"`
}

type VolumeMount

type VolumeMount struct {
	MountPath string `json:"mount_path"`
	ReadOnly  bool   `json:"read_only"`
	Name      string `json:"name"`
}

Jump to

Keyboard shortcuts

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