Documentation
¶
Index ¶
Constants ¶
const ( NS_POOL_Key = "ipam.harmonycloud.cn/nspool/%s/%s" //poolname NS_POOL_Key_Prefix = "ipam.harmonycloud.cn/nspool" Servicce_Pool_Key = "ipam.harmonycloud.cn/svcpool/%s/%s" //poolname Servicce_Pool_Key_Prefix = "ipam.harmonycloud.cn/svcpool" Pod_Key = "ipam.harmonycloud.cn/pod/%s/%s" //ns podname Pod_Key_Prefix = "ipam.harmonycloud.cn/pod/" POD_IP_FIXED = "hcipm_ip_fixed" POD_IP_ANNOTAION = "hcipam_ip" POD_IP_POOL = "hcipam_ns_ippool" SERVICE_IP_POOL = "hcipam_service_ippool" Service_Key_Prefix = "hcipam_service" Service_Key = "ipam.harmonycloud.cn/hcipam_service/%s/%s" )
etcd key templates or prefixes, pod annotation keys
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateServiceRequest ¶
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"`
ClusterIPCIDR string `json:"clusterip_cidr"`
}
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 IPAMEnvArgs ¶
type IPAMEnvArgs struct {
types.CommonArgs
IP net.IP `json:"ip,omitempty"`
}
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"`
NsPoolName string `json:"NsPoolName,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