Documentation ¶
Index ¶
- Constants
- Variables
- func AddDefaultIptablesRules(ctx context.Context, client ssh.Client, ipversion IPVersion) error
- func AddIngressIptablesRules(ctx context.Context, client ssh.Client, label string, cidrs, destIp IPs, ...) error
- func AddIptablesRules(ctx context.Context, client ssh.Client, label string, rules *FirewallRules) error
- func BackupKubeconfig(ctx context.Context, client ssh.Client)
- func ConfigureMetalLb(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst, ...) error
- func CopyFile(src string, dst string) error
- func CopyKubeConfig(ctx context.Context, rootLBClient ssh.Client, ...) error
- func CreateCloudletNode(ctx context.Context, config *confignode.ConfigureNodeVars, ...) error
- func CreateClusterConfigMap(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst) error
- func CreateDockerRegistrySecret(ctx context.Context, client ssh.Client, kconf string, imagePath string, ...) error
- func DefaultKubeconfig() string
- func DeleteDataFromVault(config *vault.Config, path string) error
- func DeleteDockerRegistrySecret(ctx context.Context, client ssh.Client, kconf string, imagePath string, ...) error
- func DeleteIptablesRules(ctx context.Context, client ssh.Client, label string, rules *FirewallRules) error
- func DoIptablesCommand(ctx context.Context, client ssh.Client, rule string, ruleExists bool, ...) error
- func ExecTemplate(templateName, templateString string, templateData interface{}) (*bytes.Buffer, error)
- func FormatDuration(dur time.Duration, digIdx int) string
- func GenerateNetworkFileDetailsForIP(ctx context.Context, portName string, ifName string, ipAddr string, ...) (string, string, string, error)
- func GetAppWhitelistRulesLabel(app *edgeproto.App) string
- func GetDockerCrtFile(crtFilePath string) (string, error)
- func GetEnvVarsFromVault(ctx context.Context, config *vault.Config, path string) (map[string]string, error)
- func GetHTTPFile(ctx context.Context, uri string) ([]byte, error)
- func GetMacAddrToInterfaceNames(ctx context.Context, client ssh.Client) (map[string]string, map[string]string, error)
- func GetNetplanFilename(portName string) string
- func GetPlatformConfig(cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, ...) *pf.PlatformConfig
- func GetReqErr(reqBody io.ReadCloser) error
- func GetServerSecurityGroupName(serverName string) string
- func GetSvcExternalIpOrHost(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, ...) (string, string, error)
- func GetUniqueLoopbackIp(ctx context.Context, ports []dme.AppPort) string
- func GetUrlInfo(ctx context.Context, accessApi platform.AccessApi, fileUrlPath string) (time.Time, string, error)
- func GetVaultCloudletCommonPath(filePath string) string
- func GetVaultDataString(ctx context.Context, config *vault.Config, path string) ([]byte, error)
- func GetVaultDataToFile(config *vault.Config, path, fileName string) error
- func HandlePlatformSwitchToActive(ctx context.Context, cloudletKey *edgeproto.CloudletKey, caches *pf.Caches, ...)
- func IPIndexOf(ipType IPVersion) int
- func IncrIP(ip net.IP)
- func InstallAndConfigMetalLbIfNotInstalled(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst, ...) error
- func InstallMetalLb(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst) error
- func InternEnv(envs map[string]string) error
- func IsMetalLbInstalled(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst, ...) (bool, error)
- func KubePatchServiceIP(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, ...) error
- func ParseIpRanges(ipranges string) ([]string, error)
- func PersistIptablesRules(ctx context.Context, client ssh.Client, ipversion IPVersion) error
- func PutDataToVault(config *vault.Config, path string, data map[string]interface{}) error
- func RemoveIngressIptablesRules(ctx context.Context, client ssh.Client, label string, cidrs, destIP IPs, ...) error
- func RemoveRulesForLabel(ctx context.Context, client ssh.Client, label string) error
- func SCPFilePath(sshClient ssh.Client, srcPath, dstPath string) error
- func ServerIsNetplanEnabled(ctx context.Context, client ssh.Client) bool
- func SetEdgeboxMode(mode bool)
- func SetTestMode(tMode bool)
- func Sh(envVars map[string]string) *sh.Session
- func VerifyMetalLbRunning(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst, ...) error
- func WriteTemplateFile(filename string, buf *bytes.Buffer) error
- type CloudletManifest
- type CloudletManifestItem
- type CommonEmbedded
- type CommonPlatform
- func (c *CommonPlatform) ActivateFQDN(ctx context.Context, fqdn, addr string, ipversion IPVersion) error
- func (c *CommonPlatform) AddProxySecurityRulesAndPatchDNS(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, ...) error
- func (c *CommonPlatform) CreateAppDNSAndPatchKubeSvc(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, ...) error
- func (c *CommonPlatform) DeleteAppDNS(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, ...) error
- func (c *CommonPlatform) DeleteCloudletFirewallRules(ctx context.Context, client ssh.Client) error
- func (c *CommonPlatform) DeleteDNSRecords(ctx context.Context, fqdn string) error
- func (c *CommonPlatform) DeleteIptableRulesForCloudletWideLabel(ctx context.Context, client ssh.Client) error
- func (c *CommonPlatform) DeleteProxySecurityGroupRules(ctx context.Context, client ssh.Client, proxyName string, ...) error
- func (c *CommonPlatform) GetCloudletDNSZone() string
- func (c *CommonPlatform) GetMappedExternalIP(ip string) string
- func (cp *CommonPlatform) GetSSHClientFromIPAddr(ctx context.Context, ipaddr string, ops ...pc.SSHClientOp) (ssh.Client, error)
- func (c *CommonPlatform) InitInfraCommon(ctx context.Context, platformConfig *pf.PlatformConfig, ...) error
- func (c *CommonPlatform) ValidateExternalIPMapping(ctx context.Context, ip string) error
- type DnsSvcAction
- type EnvData
- type ErrorResp
- type FirewallRule
- type FirewallRules
- type GetDnsSvcActionFunc
- type IPVersion
- type IPs
- type ImageCategoryType
- type ImageInfo
- type InfraProperties
- func (ip *InfraProperties) GetCloudletCRMGatewayIPAndPort() (string, int)
- func (ip *InfraProperties) GetPlatformStatsMaxCacheTime() (uint64, error)
- func (p *InfraProperties) GetValue(key string) (string, bool)
- func (p *InfraProperties) Init()
- func (p *InfraProperties) SetProperties(props map[string]*edgeproto.PropertyInfo)
- func (p *InfraProperties) SetPropsFromVars(ctx context.Context, vars map[string]string)
- func (p *InfraProperties) SetValue(key, value string)
- func (p *InfraProperties) UpdatePropsFromVars(ctx context.Context, vars map[string]string)
- type InitOp
- type InitOptions
- type InterfaceActionsOp
- type IptablesChanges
- type IptablesRules
- type ManifestContentSubType
- type ManifestContentType
- type MetalConfigmapParams
- type NetIPs
- type NetplanDevice
- type NetplanDeviceMatch
- type NetplanEthernet
- type NetplanFile
- type NetplanInfo
- type NetplanNameservers
- type NetplanNetwork
- type NetplanRoute
- type NetworkConfig
- type PortSourceOrDestChoice
- type ProxyDnsSecOpts
- type VaultData
- type VaultEnvData
- type WhiteListFunc
- type WhiteListParams
Constants ¶
const ( NumIPTypes = 2 IndexIPV4 = 0 IndexIPV6 = 1 )
const ( IPTablesBin = "iptables" IP6TablesBin = "ip6tables" IPTablesSaveBin = "iptables-save" IP6TablesSaveBin = "ip6tables-save" IPTablesPersistCmd = "iptables-save > /etc/iptables/rules.v4" IP6TablesPersistCmd = "ip6tables-save > /etc/iptables/rules.v6" )
const ManifestTypeCommand = "command"
const NetplanFileNotFound = "netplan file not found"
const RemoteCidrAll = "0.0.0.0/0"
const RemoteCidrAllIPV6 = "::/0"
const RemoteCidrNone = "0.0.0.0/32"
const TrustPolicySecGrpNameLabel string = "trust-policy"
Variables ¶
var ClientVersion = "SSH-2.0-mobiledgex-ssh-client-1.0"
var CloudletPlatformActive = "CloudletPlatformActive"
var DefaultConnectTimeout time.Duration = 30 * time.Second
var DefaultMetalLbNamespace = "metallb-system"
metalLb usually installs here but can be configured in a different NS
var DestIPUnspecified = IPs{}
var InfraCommonProps = map[string]*edgeproto.PropertyInfo{ "MEX_EXTERNAL_IP_MAP": &edgeproto.PropertyInfo{ Name: "External IP Map", Description: "External IP Map", }, "FLAVOR_MATCH_PATTERN": &edgeproto.PropertyInfo{ Name: "Flavor Match Pattern", Description: "Flavors matching this pattern will be used by Cloudlet to bringup VMs", Value: ".*", }, "SKIP_INSTALL_RESOURCE_TRACKER": &edgeproto.PropertyInfo{ Name: "Skip Install Resource Tracker", Description: "If set to true, the resource tracker is not installed to save time. For test only", Internal: true, }, "MEX_CRM_GATEWAY_ADDR": { Name: "CRM Gateway Address", Description: "Required if infra API endpoint is completely isolated from external network", }, "MEX_PLATFORM_STATS_MAX_CACHE_TIME": { Name: "Platform Stats Max Cache Time", Description: "Maximum time to used cached platform stats if nothing changed, in seconds", Internal: true, Value: "3600", }, "MEX_SHARED_ROOTLB_NAME": { Name: "Shared rootLB name", Description: "Used for backwards compatibility if appDnsRoot changes", }, }
Cloudlet Infra Common Properties
var MetalLbAddressPool = `` /* 332-byte string literal not displayed */
var NoDnsOverride = ""
var SSHOpts = []string{"StrictHostKeyChecking=no", "UserKnownHostsFile=/dev/null", "LogLevel=ERROR"}
var SSHUser = "ubuntu"
Functions ¶
func AddDefaultIptablesRules ¶
AddDefaultIptablesRules adds the default set of rules which are always needed
func AddIngressIptablesRules ¶
func AddIngressIptablesRules(ctx context.Context, client ssh.Client, label string, cidrs, destIp IPs, ports []dme.AppPort) error
AddIngressIptablesRules adds rules using a CIDR and AppPorts as input
func AddIptablesRules ¶
func AddIptablesRules(ctx context.Context, client ssh.Client, label string, rules *FirewallRules) error
AddIptablesRules adds a set of rules
func ConfigureMetalLb ¶
func CopyKubeConfig ¶
func CopyKubeConfig(ctx context.Context, rootLBClient ssh.Client, clusterInst *edgeproto.ClusterInst, rootLBName, masterIP string) error
CopyKubeConfig copies over kubeconfig from the cluster
func CreateCloudletNode ¶
func CreateCloudletNode(ctx context.Context, config *confignode.ConfigureNodeVars, accessApi platform.AccessApi) error
CreateCloudletNode requests the Controller via the accessApi to register a new cloudlet node, and stores the new password into ConfigureNodeVars.
func CreateClusterConfigMap ¶
func CreateClusterConfigMap(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst) error
ConfigMap of cluster instance details such as cluster name, cloudlet name, and operator name
func CreateDockerRegistrySecret ¶
func CreateDockerRegistrySecret(ctx context.Context, client ssh.Client, kconf string, imagePath string, authApi cloudcommon.RegistryAuthApi, names *k8smgmt.KubeNames, existingCreds *cloudcommon.RegistryAuth) error
func DefaultKubeconfig ¶
func DefaultKubeconfig() string
func DeleteDockerRegistrySecret ¶
func DeleteDockerRegistrySecret(ctx context.Context, client ssh.Client, kconf string, imagePath string, authApi cloudcommon.RegistryAuthApi, names *k8smgmt.KubeNames, existingCreds *cloudcommon.RegistryAuth) error
func DeleteIptablesRules ¶
func DeleteIptablesRules(ctx context.Context, client ssh.Client, label string, rules *FirewallRules) error
DeleteIptablesRules deletes a set of rules
func DoIptablesCommand ¶
func DoIptablesCommand(ctx context.Context, client ssh.Client, rule string, ruleExists bool, action *InterfaceActionsOp, ipversion IPVersion) error
DoIptablesCommand runs an iptables add or delete conditionally based on whether the entry already exists or not
func ExecTemplate ¶
func FormatDuration ¶
round the given field denoted by digIdx, we mostly want seconds rounded to two digits
func GenerateNetworkFileDetailsForIP ¶
func GenerateNetworkFileDetailsForIP(ctx context.Context, portName string, ifName string, ipAddr string, maskbits uint32, ipv6Addr string) (string, string, string, error)
GenerateNetworkFileDetailsForIP returns interfaceFileName, fileMatchPattern, contents based on whether netplan is enabled Deprecated: should instead use GetNetworkConfig
func GetDockerCrtFile ¶
func GetEnvVarsFromVault ¶
func GetEnvVarsFromVault(ctx context.Context, config *vault.Config, path string) (map[string]string, error)
GetEnvVarsFromVault is deprecated, use accessvars.GetCloudletAccessVars instead.
func GetNetplanFilename ¶
func GetPlatformConfig ¶
func GetPlatformConfig(cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, pfInitConfig *pf.PlatformInitConfig) *pf.PlatformConfig
GetPlatformConfig builds a platform.PlatformConfig from a cloudlet and an edgeproto.PlatformConfig
func GetReqErr ¶
func GetReqErr(reqBody io.ReadCloser) error
for reading errors from an http response
func GetServerSecurityGroupName ¶
GetServerSecurityGroupName gets the secgrp name based on the server name
func GetSvcExternalIpOrHost ¶
func GetSvcExternalIpOrHost(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, name string) (string, string, error)
GetSvcExternalIpOrHost returns ipaddr, hostname. Either the IP or the DNS will be blank depending on whether the service has an IP address or a name.
func GetUniqueLoopbackIp ¶
GetUniqueLoopbackIp returns an IP on the loopback interface, which is anything in the 127.0.0.0/8 subnet. The purpose is to have a unique loopback IP which can be used for the envoy metrics port. The IP returned is derived from the highest number app port as follows First octet: 127 Second octet: 1 if highest port is TCP, 2 if highest port is UDP Third and fourth octets: highest port number
func GetUrlInfo ¶
func GetVaultDataString ¶
Get data from Vault as a string
func GetVaultDataToFile ¶
func HandlePlatformSwitchToActive ¶
func HandlePlatformSwitchToActive(ctx context.Context, cloudletKey *edgeproto.CloudletKey, caches *pf.Caches, clusterInstCleanupFunc func(ctx context.Context, clusterInst *edgeproto.ClusterInst, updateCallback edgeproto.CacheUpdateCallback) error, appInstCleanupFunc func(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, updateCallback edgeproto.CacheUpdateCallback) error)
HandlePlatformSwitchToActive handles the case when a formerly standby CRM becomes active, including in-progress provisioning requests which must be cleaned using the provided functions
func InstallMetalLb ¶
func IsMetalLbInstalled ¶
func KubePatchServiceIP ¶
func KubePatchServiceIP(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, servicename, ipaddr, ipv6Addr, namespace string) error
KubePatchServiceIP updates the service to have the given external ip. This is done locally and not thru an ssh client
func ParseIpRanges ¶
ParseIpRanges takes a list of comma-separated IP ranges such as 139.178.83.27/29-139.178.83.30/29,139.178.87.10/29-139.178.87.14/29 and returns a slice of all the IP addresses
func PersistIptablesRules ¶
func PutDataToVault ¶
func RemoveIngressIptablesRules ¶
func RemoveIngressIptablesRules(ctx context.Context, client ssh.Client, label string, cidrs, destIP IPs, ports []dme.AppPort) error
RemoveIngressIptablesRules removes rules using a CIDR and AppPorts as input
func RemoveRulesForLabel ¶
func ServerIsNetplanEnabled ¶
The base image currently only supports netplan.
func SetEdgeboxMode ¶
func SetEdgeboxMode(mode bool)
func SetTestMode ¶
func SetTestMode(tMode bool)
func VerifyMetalLbRunning ¶
Types ¶
type CloudletManifest ¶
type CloudletManifest struct {
ManifestItems []CloudletManifestItem
}
func (*CloudletManifest) AddItem ¶
func (m *CloudletManifest) AddItem(title string, contentType ManifestContentType, contentSubType ManifestContentSubType, content string)
func (*CloudletManifest) AddSubItem ¶
func (m *CloudletManifest) AddSubItem(title string, contentType ManifestContentType, contentSubType ManifestContentSubType, content string)
func (*CloudletManifest) ToString ¶
func (m *CloudletManifest) ToString() (string, error)
type CloudletManifestItem ¶
type CloudletManifestItem struct { Id uint32 Title string ContentType ManifestContentType ContentSubType ManifestContentSubType Content string SubManifests []CloudletManifestItem }
type CommonEmbedded ¶
type CommonEmbedded struct{}
func (*CommonEmbedded) GetVersionProperties ¶
func (c *CommonEmbedded) GetVersionProperties(ctx context.Context) map[string]string
type CommonPlatform ¶
type CommonPlatform struct { Properties InfraProperties PlatformConfig *pf.PlatformConfig MappedExternalIPs map[string]string DeploymentTag string }
func (*CommonPlatform) ActivateFQDN ¶
func (c *CommonPlatform) ActivateFQDN(ctx context.Context, fqdn, addr string, ipversion IPVersion) error
ActivateFQDN updates and ensures Fqdn is registered properly
func (*CommonPlatform) AddProxySecurityRulesAndPatchDNS ¶
func (c *CommonPlatform) AddProxySecurityRulesAndPatchDNS(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, app *edgeproto.App, appInst *edgeproto.AppInst, getDnsSvcAction GetDnsSvcActionFunc, whiteListAdd WhiteListFunc, wlParams *WhiteListParams, proxyConfig *proxy.ProxyConfig, ops ProxyDnsSecOpts, proxyops ...proxy.Op) error
AddProxySecurityRulesAndPatchDNS Adds security rules and dns records in parallel
func (*CommonPlatform) CreateAppDNSAndPatchKubeSvc ¶
func (c *CommonPlatform) CreateAppDNSAndPatchKubeSvc(ctx context.Context, client ssh.Client, kubeNames *k8smgmt.KubeNames, overrideDns string, getSvcAction GetDnsSvcActionFunc) error
Register DNS entries for externally visible services. The passed in GetDnsSvcActionFunc function should provide this function with the actions to perform for each service, since different platforms will use different IPs and patching.
func (*CommonPlatform) DeleteAppDNS ¶
func (*CommonPlatform) DeleteCloudletFirewallRules ¶
DeleteCloudletFirewallRules deletes cloudlet-wide rules based on properties
func (*CommonPlatform) DeleteDNSRecords ¶
func (c *CommonPlatform) DeleteDNSRecords(ctx context.Context, fqdn string) error
func (*CommonPlatform) DeleteIptableRulesForCloudletWideLabel ¶
func (*CommonPlatform) DeleteProxySecurityGroupRules ¶
func (c *CommonPlatform) DeleteProxySecurityGroupRules(ctx context.Context, client ssh.Client, proxyName string, whiteListDel WhiteListFunc, wlParams *WhiteListParams) error
func (*CommonPlatform) GetCloudletDNSZone ¶
func (c *CommonPlatform) GetCloudletDNSZone() string
func (*CommonPlatform) GetMappedExternalIP ¶
func (c *CommonPlatform) GetMappedExternalIP(ip string) string
GetMappedExternalIP returns the IP that the input IP should be mapped to. This is used for environments which used NATted external IPs
func (*CommonPlatform) GetSSHClientFromIPAddr ¶
func (cp *CommonPlatform) GetSSHClientFromIPAddr(ctx context.Context, ipaddr string, ops ...pc.SSHClientOp) (ssh.Client, error)
GetSSHClientFromIPAddr returns ssh client handle for the given IP.
func (*CommonPlatform) InitInfraCommon ¶
func (c *CommonPlatform) InitInfraCommon(ctx context.Context, platformConfig *pf.PlatformConfig, platformSpecificProps map[string]*edgeproto.PropertyInfo, ops ...InitOp) error
func (*CommonPlatform) ValidateExternalIPMapping ¶
func (c *CommonPlatform) ValidateExternalIPMapping(ctx context.Context, ip string) error
ValidateExternalIPMapping checjs mapped IPs are defined but there is no entry for this particular IP, then it may indicate a provisioning error in which the external range is not matched with the internal range
type DnsSvcAction ¶
type DnsSvcAction struct { // if non-empty string, DNS entry will be created against this IP // for the service. The DNS name is derived from App parameters. ExternalIP string // IPv6 external IP ExternalIPV6 string // AWS uses hostname for service Hostname string // True to patch the kubernetes service with the Patch IP. PatchKube bool // IP to patch the kubernetes service with. If empty, will use // ExternalIP instead. PatchIP string // IPv6 to patch the kubernetes service with. If empty, will use // ExternalIPV6 instead. PatchIPV6 string // Should we add DNS, or not AddDNS bool }
type FirewallRule ¶
type FirewallRules ¶
type FirewallRules struct { EgressRules []FirewallRule IngressRules []FirewallRule }
type GetDnsSvcActionFunc ¶
type GetDnsSvcActionFunc func(svc v1.Service) (*DnsSvcAction, error)
Callback function for callers to control the behavior of DNS changes.
type IPs ¶
type IPs [NumIPTypes]string
IPs is a fixed length array of IP addresses based on type.
func GetAllowedClientCIDR ¶
func GetAllowedClientCIDR() IPs
func GetExternalPublicAddr ¶
GetExternalPublicAddr gets the externally visible public IP address
func GetIPAddressFromNetplan ¶
GetIPAddressFromNetplan returns the ipv4 and ipv6 addr Deprecated: should instead use GetNetworkConfig.
type ImageCategoryType ¶
type ImageCategoryType string
const ImageCategoryPlatform ImageCategoryType = "platform"
const ImageCategoryVmApp ImageCategoryType = "vmapp"
type InfraProperties ¶
type InfraProperties struct { Properties map[string]*edgeproto.PropertyInfo Mux sync.Mutex // protects local properties cache which only changes on init }
func (*InfraProperties) GetCloudletCRMGatewayIPAndPort ¶
func (ip *InfraProperties) GetCloudletCRMGatewayIPAndPort() (string, int)
func (*InfraProperties) GetPlatformStatsMaxCacheTime ¶
func (ip *InfraProperties) GetPlatformStatsMaxCacheTime() (uint64, error)
func (*InfraProperties) Init ¶
func (p *InfraProperties) Init()
func (*InfraProperties) SetProperties ¶
func (p *InfraProperties) SetProperties(props map[string]*edgeproto.PropertyInfo)
func (*InfraProperties) SetPropsFromVars ¶
func (p *InfraProperties) SetPropsFromVars(ctx context.Context, vars map[string]string)
func (*InfraProperties) SetValue ¶
func (p *InfraProperties) SetValue(key, value string)
func (*InfraProperties) UpdatePropsFromVars ¶
func (p *InfraProperties) UpdatePropsFromVars(ctx context.Context, vars map[string]string)
type InitOp ¶
type InitOp func(opts *InitOptions)
type InitOptions ¶
type InitOptions struct { }
type InterfaceActionsOp ¶
type IptablesChanges ¶
type IptablesChanges struct {
// contains filtered or unexported fields
}
func (*IptablesChanges) PersistRules ¶
type IptablesRules ¶
type IptablesRules struct {
// contains filtered or unexported fields
}
type ManifestContentSubType ¶
type ManifestContentSubType string
const ManifestSubTypeBash ManifestContentSubType = "bash"
const ManifestSubTypeNone ManifestContentSubType = "none"
const ManifestSubTypePython ManifestContentSubType = "python"
const ManifestSubTypeYaml ManifestContentSubType = "yaml"
type ManifestContentType ¶
type ManifestContentType string
const ManifestTypeCode ManifestContentType = "code"
const ManifestTypeNone ManifestContentType = "none"
const ManifestTypeURL ManifestContentType = "url"
type MetalConfigmapParams ¶
type MetalConfigmapParams struct {
AddressRanges []string
}
type NetIPs ¶
type NetIPs [NumIPTypes]netip.Addr
NetIPs is a fixed length array of IP addresses based on type.
type NetplanDevice ¶
type NetplanDevice struct { Addresses []string `yaml:"addresses,omitempty"` DHCP4 bool `yaml:"dhcp4,omitempty"` DHCP6 bool `yaml:"dhcp6,omitempty"` IPV6MTU int `yaml:"ipv6-mtu,omitempty"` IPV6Privacy bool `yaml:"ipv6-privacy,omitempty"` LinkLocal []string `yaml:"link-local,omitempty"` Nameservers NetplanNameservers `yaml:"nameservers,omitempty"` MTU int `yaml:"mtu,omitempty"` Routes []*NetplanRoute `yaml:"routes,omitempty"` }
type NetplanDeviceMatch ¶
type NetplanEthernet ¶
type NetplanEthernet struct { NetplanDevice `yaml:",inline"` Match NetplanDeviceMatch `yaml:"match,omitempty"` }
type NetplanFile ¶
type NetplanFile struct { FileName string Netplan NetplanInfo FileContents string }
type NetplanInfo ¶
type NetplanInfo struct {
Network NetplanNetwork `yaml:"network"`
}
type NetplanNameservers ¶
type NetplanNetwork ¶
type NetplanNetwork struct { Version int `yaml:"version"` Ethernets map[string]*NetplanEthernet `yaml:"ethernets,omitempty"` }
type NetplanRoute ¶
type NetplanRoute struct { From string `yaml:"from,omitempty"` To string `yaml:"to,omitempty"` Via string `yaml:"via,omitempty"` OnLink bool `yaml:"on-link,omitempty"` Metric int `yaml:"metric,omitempty"` Type string `yaml:"type,omitempty"` Scope string `yaml:"scope,omitempty"` MTU int `yaml:"mtu,omitempty"` }
func (*NetplanRoute) ChangeDefaultToIPSpecific ¶
func (s *NetplanRoute) ChangeDefaultToIPSpecific() error
ChangeDefaultToIPSpecific changes the "to" field if it is set to "default" to the IP-specific default route, i.e. 0.0.0.0/0 for IPv4 or ::/0 for IPv6. If the route is the default for both IPv4 and IPv6, it should be "default", but if the system has separate gateways for IPv4 and IPv6, neither should use "default", but instead should use the IP-specific CIDRs.
type NetworkConfig ¶
type NetworkConfig struct { NetplanFiles []*NetplanFile // contains filtered or unexported fields }
func GetNetworkConfig ¶
GetNetworkConfig reads the network configuration from all netplan files. Interfaces may be defined in any netplan file. Ubuntu cloud-init puts all interfaces it detects into 50-network-config.yaml, and we have traditionally put additional port interfaces into separate files. However, depending upon if cloud-init detects ports or not, additional ports may also end up in 50-network-config.yaml. So we need to read all netplan yaml files to really understand the network config.
func (*NetworkConfig) Apply ¶
Apply writes changed netplan files to the system and applies the changes, if any. It returns true if there were any changes applied. Note that file changes are based on file content string comparison, so formatting, comments, etc in the initial cloud-init config file may trigger a no-op apply. "netplan apply" itself also only applies what it determines as network configuration changes, so there is no harm in this.
func (*NetworkConfig) GetInterface ¶
func (s *NetworkConfig) GetInterface(ifaceName string, portName string) *NetplanEthernet
GetInterface returns the ethernet object for the given interface name. The object is created if it does not already exist, and is put into a new netplan file whose name is derived from the portName.
type PortSourceOrDestChoice ¶
type PortSourceOrDestChoice string
PortSourceOrDestChoice indicates whether the port(s) are the source or destination ports
const DestPort PortSourceOrDestChoice = "dport"
const SourcePort PortSourceOrDestChoice = "sport"
type ProxyDnsSecOpts ¶
type VaultEnvData ¶
type VaultEnvData struct {
Env []EnvData `json:"env"`
}