k8s

package
v1.0.8-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 9 Imported by: 0

Documentation

Overview

* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	K8S_POD_NAMESPACE          = "K8S_POD_NAMESPACE"
	K8S_POD_NAME               = "K8S_POD_NAME"
	K8S_POD_INFRA_CONTAINER_ID = "K8S_POD_INFRA_CONTAINER_ID"

	PortMappingPortsAnnotation = "tkestack.io/portmapping"
)

k8s cni args

Args: [][2]string{
	{"IgnoreUnknown", "1"},
	{"K8S_POD_NAMESPACE", podNs},
	{"K8S_POD_NAME", podName},
	{"K8S_POD_INFRA_CONTAINER_ID", podInfraContainerID.ID},
}

Variables

This section is empty.

Functions

func GetHostname

func GetHostname() string

GetHostname returns OS's hostname if 'hostnameOverride' is empty and environment 'MY_NODE_NAME'; otherwise, return 'hostnameOverride'.

func GetPodFullName

func GetPodFullName(podName, namespace string) string

GetPodFullName returns a name that uniquely identifies a pod.

func RemovePortFile

func RemovePortFile(containerID string) error

func SavePort

func SavePort(containerID string, data []byte) error

Types

type NetworkSelectionElement

type NetworkSelectionElement struct {
	// Name contains the name of the Network object this element selects
	Name string `json:"name"`
	// Namespace contains the optional namespace that the network referenced
	// by Name exists in
	Namespace string `json:"namespace,omitempty"`
	// IPRequest contains an optional requested IP address for this network
	// attachment
	IPRequest string `json:"ips,omitempty"`
	// MacRequest contains an optional requested MAC address for this
	// network attachment
	MacRequest string `json:"mac,omitempty"`
	// InterfaceRequest contains an optional requested name for the
	// network interface this attachment will create in the container
	InterfaceRequest string `json:"interface,omitempty"`
}

NetworkSelectionElement represents one element of the JSON format Network Attachment Selection Annotation as described in section 4.1.2 of the CRD specification.

func ParsePodNetworkAnnotation

func ParsePodNetworkAnnotation(podNetworks string) ([]*NetworkSelectionElement, error)

type Port

type Port struct {
	// This must be a valid port number, 0 <= x < 65536.
	// If HostNetwork is specified, this must match ContainerPort.
	HostPort int32 `json:"hostPort"`
	// Required: This must be a valid port number, 0 < x < 65536.
	ContainerPort int32 `json:"containerPort"`
	// Required: Supports "TCP" and "UDP".
	Protocol string `json:"protocol"`

	HostIP string `json:"hostIP,omitempty"`

	PodName string `json:"podName"`

	PodIP string `json:"podIP"`
}

func ConsumePort

func ConsumePort(containerID string) ([]Port, error)

type PortMapConf

type PortMapConf struct {
	RuntimeConfig struct {
		PortMaps []Port `json:"portMappings,omitempty"`
	} `json:"runtimeConfig,omitempty"`
}

Directories

Path Synopsis
* Tencent is pleased to support the open source community by making TKEStack available.
* Tencent is pleased to support the open source community by making TKEStack available.
* Tencent is pleased to support the open source community by making TKEStack available.
* Tencent is pleased to support the open source community by making TKEStack available.
* Tencent is pleased to support the open source community by making TKEStack available.
* Tencent is pleased to support the open source community by making TKEStack available.

Jump to

Keyboard shortcuts

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