Documentation ¶
Index ¶
Constants ¶
const ( NSPoolKey = "ipam.harmonycloud.cn/nspool/%s/%s" //ns poolname NSPoolKeyPrefix = "ipam.harmonycloud.cn/nspool" ServiccePoolKey = "ipam.harmonycloud.cn/svcpool/%s/%s" //ns poolname ServiccePoolKeyPrefix = "ipam.harmonycloud.cn/svcpool" PodKey = "ipam.harmonycloud.cn/pod/%s/%s" //ns podname PodKeyPrefix = "ipam.harmonycloud.cn/pod/" PodIPFixedAnno = "hcipm_ip_fixed" PodIPAnno = "hcipam_ip" PodIPPoolAnno = "hcipam_ns_ippool" ServiceIPPoolAnno = "hcipam_service_ippool" )
etcd key templates or prefixes, pod annotation keys
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IPAMConfig ¶
type IPAMConfig struct { Name string Type string `json:"type"` MTU int `json:"mtu"` DatastoreType string `json:"datastore_type"` EtcdEndpoints string `json:"etcd_endpoints"` LogPath string `json:"log_path"` LogLevel string `json:"log_level"` EtcdKeyFile string `json:"etcd_key_file"` EtcdCertFile string `json:"etcd_cert_file"` EtcdCaCertFile string `json:"etcd_ca_cert_file"` EtcdUsername string `json:"etcd_username"` EtcdPassword string `json:"etcd_password"` Cronjob string `json:"cronjob"` }
IPAMConfig represents the IP related network configuration. This nests NSIPPool because we initially only supported a single range directly, and wish to preserve backwards compatibility
func LoadIPAMConfig ¶
LoadIPAMConfig loads a IPAMConfig from byte slice.
type NSIPPool ¶
type NSIPPool struct { Name string `json:"name"` Start net.IP `json:"start"` // The first ip, inclusive End net.IP `json:"end"` // The last ip, inclusive Subnet types.IPNet `json:"subnet"` Gateway net.IP `json:"gateway"` //Routes []*types.Route `json:"routes,omitempty"` Total int `json:"total"` Used int `json:"used"` CIDR types.IPNet `json:"cidr,omitempty"` VlanID int `json:"vlanid,omitempty"` Namespace string `json:"namespace"` LastAssignedIP net.IP `json:"lastAssignedIP,omitempty"` PodMap map[string]PodNetwork `json:"podMap"` }
NSIPPool is a IPPool in a certain namespace
func (*NSIPPool) Canonicalize ¶
Canonicalize takes a given range and ensures that all information is consistent, filling out Start, End, and Gateway with sane values if missing
func (NSIPPool) ContainsInSubnet ¶
ContainsInSubnet checks if a given ip is contained in the subnet of nsIPPool
type Net ¶
type Net struct { Name string `json:"name"` CNIVersion string `json:"cniVersion"` Bridge string `json:"bridge"` IPAM *IPAMConfig `json:"ipam"` }
Net is the top-level network config - IPAM plugins are passed the full configuration of the calling plugin, not just the IPAM section.
type PodNetwork ¶
type PodNetwork struct { PodIP net.IP `json:"podIP,omitempty"` PodName string `json:"podName,omitempty"` SvcName string `json:"svcName,omitempty"` SvcIPPoolName string `json:"svcIPPoolName,omitempty"` Namespace string `json:"namespace,omitempty"` StsName string `json:"stsName,omitempty"` StsDeleted bool `json:"stsDeleted,omitempty"` FixedIP bool `json:"fixedIP,omitempty"` ModifyTime time.Time `json:"modifyTime,omitempty"` }
PodNetwork contains all info about an IP address
type ServiceIPPool ¶
type ServiceIPPool struct { Name string `json:"name"` //namespace-service-ippoolcli-n Start net.IP `json:"start"` // The first ip, inclusive End net.IP `json:"end"` // The last ip, inclusive //Routes []*types.Route `json:"routes,omitempty"` Total int `json:"total"` Used int `json:"used"` ServiceName string `json:"serviceName"` Namespace string `json:"namespace"` NSIPPoolName string `json:"nsIPPoolName"` Deleted bool `json:"deleted,omitempty"` LastAssignedIP net.IP `json:"lastAssignedIP,omitempty"` }
ServiceIPPool is a IPPool for a certain service