Documentation ¶
Index ¶
- Constants
- Variables
- func AddHostEntries(c *Config) error
- func AddResolvConfEntry(n *Node, c *Config) error
- func AddRouteForDNS64Network(c *Config) error
- func BringUp(name string, c *Config)
- func BuildAddRouteArgs(container, dest, via string) []string
- func BuildArgsForCACert(mgmtPrefix string, id int, base string) []string
- func BuildArgsForCADigest(base string) []string
- func BuildArgsForCAKey(base string) []string
- func BuildArgsForRSA(base string) []string
- func BuildArgsForX509Cert(base string) []string
- func BuildCreateNetArgsFor(name, cidr, v4cidr, gwPrefix string) []string
- func BuildCreateVolumeArgs(name string) []string
- func BuildDeleteContainerArgs(name string) []string
- func BuildDeleteNetArgsFor(name string) []string
- func BuildDeleteVolumeArgs(name string) []string
- func BuildGWIP(prefix string, intfPart int) string
- func BuildGetInterfaceArgs(container, ifName string) []string
- func BuildInspectVolumeArgs(name string) []string
- func BuildKubeAdmCommand(n, master *Node, c *Config) []string
- func BuildNodeCIDR(info NetInfo, node int) string
- func BuildPodSubnetPrefix(mode, prefix string, netSize, nodeID int) (string, string)
- func BuildResourceStateArgs(resource string) []string
- func BuildRoute(destStr, gwStr string, index int) (*netlink.Route, error)
- func BuildRunArgsForDNS64(c *Config) []string
- func BuildRunArgsForNAT64(c *Config) []string
- func BuildV4AddrDelArgs(container, ip string) []string
- func CalcNameServer(n *Node, c *Config) string
- func CalculateDerivedFields(c *Config) error
- func CheckMgmtSize(size int) error
- func CheckPodSize(size int) error
- func CheckServiceSize(size int) error
- func CheckUnlimitedSize(size int) error
- func Cleanup(name string, c *Config) error
- func CleanupClusterNode(node *Node, c *Config) error
- func CleanupDNS64Server(c *Config) error
- func CleanupForPlugin(node *Node, c *Config) error
- func CleanupNAT64Server(c *Config) error
- func CleanupSupportNetwork(c *Config) error
- func ConfigureManagementInterface(node *Node, c *Config) error
- func CopyFile(name, src, dst string) (err error)
- func CreateCNIConfigFile(node *Node, c *Config) error
- func CreateCertKeyArea(base string) error
- func CreateCertificateForCA(mgmtPrefix string, id int, base string) error
- func CreateConfigForDNS64(c *Config) error
- func CreateDigestForCA(base string) (string, error)
- func CreateKeyForCA(base string) error
- func CreateKubeAdmConfigContents(n *Node, c *Config) []byte
- func CreateKubeAdmConfigFile(node *Node, c *Config) error
- func CreateKubeletDropInContents(c *Config) *bytes.Buffer
- func CreateKubeletDropInFile(c *Config) error
- func CreateNamedConfContents(c *Config) *bytes.Buffer
- func CreateRSAForCA(base string) error
- func CreateRouteToNAT64ServerForDNS64Subnet(node *Node, c *Config) (err error)
- func CreateRouteToSupportNetworkForOtherNodes(node *Node, c *Config) (err error)
- func CreateRoutesForPodNetwork(node *Node, c *Config) error
- func CreateSupportNetwork(c *Config) (err error)
- func CreateToken() (string, error)
- func CreateX509CertForCA(base string) error
- func DoExecCommand(cmd string, args []string) (string, error)
- func DoRouteOpsOnNodes(node *Node, c *Config, op string) error
- func EnsureCNIAreaExists(area string) error
- func EnsureDNS64Server(c *Config) (err error)
- func EnsureNAT64Server(c *Config) (err error)
- func EnsureRouteToNAT64(c *Config) error
- func ExtractDigest(input string) (string, error)
- func ExtractNetInfo(cidr string, info *NetInfo, check SizeCheck) error
- func ExtractToken(input string) (string, error)
- func FindHostIPForNAT64(c *Config) (string, bool)
- func GenerateDefaultRoute(c *Config, i int) string
- func GetFileContents(file string) ([]byte, error)
- func GetNetAndMask(input string) (string, int, error)
- func Initialize(name string, c *Config, configFile string) error
- func IsIPv4(ip string) bool
- func MakePrefixFromNetwork(network string, netSize int) string
- func MakeV4PrefixFromNetwork(ip string) string
- func MatchingNodeIndex(line []byte, n []NodeInfo) int
- func OpenConfigFile(configFile string) (io.ReadCloser, error)
- func OpenPermissions(name string) error
- func OsExecCommand(cmd string, args []string) (string, error)
- func ParseIPv4Address(ifConfig string) string
- func ParseVersion(version string) (string, error)
- func PlaceCertificateAndKeyForCA(workBase, dst string) error
- func Prepare(name string, c *Config) error
- func PrepareClusterNode(node *Node, c *Config) error
- func PrepareDNS64Server(c *Config) error
- func PrepareNAT64Server(c *Config) error
- func RecoverFile(file, backup, saveErr string) error
- func RegisterExecCommand(cmdFunc ExecCommandFuncType)
- func RemoveContainer(name string, c *Config) error
- func RemoveDropInFile(c *Config) error
- func RemoveIPv4AddressOnDNS64Server(c *Config) (err error)
- func RemoveManagementIP(node *Node, c *Config) error
- func RemoveRouteForDNS64(node *Node, c *Config) error
- func RemoveRouteForNAT64(node *Node, c *Config) error
- func RemoveRoutesForPodNetwork(node *Node, c *Config) error
- func RestartKubeletService() error
- func RevertConfigInfo(contents []byte, file string) []byte
- func RevertEntries(file, backup string) error
- func RevertEtcAreaFile(c *Config, file, backup string) error
- func SaveFileContents(contents []byte, file, backup string) error
- func SetupBaseAreas(work, systemd, etc, cni, cert string, c *Config)
- func SetupForPlugin(node *Node, c *Config) error
- func SetupHandles(c *Config) error
- func StartKubernetes(n *Node, c *Config) error
- func StopKubernetes() error
- func TearDown(name string, c *Config)
- func UpdateConfigYAML(file, token, hash string) error
- func UpdateConfigYAMLContents(contents []byte, file, token, hash string) []byte
- func UpdateHostsInfo(contents []byte, n []NodeInfo) []byte
- func UpdateResolvConfInfo(contents []byte, ns string) []byte
- func ValidateCIDR(which, cidr string) error
- func ValidateCommand(command string) (string, error)
- func ValidateConfigContents(c *Config, ignoreMissing bool) error
- func ValidateDNS64Fields(c *Config) error
- func ValidateHost(host string, config *Config) error
- func ValidateNAT64Fields(c *Config) error
- func ValidateNetworkMode(c *Config) error
- func ValidateNodeOpModes(netMode string, node *Node) error
- func ValidateOpModesForAllNodes(c *Config) error
- func ValidatePlugin(c *Config) error
- func ValidatePodFields(c *Config) error
- func ValidateSoftwareVersions(c *Config) error
- func ValidateToken(token string, ignoreMissing bool) error
- func ValidateTokenCertHash(certHash string, ignoreMissing bool) error
- func ValidateUniqueIDs(c *Config) error
- func WriteConfigForIPAM(c *Config, node *Node, w io.Writer) (err error)
- func WriteRange(c *Config, node *Node, i int, w io.Writer) (err error)
- type BridgePlugin
- type Config
- type DNS64Config
- type Docker
- func (d *Docker) AddV6Route(container, dest, via string) error
- func (d *Docker) CreateNetwork(name, cidr, v4cidr, gw string) error
- func (d *Docker) CreateVolume(name string) error
- func (d *Docker) DeleteContainer(name string) error
- func (d *Docker) DeleteNetwork(name string) error
- func (d *Docker) DeleteV4Address(container, ip string) error
- func (d *Docker) DeleteVolume(name string) error
- func (d *Docker) DoCommand(name string, args []string) (string, error)
- func (d *Docker) GetInterfaceConfig(name, ifName string) (string, error)
- func (d *Docker) GetVolumeMountPoint(name string) (string, error)
- func (d *Docker) ResourceState(r string) string
- func (d *Docker) RunContainer(name string, args []string) error
- type ExecCommandFuncType
- type GeneralSettings
- type Hypervisor
- type KubeAdmConfigInfo
- type ManagementNetwork
- type NAT64Config
- type NetInfo
- type NetLink
- func (n *NetLink) AddrDel(link netlink.Link, addr *netlink.Addr) error
- func (n *NetLink) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
- func (n *NetLink) AddrReplace(link netlink.Link, addr *netlink.Addr) error
- func (n *NetLink) LinkByName(name string) (netlink.Link, error)
- func (n *NetLink) LinkDel(link netlink.Link) error
- func (n *NetLink) LinkList() ([]netlink.Link, error)
- func (n *NetLink) LinkSetDown(link netlink.Link) error
- func (n *NetLink) LinkSetMTU(link netlink.Link, mtu int) error
- func (n *NetLink) ParseAddr(s string) (*netlink.Addr, error)
- func (n *NetLink) ParseIPNet(s string) (*net.IPNet, error)
- func (n *NetLink) RouteAdd(route *netlink.Route) error
- func (n *NetLink) RouteDel(route *netlink.Route) error
- type NetLinkAPI
- type NetMgr
- func (n NetMgr) AddAddressToLink(ip, intf string) error
- func (n NetMgr) AddRouteUsingInterfaceName(dest, gw, intf string) error
- func (n NetMgr) AddRouteUsingSupportNetInterface(dest, gw, supportNetCIDR string) error
- func (n NetMgr) AddressExistsOnLink(addr *netlink.Addr, link netlink.Link) bool
- func (n NetMgr) BringLinkDown(name string) error
- func (n NetMgr) DeleteLink(name string) error
- func (n NetMgr) DeleteRouteUsingInterfaceName(dest, gw, intf string) error
- func (n NetMgr) DeleteRouteUsingSupportNetInterface(dest, gw, supportNetCIDR string) error
- func (n NetMgr) FindLinkIndexForCIDR(cidr string) (int, error)
- func (n NetMgr) RemoveAddressFromLink(ip, intf string) error
- func (n NetMgr) RemoveBridge(name string) error
- func (n NetMgr) SetLinkMTU(name string, mtu int) error
- type Networker
- type Node
- type NodeInfo
- type PluginAPI
- type PodNetwork
- type PointToPointPlugin
- type ServiceNetwork
- type SizeCheck
- type SupportNetwork
Constants ¶
const ( // DefaultPlugin if none is specified DefaultPlugin = "bridge" // SupportNetName used by NAT64/DNS64 server SupportNetName = "support_net" // ResourceNotPresent status, indicating it can be created ResourceNotPresent = "not-present" // ResourceRunning status, indicating it is already created ResourceRunning = "running" // ResourceExists status, indicating that it exists, but is not running ResourceExists = "exists" // WorkArea where configuration files are placed for running program WorkArea = "/tmp/lazyjack" // CertArea where certificates and keys are stored CertArea = "certs" // KubernetesCertArea where KubeAdm references certificates and keys KubernetesCertArea = "/etc/kubernetes/pki" // DNS64Name name of the DNS64 server DNS64Name = "bind9" // DNS64Volume name of volume holding DNS64 configuration DNS64Volume = "volume-bind9" // DNS64NamedConf main configuration file DNS64NamedConf = "named.conf" // NAT64Name name of NAT64 server NAT64Name = "tayga" // KubeletSystemdArea where kubelet configuration files are located KubeletSystemdArea = "/etc/systemd/system/kubelet.service.d" // KubeletDropInFile name of drop-in file being created KubeletDropInFile = "20-extra-dns-args.conf" // CNIConfArea where CNI config files are stored CNIConfArea = "/etc/cni/net.d" // CNIConfFile name of the CNI config file CNIConfFile = "cni.conf" // EtcArea top level area for config files EtcArea = "/etc" // EtcHostsFile name of the hosts file EtcHostsFile = "hosts" // EtcHostsBackupFile backup name for hosts file EtcHostsBackupFile = "hosts.bak" // EtcResolvConfFile name of the nameserver file EtcResolvConfFile = "resolv.conf" // EtcResolvConfBackupFile backup name for nameserver file EtcResolvConfBackupFile = "resolv.conf.bak" // KubeAdmConfFile name of the configuration file used by KubeAdm KubeAdmConfFile = "kubeadm.conf" // DefaultToken used when in insecure mode DefaultToken = "abcdef.abcdefghijklmnop" // MinimumPodMTU is the smallest MTU for IPv6 MinimumPodMTU = 1280 // DefaultPodMTU is the default MTU to use, when not specified DefaultPodMTU = 1500 // IPv6NetMode for IPv6 only networks IPv6NetMode = "ipv6" // DefaultNetMode default network operating mode DefaultNetMode = IPv6NetMode // IPv4NetMode for IPv4 only network operating mode IPv4NetMode = "ipv4" // DualStackNetMode for IPv4/IPv6 network operating mode DualStackNetMode = "dual-stack" )
const DefaultDockerCommand = "docker"
DefaultDockerCommand command used for docker
Variables ¶
var Template_v1_10 = template.Must(template.New("v1.10").Parse(`# V1.10 (and older) based config
api:
advertiseAddress: "{{.AdvertiseAddress}}"
apiServerExtraArgs:
insecure-bind-address: "{{.BindAddress}}"
insecure-port: "{{.BindPort}}"
apiVersion: kubeadm.k8s.io/v1alpha1
featureGates: {CoreDNS: {{.UseCoreDNS}}}
kind: MasterConfiguration
{{.K8sVersion}}
networking:
# podSubnet: "{{.PodNetworkCIDR}}"
serviceSubnet: "{{.ServiceSubnet}}"
token: "{{.AuthToken}}"
tokenTTL: 0s
nodeName: {{.KubeMasterName}}
unifiedControlPlaneImage: ""
`))
Template_v1_10 kubeadm.conf content template for Kubernetes V1.10
var Template_v1_11 = template.Must(template.New("v1.11").Parse(`# V1.11 based config
api:
advertiseAddress: "{{.AdvertiseAddress}}"
bindPort: 6443
controlPlaneEndpoint: ""
apiServerExtraArgs:
insecure-bind-address: "{{.BindAddress}}"
insecure-port: "{{.BindPort}}"
apiVersion: kubeadm.k8s.io/v1alpha2
auditPolicy:
logDir: /var/log/kubernetes/audit
logMaxAge: 2
path: ""
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: {{.AuthToken}}
ttl: 0s
usages:
- signing
- authentication
certificatesDir: /etc/kubernetes/pki
# clusterName: kubernetes
etcd:
local:
dataDir: /var/lib/etcd
image: ""
featureGates: {CoreDNS: {{.UseCoreDNS}}}
kind: MasterConfiguration
kubeProxy:
config:
bindAddress: "{{.BindAddress}}"
clientConnection:
acceptContentTypes: ""
burst: 10
contentType: application/vnd.kubernetes.protobuf
kubeconfig: /var/lib/kube-proxy/kubeconfig.conf
qps: 5
# clusterCIDR: ""
configSyncPeriod: 15m0s
# conntrack:
# max: null
# maxPerCore: 32768
# min: 131072
# tcpCloseWaitTimeout: 1h0m0s
# tcpEstablishedTimeout: 24h0m0s
enableProfiling: false
healthzBindAddress: 0.0.0.0:10256
hostnameOverride: ""
iptables:
masqueradeAll: false
masqueradeBit: 14
minSyncPeriod: 0s
syncPeriod: 30s
ipvs:
excludeCIDRs: null
minSyncPeriod: 0s
scheduler: ""
syncPeriod: 30s
metricsBindAddress: 127.0.0.1:10249
mode: ""
nodePortAddresses: null
oomScoreAdj: -999
portRange: ""
resourceContainer: /kube-proxy
udpIdleTimeout: 250ms
kubeletConfiguration:
baseConfig:
address: 0.0.0.0
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 2m0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 5m0s
cacheUnauthorizedTTL: 30s
cgroupDriver: cgroupfs
cgroupsPerQOS: true
clusterDNS:
- "{{.DNS_ServiceIP}}"
clusterDomain: cluster.local
containerLogMaxFiles: 5
containerLogMaxSize: 10Mi
contentType: application/vnd.kubernetes.protobuf
cpuCFSQuota: true
cpuManagerPolicy: none
cpuManagerReconcilePeriod: 10s
enableControllerAttachDetach: true
enableDebuggingHandlers: true
enforceNodeAllocatable:
- pods
eventBurst: 10
eventRecordQPS: 5
evictionHard:
imagefs.available: 15%
memory.available: 100Mi
nodefs.available: 10%
nodefs.inodesFree: 5%
evictionPressureTransitionPeriod: 5m0s
failSwapOn: true
fileCheckFrequency: 20s
hairpinMode: promiscuous-bridge
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 20s
imageGCHighThresholdPercent: 85
imageGCLowThresholdPercent: 80
imageMinimumGCAge: 2m0s
iptablesDropBit: 15
iptablesMasqueradeBit: 14
kubeAPIBurst: 10
kubeAPIQPS: 5
makeIPTablesUtilChains: true
maxOpenFiles: 1000000
maxPods: 110
nodeStatusUpdateFrequency: 10s
oomScoreAdj: -999
podPidsLimit: -1
# port: 10250
registryBurst: 10
registryPullQPS: 5
resolvConf: /etc/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 2m0s
serializeImagePulls: true
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 4h0m0s
syncFrequency: 1m0s
volumeStatsAggPeriod: 1m0s
{{.K8sVersion}}
networking:
# podSubnet: "{{.PodNetworkCIDR}}"
serviceSubnet: "{{.ServiceSubnet}}"
nodeRegistration:
name: {{.KubeMasterName}}
unifiedControlPlaneImage: ""
`))
Template_v1_11 kubeadm.conf content template for Kubernetes V1.11
var Template_v1_12 = template.Must(template.New("v1.12").Parse(`# V1.12 based config
apiEndpoint:
advertiseAddress: "{{.AdvertiseAddress}}"
bindPort: 6443
apiVersion: kubeadm.k8s.io/v1alpha3
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: {{.AuthToken}}
ttl: 0s
usages:
- signing
- authentication
kind: InitConfiguration
nodeRegistration:
criSocket: /var/run/dockershim.sock
name: {{.KubeMasterName}}
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiServerExtraArgs:
insecure-bind-address: "{{.BindAddress}}"
insecure-port: "{{.BindPort}}"
apiVersion: kubeadm.k8s.io/v1alpha3
auditPolicy:
logDir: /var/log/kubernetes/audit
logMaxAge: 2
path: ""
certificatesDir: /etc/kubernetes/pki
controlPlaneEndpoint: ""
etcd:
local:
dataDir: /var/lib/etcd
image: ""
featureGates: {CoreDNS: {{.UseCoreDNS}}}
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
{{.K8sVersion}}
networking:
# podSubnet: "{{.PodNetworkCIDR}}"
serviceSubnet: "{{.ServiceSubnet}}"
unifiedControlPlaneImage: ""
`))
Template_v1_12 kubeadm.conf content template for Kubernetes V1.12
var Template_v1_13 = template.Must(template.New("v1.13").Parse(`# V1.13 based config
apiEndpoint:
advertiseAddress: "{{.AdvertiseAddress}}"
bindPort: 6443
apiVersion: kubeadm.k8s.io/v1beta1
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: {{.AuthToken}}
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
nodeRegistration:
criSocket: /var/run/dockershim.sock
name: {{.KubeMasterName}}
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiServerExtraArgs:
insecure-bind-address: "{{.BindAddress}}"
insecure-port: "{{.BindPort}}"
apiVersion: kubeadm.k8s.io/v1beta1
auditPolicy:
logDir: /var/log/kubernetes/audit
logMaxAge: 2
path: ""
certificatesDir: /etc/kubernetes/pki
# clusterName: kubernetes
controlPlaneEndpoint: ""
etcd:
local:
dataDir: /var/lib/etcd
image: ""
featureGates: {CoreDNS: {{.UseCoreDNS}}}
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
{{.K8sVersion}}
networking:
dnsDomain: cluster.local
# podSubnet: "{{.PodNetworkCIDR}}"
serviceSubnet: "{{.ServiceSubnet}}"
unifiedControlPlaneImage: ""
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
bindAddress: "{{.BindAddress}}"
clientConnection:
acceptContentTypes: ""
burst: 10
contentType: application/vnd.kubernetes.protobuf
kubeconfig: /var/lib/kube-proxy/kubeconfig.conf
qps: 5
# clusterCIDR: ""
configSyncPeriod: 15m0s
# conntrack:
# max: null
# maxPerCore: 32768
# min: 131072
# tcpCloseWaitTimeout: 1h0m0s
# tcpEstablishedTimeout: 24h0m0s
enableProfiling: false
healthzBindAddress: 0.0.0.0:10256
hostnameOverride: ""
iptables:
masqueradeAll: false
masqueradeBit: 14
minSyncPeriod: 0s
syncPeriod: 30s
ipvs:
excludeCIDRs: null
minSyncPeriod: 0s
scheduler: ""
syncPeriod: 30s
kind: KubeProxyConfiguration
metricsBindAddress: 127.0.0.1:10249
mode: ""
nodePortAddresses: null
oomScoreAdj: -999
portRange: ""
resourceContainer: /kube-proxy
udpIdleTimeout: 250ms
---
address: 0.0.0.0
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 2m0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 5m0s
cacheUnauthorizedTTL: 30s
cgroupDriver: cgroupfs
cgroupsPerQOS: true
clusterDNS:
- "{{.DNS_ServiceIP}}"
clusterDomain: cluster.local
configMapAndSecretChangeDetectionStrategy: Watch
containerLogMaxFiles: 5
containerLogMaxSize: 10Mi
contentType: application/vnd.kubernetes.protobuf
cpuCFSQuota: true
cpuCFSQuotaPeriod: 100ms
cpuManagerPolicy: none
cpuManagerReconcilePeriod: 10s
enableControllerAttachDetach: true
enableDebuggingHandlers: true
enforceNodeAllocatable:
- pods
eventBurst: 10
eventRecordQPS: 5
evictionHard:
imagefs.available: 15%
memory.available: 100Mi
nodefs.available: 10%
nodefs.inodesFree: 5%
evictionPressureTransitionPeriod: 5m0s
failSwapOn: true
fileCheckFrequency: 20s
hairpinMode: promiscuous-bridge
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 20s
imageGCHighThresholdPercent: 85
imageGCLowThresholdPercent: 80
imageMinimumGCAge: 2m0s
iptablesDropBit: 15
iptablesMasqueradeBit: 14
kind: KubeletConfiguration
kubeAPIBurst: 10
kubeAPIQPS: 5
makeIPTablesUtilChains: true
maxOpenFiles: 1000000
maxPods: 110
nodeLeaseDurationSeconds: 40
nodeStatusUpdateFrequency: 10s
oomScoreAdj: -999
podPidsLimit: -1
# port: 10250
registryBurst: 10
registryPullQPS: 5
resolvConf: /etc/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 2m0s
serializeImagePulls: true
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 4h0m0s
syncFrequency: 1m0s
volumeStatsAggPeriod: 1m0s
`))
Template_v1_13 kubeadm.conf content template for Kubernetes V1.13
Functions ¶
func AddHostEntries ¶
AddHostEntries udpates the /etc/hosts file with IP addresses to be used by the cluster for each node.
func AddResolvConfEntry ¶
AddResolvConfEntry updates the /etc/resolv.conf file with nameserver entry used for the cluster.
func AddRouteForDNS64Network ¶ added in v1.0.7
AddRouteForDNS64Network creates a route in the container to the NAT64 server for synthesized IPv6 addresses.
func BringUp ¶
BringUp performs the "up" actions to bring up a cluster. The (bridge) plugin is set up, kubelet server restarted to pickup changes, the cert/key placed (on master), and cluster init/join performed.
func BuildAddRouteArgs ¶ added in v1.0.7
BuildAddRouteArgs constructs arguments for adding an IPv6 route to container.
func BuildArgsForCACert ¶ added in v1.0.3
BuildArgsForCACert constructs arguments for command to build CA certificate.
func BuildArgsForCADigest ¶ added in v1.0.3
BuildArgsForCADigest builds arguments for comamnd to create CA digest.
func BuildArgsForCAKey ¶ added in v1.0.3
BuildArgsForCAKey constructs arguments for command to build CA keys.
func BuildArgsForRSA ¶ added in v1.0.3
BuildArgsForRSA builds arguments for command to create RSA key.
func BuildArgsForX509Cert ¶ added in v1.0.3
BuildArgsForX509Cert builds args for command to create X.509 certificate.
func BuildCreateNetArgsFor ¶ added in v1.0.7
BuildCreateNetArgsFor constructs arguments to create a docker network.
func BuildCreateVolumeArgs ¶ added in v1.2.1
BuildCreateVolumeArgs constructs arguments to create a volume
func BuildDeleteContainerArgs ¶ added in v1.2.1
BuildDeleteContainerArgs create arguments for the docker command to delete container
func BuildDeleteNetArgsFor ¶ added in v1.0.7
BuildDeleteNetArgsFor constructs arguments to delete a network.
func BuildDeleteVolumeArgs ¶ added in v1.2.1
BuildDeleteVolumeArgs constructs arguments to delete a volume
func BuildGetInterfaceArgs ¶ added in v1.0.7
BuildGetInterfaceArgs constructs arguments for obtaining list of IPs for an interface.
func BuildInspectVolumeArgs ¶ added in v1.2.1
BuildCreateVolumeArgs constructs arguments to create a volume
func BuildKubeAdmCommand ¶
BuildKubeAdmCommand constructs the init command (For master), or join command (for minions), using the previously created and stored token and certificate hash.
func BuildNodeCIDR ¶
BuildNodeCIDR helper constructs a node CIDR. The network portion of the CIDR (the prefix), has the node added as the last part of the final address. For example, fd00:20::/64 -> fd00:20::3/64
func BuildPodSubnetPrefix ¶ added in v1.0.8
BuildPodSubnetPrefixSuffix will create a pod network prefix, using the cluster prefix and node ID. For IPv6, if the subnet size is not a multiple of 16, then the node ID will be placed in the upper byte of the last part of the prefix. If the node ID is to be placed in the lower byte, and there is an upper byte, we need to make sure we pad with zero for values less than 0x10. The suffix will be "".
For IPv4, the pod network is expected to be /24 with the node ID in the third octect. As a result, the third octet in the prefix is repplaced with the node ID. The suffix will be "0".
func BuildResourceStateArgs ¶ added in v1.2.1
BuildResourceStateArgs constructs arg to obtain resource state
func BuildRoute ¶
BuildRoute creates a route to the destination, using the provided gateway.
func BuildRunArgsForDNS64 ¶
BuildRunArgsForDNS64 constructs docker command to start DNS64 container.
func BuildRunArgsForNAT64 ¶
BuildRunArgsForNAT64 constructs arguments to start a NAT64 container.
func BuildV4AddrDelArgs ¶ added in v1.0.7
BuildV4AddrDelArgs constructs arguments for deleting an IPv4 address from and interface.
func CalcNameServer ¶ added in v1.3.4
CalcNameServer determines the IP to use for the name server in /etc/resolv.conf based on the service network mode. For IPv6 mode, the DNS64 IP is used, otherwise the node's IP is used.
func CalculateDerivedFields ¶ added in v1.0.5
CalculateDerivedFields splits up CIDRs into prefix and size for use later. TODO: Validate no overlaps in CIDRs
func CheckMgmtSize ¶ added in v1.3.3
CheckMgmtSize ensures that management network size is valid for IPv4 mode.
func CheckPodSize ¶ added in v1.3.3
CheckPodSize ensures that pod network size is valid for IPv4 mode.
func CheckServiceSize ¶ added in v1.3.3
CheckServiceSize ensures that service network size is valid for IPv4 mode.
func CheckUnlimitedSize ¶ added in v1.3.3
CheckUnlimitedSize skips checking for any limits on size for IPv4 networks.
func Cleanup ¶
Cleanup is the top level method for the "clean" action, to remove/revert config files, remove routes, and delete DNS64/NAT64 containers.
func CleanupClusterNode ¶
CleanupClusterNode removes the kubelet drop-in file, management port's IP address, reverts /etc/hosts and /etc/resolv.conf, removes route for DNS network, and removes route to NAT64 server (when the node is not the node hosting the server).
func CleanupDNS64Server ¶
CleanupDNS64Server removes the DNS64 server and associated config files. The IPv4 default route is not altered.
func CleanupForPlugin ¶
CleanupForPlugin performs actions to cleanup the CNI plugin on a node, Including removing the CNI config file and area.
func CleanupNAT64Server ¶
CleanupNAT64Server removes the NAT64 server and route to server. The default IPv4 route is not touched.
func CleanupSupportNetwork ¶
CleanupSupportNetwork checks to see if the support network exists, and if so, removes the network.
func ConfigureManagementInterface ¶ added in v1.1.1
ConfigureManagementInterface adds and address and sets the MTU for the interface used for the pod and management networks.
func CopyFile ¶
CopyFile copies configuration files to another area. Used for placing needed certificates and keys that were created.
func CreateCNIConfigFile ¶ added in v1.2.0
CreateCNIConfigFile creates the config file based on the plugin selected. Default location for file is /etc/cni/net.d/.
func CreateCertKeyArea ¶
CreateCertKeyArea creates the area used to hold certificates used by KubeAdm.
func CreateCertificateForCA ¶
CreateCertificateForCA creates CA certificate and stores in a file.
func CreateConfigForDNS64 ¶
CreateConfigForDNS64 creates the needed configuration files for the DNS64 server.
func CreateDigestForCA ¶ added in v1.0.3
CreateDigestForCA creates the CA digest and extracts the hash for it.
func CreateKeyForCA ¶
CreateKeyForCA creates the CA key and stores it in a file.
func CreateKubeAdmConfigFile ¶
CreateKubeAdmConfigFile constructs the KubeAdm config file during the "prepare" step. This file can be modified, before using it in the "up" step.
func CreateKubeletDropInContents ¶
CreateKubeletDropInContents constructs the contents of the kubelet drop-in file to support IPv6.
func CreateKubeletDropInFile ¶
CreateKubeletDropInFile creates a config file to override the kubelet configuration, so that the correct address is used for DNS resolution.
func CreateNamedConfContents ¶
CreateNamedConfContents builds the contents of the configuration file used by the DNS64 server.
func CreateRSAForCA ¶ added in v1.0.3
CreateRSAForCA creates RSA key and stores in a file.
func CreateRouteToNAT64ServerForDNS64Subnet ¶ added in v1.0.3
CreateRouteToNAT64ServerForDNS64Subnet creates a route for the DNS64 network that points to the NAT64 server for proper routing of external addresses.
func CreateRouteToSupportNetworkForOtherNodes ¶ added in v1.0.3
CreateRouteToSupportNetworkForOtherNodes creates a route on a node, to get to the support netork, so that the DNS64 and NAT64 server can be accessed.
func CreateRoutesForPodNetwork ¶
CreateRoutesForPodNetwork establishes static routes between a node and all other nodes as part of the "up" operation.
func CreateSupportNetwork ¶
CreateSupportNetwork creates the network used by the DNS64 and NAT64 servers.
func CreateToken ¶ added in v1.0.3
CreateToken creates the shared token and extracts the value.
func CreateX509CertForCA ¶ added in v1.0.3
CreateX509CertForCA creates X.509 certificate and stores in a file.
func DoExecCommand ¶
DoExecCommand is a wrapper for performing OS commands and returning output or error. Can be overridden for unit tests.
func DoRouteOpsOnNodes ¶
DoRouteOpsOnNodes builds static routes between minion and master node for a CNI plugin, so that pods can communicate across nodes.
func EnsureCNIAreaExists ¶
EnsureCNIAreaExists makes sure there is an area for the CNI plugin's config files.
func EnsureDNS64Server ¶ added in v1.0.7
EnsureDNS64Server runs the DNS64 server, if it is not running. If it exists, but is not running, it is first deleted. If it is running, no action is taken.
func EnsureNAT64Server ¶ added in v1.0.7
EnsureNAT64Server creates the NAT64 container. If it is already running, no action is taken. If it exists, but is not running, it is deleted first.
func EnsureRouteToNAT64 ¶ added in v1.0.7
EnsureRouteToNAT64 adds a route to the NAT64 container via the support network.
func ExtractDigest ¶ added in v1.0.5
ExtractDigest parses the digest, extracting the hash and validating it.
func ExtractNetInfo ¶ added in v1.3.3
ExtractNetInfo obtains the prefix, size, and IP family from the provided CIDR.
func ExtractToken ¶ added in v1.0.5
ExtractToken extracts the access token and validates it, returning the value.
func FindHostIPForNAT64 ¶
FindHostIPForNAT64 determines the management IP for the node containing the NAT64 server.
func GenerateDefaultRoute ¶ added in v1.3.4
GenerateDefaultRoute creates the default route entry based on the IP mode. This will be called twice, if dual-stack mode.
func GetFileContents ¶
GetFileContents reads the contents of the specified file.
func GetNetAndMask ¶
GetNetAndMask obtains the network part and mask from the provided CIDR.
func Initialize ¶
Initialize performs steps for the "init" operation, creating certificate, key, token, and hash, and then updates the configuration YAML file with the token and hash, so that KubeAdm operations can be performed.
func MakePrefixFromNetwork ¶ added in v1.0.8
MakePrefixFromNetwork takes the network part of the CDIR, and builds an expanded prefix, so that a node ID can be added later to form the network part of the pod network. This means expanding "::" as needed, so that the prefix is fully qualified (and a :: can be added to the end later without causing a syntax error). This is done by determining how many 16 bit parts are needed and padding each missing part with a zero.
Also, if the network includes a final part that is 16 bits and only the upper eight bits are part of the prefix, then the lower byte will be removed so that the node ID can be placed there later.
Lastly, if we don't have this condition of the prefix containing the upper eight bits of the address, we'll place a colon on the end.
Examples:
fd00:40:: (72) -> fd00:40:0:0: fd00:10:20:30:4000:: (72) -> fd00:10:20:30:40 fd00:10:20:30:: (64) -> fd00:10:20:30: fd00:10:20:30:: (80) -> fd00:10:20:30:0:
func MakeV4PrefixFromNetwork ¶ added in v1.3.0
MakeV4PrefixFromNetwork extracts a prefix from the IPv4 address. It will always remove the last octet, regardless of subnet size.
func MatchingNodeIndex ¶
MatchingNodeIndex obtains the index of the node entry that matches the name of one of the existing nodes.
func OpenConfigFile ¶ added in v1.0.5
func OpenConfigFile(configFile string) (io.ReadCloser, error)
OpenConfigFile opens the TAML file with configuration settings.
func OpenPermissions ¶
OpenPermissions helper makes the directory read/write.
func ParseIPv4Address ¶
ParseIPv4Address extracts the CIDR from the interface's list of IP addresses.
func ParseVersion ¶ added in v1.3.1
ParseVersion takes a version string and extracts the major.minor part, returning an error, if invalid. Examples of valid versions are "v1.11.0" and "v1.13.0-alpha.0.2169+8f620950e246fa-dirty".
func PlaceCertificateAndKeyForCA ¶
PlaceCertificateAndKeyForCA copies generated files to the Kubernetes area so that KubeAdm can reference the information.
func Prepare ¶
Prepare gets ready to start up the cluster. The support network is created (if not on the NAT64/DNS64 node), the NAT64 and DNS64 servers are started, and the node is configured for running the cluster.
func PrepareClusterNode ¶
PrepareClusterNode performs steps on the node to prepare for bringing up the cluster. Includes adding the management IP, updating hosts and resolv.conf entries, creating a kubelet drop-in file, creating the KubeAdm configuration file (on master), and creating routes to servers and the support network.
func PrepareDNS64Server ¶
PrepareDNS64Server starts up the bind9 DNS64 server. Will use existing container, if running. Will remove IPv4 address in the container and add a route to the container.
func PrepareNAT64Server ¶
PrepareNAT64Server starts up the Tayga NAT64 server. NOTE: Will use existing container, if running
func RecoverFile ¶ added in v1.0.7
RecoverFile attempts to restore the backup of a file to the original.
func RegisterExecCommand ¶ added in v1.3.1
func RegisterExecCommand(cmdFunc ExecCommandFuncType)
RegisterExecCommand will register a OS command function for exec calls. Used ONLY by unit test.
func RemoveContainer ¶ added in v1.0.7
RemoveContainer checks to see if the container is present, and if so, removes the container.
func RemoveDropInFile ¶ added in v1.0.7
RemoveDropInFile eliminates the kubelet drop-in file as part of the cleanup operation.
func RemoveIPv4AddressOnDNS64Server ¶ added in v1.0.7
RemoveIPv4AddressOnDNS64Server removes IPv4 address in container, so there is only an IPv6 address.
func RemoveManagementIP ¶ added in v1.0.7
RemoveManagementIP removes the node's management IP off of the interface configured as the management port.
func RemoveRouteForDNS64 ¶ added in v1.0.7
RemoveRouteForDNS64 removes the route to the DNS64 network via the IPv4 support network, if on the NAT64 node, or via the NAT64 server's management IP, if not on the NAT64 server.
func RemoveRouteForNAT64 ¶ added in v1.0.7
RemoveRouteForNAT64 removes the route to the support network via the NAT64 server's manage,ent IP.
func RemoveRoutesForPodNetwork ¶
RemoveRoutesForPodNetwork removes static routes between nodes, as part of the "down" operation.
func RestartKubeletService ¶
func RestartKubeletService() error
RestartKubeletService restarts the service, after changes have been made to drop-in files.
func RevertConfigInfo ¶
RevertConfigInfo restores the contents of the provided config file, by using the comment tags that describe the additions settings (to be removed), and the previous settings (to be restored).
func RevertEntries ¶
RevertEntries obtains the config file contents, reverts the settings, and then stores the updated file (with a backup created, in case of issues).
func RevertEtcAreaFile ¶ added in v1.0.7
RevertEtcAreaFile will revert the entries in config files in the /etc/ area as part of cleanup.
func SaveFileContents ¶
SaveFileContents backs up the files (if it exists), and then saves the updated contents to the file. If the save fails, it attempts to restore the backup.
func SetupBaseAreas ¶ added in v1.0.5
SetupBaseAreas allows the configuration to hold the root for both the working files (overridable), and key configuration files. This will allow the user to specify a different work area in the former and for unit tests to specify a temp area for the latter.
func SetupForPlugin ¶
SetupForPlugin prepares the CNI plugin by making sure CNI area exists and then performing bridge specific setup.
func SetupHandles ¶ added in v1.0.7
SetupHandles configures pointers to the methods that will handle network and hypervisor operations.
func StartKubernetes ¶
StartKubernetes uses the KubeAdm init or join command to start up the cluster on the master or minion node, respectively.
func StopKubernetes ¶
func StopKubernetes() error
StopKubernetes is called during the "down" operation, to bring down the cluster.
func TearDown ¶
TearDown performs the "down" operations of bringing down the cluster, removing static routes, removing the Bridge plugin config file, and removing the bridge.
func UpdateConfigYAML ¶
UpdateConfigYAML adds the access token and hash to the configuration YAML file, replacing any existing entries.
func UpdateConfigYAMLContents ¶
UpdateConfigYAMLContents will parse through the provided config file contents and add the token and token certificate hash entries. Old values, if present, will be removed. The new fields will be placed inside of the general section.
func UpdateHostsInfo ¶
UpdateHostsInfo goes through the /etc/hosts file and updates the IP addresses for nodes that are called out in the configuration file. Any existing entry is commented out, with a special tag to allow restoration. New entries get a comment that can be use to remove them upon cleanup.
func UpdateResolvConfInfo ¶
UpdateResolvConfInfo updates the nameservers to use the ones defined for the cluster. Old entries are commented out, and new ones tagged, allowing later restoration, during cleanup.
func ValidateCIDR ¶ added in v1.0.4
ValidateCIDR ensures that the CIDR is valid.
func ValidateCommand ¶
ValidateCommand ensures that the command specified is supported.
func ValidateConfigContents ¶
ValidateConfigContents checks contents of the config file. Token and certificate hash validation is ignored during init phase, which will generate these values, or if running in insecure mode. Side effect is that base paths are set up based on defaults (unless overriden by config file). The netlink library handle is set (allowing UTs to override and mock that library). TODO: Validate support net v4 subnet > NAT64 subnet
func ValidateDNS64Fields ¶ added in v1.1.1
ValidateDNS64Fields checks user supplied DNS64 settings, applies defaults, and handles any deprecated fields.
func ValidateHost ¶
ValidateHost ensures that the host is mentioned in the configuration.
func ValidateNAT64Fields ¶ added in v1.1.2
ValidateNAT64Fields checks that the subnet for the IPv4 mapping address (assumed /16), contains the subnet used for the IPv4 mapping pool, and that both are valid.
func ValidateNetworkMode ¶ added in v1.3.0
ValidateNetworkMode makes sure that only the supported network modes are entered. Currently, this is ipv4, ipv6, or dual-stack. The default is IPv6, when not specified.
func ValidateNodeOpModes ¶
ValidateNodeOpModes checks that valid operational mode names are used. NOTE: Side effect of saving the operating modes as flags, for easier use.
func ValidateOpModesForAllNodes ¶
ValidateOpModesForAllNodes checks the operation mode for all nodes, and ensures that there is exactly one master node. Note: Side effect is storing node name in node struct for ease of access
TODO: determine if allow duplicate DNS/NAT nodes TODO: test missing DNS/NAT node
func ValidatePlugin ¶ added in v1.0.5
ValidatePlugin ensures the plugin name is valid. Side effect of storing legacy value into new field.
func ValidatePodFields ¶ added in v1.1.1
ValidatePodFields checks user supplied pod network settings, applies defaults, and handles any deprecated fields.
func ValidateSoftwareVersions ¶ added in v1.3.1
ValidateSoftwareVersions checks that the software used is compatible with the Lazyjack tool. As a side effect, the kubeadm version (major.minor) is stored, so that the proper config file can be generated.
If the user specifies the Kubernetes version to use, this makes sure that it is the same major/minor version as KubeAdm.
This function only checks kubeadm, but could check kubectl in the future.
func ValidateToken ¶
ValidateToken ensures that the token exists and seems valid. This check is skipped during the init operation, where the token is created.
func ValidateTokenCertHash ¶
ValidateTokenCertHash ensures that the token certificate hash exists and seems valid. This check is skipped during the init operation, where the hash is created.
func ValidateUniqueIDs ¶
ValidateUniqueIDs ensures that the node IDs are unique.
func WriteConfigForIPAM ¶ added in v1.3.5
WriteConfigForIPAM creates the section of the CNI configuration that contains the IPAM information with subnet and gateway information for the pod network(s).
Types ¶
type BridgePlugin ¶ added in v1.2.0
type BridgePlugin struct {
Config *Config
}
BridgePlugin implements the actions needed for the Bridge CNI plugin.
func (BridgePlugin) Cleanup ¶ added in v1.2.0
func (b BridgePlugin) Cleanup(n *Node) error
Cleanup performs Bridge plugin actions to clean up for a node. Includes deleting routes between nodes.
func (BridgePlugin) Setup ¶ added in v1.2.0
func (b BridgePlugin) Setup(n *Node) error
Setup will take Bridge plugin specific actions to setup a node. Includes setting up routes between nodes.
func (BridgePlugin) WriteConfigContents ¶ added in v1.3.5
func (b BridgePlugin) WriteConfigContents(node *Node, w io.Writer) (err error)
WriteConfigContents builds the CNI bridge plugin's config file contents. The subnet will be eight bits smaller than the pod cluster network size.
type Config ¶
type Config struct { Plugin string `yaml:"plugin"` // Deprecated General GeneralSettings `yaml:"general"` Topology map[string]Node Support SupportNetwork `yaml:"support_net"` Mgmt ManagementNetwork `yaml:"mgmt_net"` Pod PodNetwork `yaml:"pod_net"` Service ServiceNetwork `yaml:"service_net"` NAT64 NAT64Config `yaml:"nat64"` DNS64 DNS64Config `yaml:"dns64"` }
Config defines the top level configuration read from YAML file.
func LoadConfig ¶
func LoadConfig(cf io.ReadCloser) (*Config, error)
LoadConfig parses the stream provided into the configuration structure.
type DNS64Config ¶
type DNS64Config struct { RemoteV4Server string `yaml:"remote_server"` CIDR string `yaml:"cidr"` CIDRPrefix string ServerIP string `yaml:"ip"` AllowIPv6Use bool `yaml:"allow_ipv6_use"` // Deprecated AllowAAAAUse bool `yaml:"allow_aaaa_use"` }
DNS64Config defines information for the DNS64 server configuration.
type Docker ¶ added in v1.0.7
type Docker struct {
Command string
}
Docker represents a concrete hypervisor implementation.
func (*Docker) AddV6Route ¶ added in v1.0.7
AddV6Route performs docker command to add an IPv6 route.
func (*Docker) CreateNetwork ¶ added in v1.0.7
CreateNetwork performs docker command to create a network.
func (*Docker) CreateVolume ¶ added in v1.2.1
CreateVolume creates a new docker volume
func (*Docker) DeleteContainer ¶ added in v1.0.7
DeleteContainer constructs arguments to remove a container.
func (*Docker) DeleteNetwork ¶ added in v1.0.7
DeleteNetwork performs docker command to delete a network.
func (*Docker) DeleteV4Address ¶ added in v1.0.7
DeleteV4Address performs docker command to remove the IPv4 address from the container's eth0 interface.
func (*Docker) DeleteVolume ¶ added in v1.2.1
DeleteVolume force deletes a docker volume. No error occurs, if volume doesn't exist.
func (*Docker) DoCommand ¶ added in v1.2.1
DoCommand performs a docker command, collecting and returning output. TODO: Perform in a separate go-routine with a timeout, and abort handling.
func (*Docker) GetInterfaceConfig ¶ added in v1.0.7
GetInterfaceConfig performs docker command to obtain an interface's IP addresses.
func (*Docker) GetVolumeMountPoint ¶ added in v1.2.1
GetVolumeMountPoint obtains the mount point so that files can be deposited from host.
func (*Docker) ResourceState ¶ added in v1.0.7
ResourceState method obtains the state of the resource, which can be not present, existing, or running (for container resources).
type ExecCommandFuncType ¶ added in v1.3.1
ExecCommandFuncType is a function for performing OS commands
type GeneralSettings ¶ added in v1.0.5
type GeneralSettings struct { Mode string `yaml:"mode"` Plugin string `yaml:"plugin"` Token string `yaml:"token"` // Internal TokenCertHash string `yaml:"token-cert-hash"` // Internal WorkArea string `yaml:"work-area"` CNIPlugin PluginAPI // Internal SystemdArea string // Internal EtcArea string // Internal CNIArea string // Internal K8sCertArea string // Internal NetMgr Networker // Internal Hyper Hypervisor // Internal KubeAdmVersion string // Internal FullKubeAdmVersion string // Internal K8sVersion string `yaml:"kubernetes-version"` Insecure bool `yaml:"insecure"` }
GeneralSettings defines general settings used by the app.
type Hypervisor ¶ added in v1.0.7
type Hypervisor interface { ResourceState(r string) string DeleteContainer(string) error RunContainer(string, []string) error CreateNetwork(string, string, string, string) error DeleteNetwork(string) error GetInterfaceConfig(string, string) (string, error) DeleteV4Address(string, string) error AddV6Route(string, string, string) error CreateVolume(string) error DeleteVolume(string) error GetVolumeMountPoint(string) (string, error) }
Hypervisor interface indicates the general API for hypervisor operations.
type KubeAdmConfigInfo ¶ added in v1.3.1
type KubeAdmConfigInfo struct { AdvertiseAddress string AuthToken string BindAddress string BindPort int DNS_ServiceIP string K8sVersion string KubeMasterName string PodNetworkCIDR string ServiceSubnet string UseCoreDNS bool }
KubeAdmConfigInfo provides values for the templates used to populate the kubeadm.conf file (contents).
func CollectKubeAdmConfigInfo ¶ added in v1.3.1
func CollectKubeAdmConfigInfo(n *Node, c *Config) KubeAdmConfigInfo
type ManagementNetwork ¶
type ManagementNetwork struct { CIDR string `yaml:"cidr"` CIDR2 string `yaml:"cidr2"` Info [2]NetInfo //Internal }
ManagementNetwork defines information for the management network.
type NAT64Config ¶
type NAT64Config struct { V4MappingCIDR string `yaml:"v4_cidr"` V4MappingIP string `yaml:"v4_ip"` ServerIP string `yaml:"ip"` }
NAT64Config defines information for the NAT64 server configuration.
type NetLink ¶ added in v1.0.8
type NetLink struct {
// contains filtered or unexported fields
}
NetLink defines the structure for netlink implementation of networking
func (*NetLink) AddrReplace ¶ added in v1.0.8
AddrReplace replaces IP address on a link
func (*NetLink) LinkByName ¶ added in v1.0.8
LinkByName finds a link by name
func (*NetLink) LinkSetDown ¶ added in v1.0.8
LinkSetDown brings down an interface
func (*NetLink) LinkSetMTU ¶ added in v1.1.1
func (*NetLink) ParseIPNet ¶ added in v1.0.8
ParseIPNet parses the string as an IPNet object.
type NetLinkAPI ¶ added in v1.0.8
type NetLinkAPI interface { AddrDel(netlink.Link, *netlink.Addr) error AddrList(netlink.Link, int) ([]netlink.Addr, error) AddrReplace(netlink.Link, *netlink.Addr) error LinkByName(name string) (netlink.Link, error) LinkList() ([]netlink.Link, error) ParseAddr(string) (*netlink.Addr, error) ParseIPNet(s string) (*net.IPNet, error) RouteAdd(route *netlink.Route) error RouteDel(route *netlink.Route) error LinkSetDown(link netlink.Link) error LinkDel(link netlink.Link) error LinkSetMTU(link netlink.Link, mtu int) error }
NetLinkAPI interface representing low level API to netlink package. Used to allow mocking for testing.
type NetMgr ¶ added in v1.0.8
type NetMgr struct {
Server NetLinkAPI
}
NetMgr defines the structure for a netlink implementation for networking.
func (NetMgr) AddAddressToLink ¶ added in v1.0.8
AddAddressToLink method adds an IP address to a link, replacing the existing address, if any.
func (NetMgr) AddRouteUsingInterfaceName ¶ added in v1.0.8
AddRouteUsingInterfaceName method adds a route to the destination, using the local interface.
func (NetMgr) AddRouteUsingSupportNetInterface ¶ added in v1.0.8
AddRouteUsingSupportNetInterface method adds a route to the destination using the gateway and support network CIDR.
func (NetMgr) AddressExistsOnLink ¶ added in v1.0.8
AddressExistsOnLink checks to see if the address to be deleted, is on the link. If we are unable to obtain link info, we'll assume address is not there, and will later skip trying to remove it.
func (NetMgr) BringLinkDown ¶ added in v1.0.8
BringLinkDown method shuts down the link specified.
func (NetMgr) DeleteLink ¶ added in v1.0.8
DeleteLink method deletes the link specified.
func (NetMgr) DeleteRouteUsingInterfaceName ¶ added in v1.0.8
DeleteRouteUsingInterfaceName method removes the route to the destination that uses the local interface.
func (NetMgr) DeleteRouteUsingSupportNetInterface ¶ added in v1.0.8
DeleteRouteUsingSupportNetInterface method removes the route to the destination that uses the provided CIDR.
func (NetMgr) FindLinkIndexForCIDR ¶ added in v1.0.8
FindLinkIndexForCIDR method obtains the index of the interface that contains the CIDR.
func (NetMgr) RemoveAddressFromLink ¶ added in v1.0.8
RemoveAddressFromLink method removes an IP addres from an interface.
func (NetMgr) RemoveBridge ¶ added in v1.0.8
RemoveBridge method removes the specified bridge.
type Networker ¶ added in v1.0.8
type Networker interface { AddAddressToLink(ip, intf string) error RemoveAddressFromLink(ip, intf string) error AddRouteUsingSupportNetInterface(dest, gw, supportNetCIDR string) error DeleteRouteUsingSupportNetInterface(dest, gw, supportNetCIDR string) error AddRouteUsingInterfaceName(dest, gw, intf string) error DeleteRouteUsingInterfaceName(dest, gw, intf string) error BringLinkDown(name string) error DeleteLink(name string) error RemoveBridge(name string) error SetLinkMTU(name string, mtu int) error }
Networker interface describes the API for networking operations
type Node ¶
type Node struct { Interface string `yaml:"interface"` ID int `yaml:"id"` OperatingModes string `yaml:"opmodes"` Name string IsMaster bool IsMinion bool IsDNS64Server bool IsNAT64Server bool }
Node defines information for the node.
func DetermineMasterNode ¶
DetermineMasterNode identifies which node configuration entry is for the master node.
type NodeInfo ¶
NodeInfo holds name, IP address, and an indication that the node has been "visited".
func BuildNodeInfo ¶
BuildNodeInfo creates a slice with all information on all the nodes sorted in alphabetical order.
type PluginAPI ¶ added in v1.2.0
type PluginAPI interface { WriteConfigContents(node *Node, w io.Writer) error Setup(n *Node) error Cleanup(n *Node) error }
PluginAPI interface defines the actions for CNI plugins to implement.
type PodNetwork ¶
type PodNetwork struct { CIDR string `yaml:"cidr"` CIDR2 string `yaml:"cidr2"` Info [2]NetInfo // Internal MTU int `yaml:"mtu"` }
PodNetwork defines information for the the pod network.
type PointToPointPlugin ¶ added in v1.2.0
type PointToPointPlugin struct {
Config *Config
}
PointToPointPlugin implements the actions needed for the PTP CNI plugin.
func (PointToPointPlugin) Cleanup ¶ added in v1.2.0
func (p PointToPointPlugin) Cleanup(n *Node) error
Cleanup performs PTP plugin actions to clean up for a node. Includes deleting routes between nodes.
func (PointToPointPlugin) Setup ¶ added in v1.2.0
func (p PointToPointPlugin) Setup(n *Node) error
Setup will take PTP plugin specific actions to setup a node. Includes setting up routes between nodes.
func (PointToPointPlugin) WriteConfigContents ¶ added in v1.3.5
func (p PointToPointPlugin) WriteConfigContents(node *Node, w io.Writer) (err error)
WriteConfigContents builds the CNI PTP plugin's config file contents.
type ServiceNetwork ¶
ServiceNetwork defines information for the service network.
type SupportNetwork ¶
type SupportNetwork struct { CIDR string `yaml:"cidr"` Info NetInfo // Internal V4CIDR string `yaml:"v4cidr"` }
SupportNetwork defines information for the support network.