Documentation ¶
Index ¶
- Constants
- func CheckIfPoolMemberExist(mems []*pool.Member, mem *pool.Member) bool
- func CheckIfPoolMemberExist2(mems []*lObjects.Member, mem *pool.Member) bool
- func ComparePoolMembers(p1, p2 []*pool.Member) bool
- func ConvertObjectToPoolMember(obj *lObjects.Member) *pool.Member
- func ConvertObjectToPoolMemberArray(obj []*lObjects.Member) []*pool.Member
- func DecodeFromValidName(str string) string
- func EncodeToValidName(str string) string
- func GetCertificateName(clusterID, namespace, name string) string
- func GetPolicyName(prefix string, mode bool, ruleIndex, pathIndex int) string
- func GetPoolName(prefix, serviceName string, port int) string
- func GetResourceHashName(ing *nwv1.Ingress, clusterID string) string
- func GetResourceName(ing *nwv1.Ingress, clusterID string) string
- func HashString(str string) string
- func IsLoadBalancerNotReady(err error) bool
- func IsValid(ing *nwv1.Ingress) bool
- func MapIDExpander(old, cur *IngressInspect)
- func MinInt(a, b int) int
- func NodeNames(nodes []*apiv1.Node) []string
- func NodeSlicesEqual(x, y []*apiv1.Node) bool
- func Sleep(t int)
- func TrimString(str string, length int) string
- type API
- func (c *API) CreateLB(name, packageId, subnetID string, scheme loadbalancer.CreateOptsSchemeOpt, ...) (*lObjects.LoadBalancer, error)
- func (c *API) CreateListener(lbID string, opt *listener.CreateOpts) (*lObjects.Listener, error)
- func (c *API) CreatePolicy(lbID, listenerID string, opt *policy.CreateOptsBuilder) (*lObjects.Policy, error)
- func (c *API) CreatePool(lbID string, opt *pool.CreateOpts) (*lObjects.Pool, error)
- func (c *API) DeleteCertificate(certificateID string) error
- func (c *API) DeleteLB(lbID string) error
- func (c *API) DeleteListener(lbID, listenerID string) error
- func (c *API) DeletePolicy(lbID, listenerID, policyID string) error
- func (c *API) DeletePool(lbID, poolID string) error
- func (c *API) FindListenerByName(lbID, name string) (*lObjects.Listener, error)
- func (c *API) FindListenerByPort(lbID string, port int) (*lObjects.Listener, error)
- func (c *API) FindPolicyByName(lbID, listenerID, name string) (*lObjects.Policy, error)
- func (c *API) FindPoolByName(lbID, name string) (*lObjects.Pool, error)
- func (c *API) GetCertificate(certificateID string) (*lObjects.Certificate, error)
- func (c *API) GetClusterInfo(clusterID string) (*lObjects.Cluster, error)
- func (c *API) GetLB(lbID string) (*lObjects.LoadBalancer, error)
- func (c *API) GetMemberPool(lbID, poolID string) ([]*lObjects.Member, error)
- func (c *API) GetPolicy(lbID, listenerID, policyID string) (*lObjects.Policy, error)
- func (c *API) GetPool(lbID, poolID string) (*lObjects.Pool, error)
- func (c *API) ImportCertificate(opt *certificates.ImportOpts) (*lObjects.Certificate, error)
- func (c *API) ListCertificate() ([]*lObjects.Certificate, error)
- func (c *API) ListLBBySubnetID(subnetID string) ([]*lObjects.LoadBalancer, error)
- func (c *API) ListListenerOfLB(lbID string) ([]*lObjects.Listener, error)
- func (c *API) ListPolicyOfListener(lbID, listenerID string) ([]*lObjects.Policy, error)
- func (c *API) ListPoolOfLB(lbID string) ([]*lObjects.Pool, error)
- func (c *API) UpdateListener(lbID, listenerID string, opt *listener.UpdateOpts) error
- func (c *API) UpdatePolicy(lbID, listenerID, policyID string, opt *policy.UpdateOptsBuilder) error
- func (c *API) UpdatePoolMember(lbID, poolID string, mems []*pool.Member) error
- func (c *API) WaitForLBActive(lbID string) *lObjects.LoadBalancer
- type CertificateExpander
- type Config
- type Controller
- type ErrorRespone
- type Event
- type EventType
- type ExtraInfo
- type IngressInspect
- type ListenerExpander
- type NodeConditionPredicate
- type PolicyExpander
- type PoolExpander
- type SecretTracker
- type VLBOpts
Constants ¶
View Source
const ( DEFAULT_PORTAL_NAME_LENGTH = 50 ACTIVE_LOADBALANCER_STATUS = "ACTIVE" )
View Source
const ( // CreateEvent event associated with new objects in an informer CreateEvent EventType = "CREATE" // UpdateEvent event associated with an object update in an informer UpdateEvent EventType = "UPDATE" // DeleteEvent event associated when an object is removed from an informer DeleteEvent EventType = "DELETE" // IngressKey picks a specific "class" for the Ingress. // The controller only processes Ingresses with this annotation either // unset, or set to either the configured value or the empty string. IngressKey = "kubernetes.io/ingress.class" // IngressClass specifies which Ingress class we accept IngressClass = "vngcloud" // LabelNodeExcludeLB specifies that a node should not be used to create a Loadbalancer on // https://github.com/kubernetes/cloud-provider/blob/25867882d509131a6fdeaf812ceebfd0f19015dd/controllers/service/controller.go#L673 LabelNodeExcludeLB = "node.kubernetes.io/exclude-from-external-load-balancers" // DeprecatedLabelNodeRoleMaster specifies that a node is a master // It's copied over to kubeadm until it's merged in core: https://github.com/kubernetes/kubernetes/pull/39112 // Deprecated in favor of LabelNodeExcludeLB DeprecatedLabelNodeRoleMaster = "node-role.kubernetes.io/master" // IngressSecretCertName is certificate key name defined in the secret data. IngressSecretCertName = "tls.crt" // IngressSecretKeyName is private key name defined in the secret data. IngressSecretKeyName = "tls.key" )
View Source
const ( ServiceAnnotationLoadBalancerID = "vks.vngcloud.vn/load-balancer-id" ServiceAnnotationPackageID = "vks.vngcloud.vn/package-id" )
Variables ¶
This section is empty.
Functions ¶
func CheckIfPoolMemberExist ¶
func CheckIfPoolMemberExist2 ¶
func ComparePoolMembers ¶
func DecodeFromValidName ¶
func EncodeToValidName ¶
func GetCertificateName ¶
func GetPoolName ¶
func GetResourceName ¶
GetResourceName get Ingress related resource name.
func IsLoadBalancerNotReady ¶
func IsValid ¶
IsValid returns true if the given Ingress either doesn't specify the ingress.class annotation, or it's set to the configured in the ingress controller.
func MapIDExpander ¶
func MapIDExpander(old, cur *IngressInspect)
func NodeSlicesEqual ¶
NodeSlicesEqual check if two nodes equals to each other.
func TrimString ¶
Types ¶
type API ¶
type API struct { VLBSC *client.ServiceClient VServerSC *client.ServiceClient ProjectID string }
func (*API) CreateLB ¶
func (c *API) CreateLB(name, packageId, subnetID string, scheme loadbalancer.CreateOptsSchemeOpt, typeLB loadbalancer.CreateOptsTypeOpt, ) (*lObjects.LoadBalancer, error)
func (*API) CreateListener ¶
LISTENER
func (*API) CreatePolicy ¶
func (c *API) CreatePolicy(lbID, listenerID string, opt *policy.CreateOptsBuilder) (*lObjects.Policy, error)
POLICY
func (*API) CreatePool ¶
POOL
func (*API) DeleteCertificate ¶
func (*API) DeleteListener ¶
func (*API) DeletePolicy ¶
func (*API) DeletePool ¶
func (*API) FindListenerByName ¶
func (*API) FindListenerByPort ¶
func (*API) FindPolicyByName ¶
func (*API) FindPoolByName ¶
func (*API) GetCertificate ¶
func (c *API) GetCertificate(certificateID string) (*lObjects.Certificate, error)
func (*API) GetClusterInfo ¶
COMMON
func (*API) GetMemberPool ¶
func (*API) ImportCertificate ¶
func (c *API) ImportCertificate(opt *certificates.ImportOpts) (*lObjects.Certificate, error)
CERTIFICATE
func (*API) ListCertificate ¶
func (c *API) ListCertificate() ([]*lObjects.Certificate, error)
func (*API) ListLBBySubnetID ¶
func (c *API) ListLBBySubnetID(subnetID string) ([]*lObjects.LoadBalancer, error)
LB
func (*API) ListListenerOfLB ¶
func (*API) ListPolicyOfListener ¶
func (*API) UpdateListener ¶
func (c *API) UpdateListener(lbID, listenerID string, opt *listener.UpdateOpts) error
func (*API) UpdatePolicy ¶
func (c *API) UpdatePolicy(lbID, listenerID, policyID string, opt *policy.UpdateOptsBuilder) error
func (*API) UpdatePoolMember ¶
func (*API) WaitForLBActive ¶
func (c *API) WaitForLBActive(lbID string) *lObjects.LoadBalancer
type CertificateExpander ¶
type Controller ¶
type Controller struct { SecretTrackers *SecretTracker // contains filtered or unexported fields }
Controller ...
func NewController ¶
func NewController(conf config.Config) *Controller
NewController creates a new VngCloud Ingress controller.
func (*Controller) DeleteLoadbalancer ¶
func (c *Controller) DeleteLoadbalancer(ing *nwv1.Ingress) error
func (*Controller) GetLoadbalancerIDByIngress ¶
func (c *Controller) GetLoadbalancerIDByIngress(ing *nwv1.Ingress) (string, error)
func (*Controller) Init ¶
func (c *Controller) Init() error
func (*Controller) Start ¶
func (c *Controller) Start()
Start starts the vngcloud ingress controller.
type ErrorRespone ¶
type ErrorRespone struct { Message string `json:"message"` ErrorCode string `json:"errorCode"` StatusCode int `json:"statusCode"` }
func ParseError ¶
func ParseError(errStr string) *ErrorRespone
type Event ¶
type Event struct { Type EventType Obj interface{} // contains filtered or unexported fields }
Event holds the context of an event
type IngressInspect ¶
type IngressInspect struct { PolicyExpander []*PolicyExpander PoolExpander []*PoolExpander ListenerExpander []*ListenerExpander CertificateExpander []*CertificateExpander // contains filtered or unexported fields }
func (*IngressInspect) Print ¶
func (ing *IngressInspect) Print()
type ListenerExpander ¶
type ListenerExpander struct { UUID string listener.CreateOpts }
type NodeConditionPredicate ¶
type PolicyExpander ¶
type PoolExpander ¶
type SecretTracker ¶
type SecretTracker struct {
SecretTrackers []*secret
}
func NewSecretTracker ¶
func NewSecretTracker() *SecretTracker
func (*SecretTracker) AddSecretTracker ¶
func (c *SecretTracker) AddSecretTracker(namespace, name, uuid, version string)
func (*SecretTracker) CheckSecretTrackerChange ¶
func (c *SecretTracker) CheckSecretTrackerChange(kubeClient kubernetes.Interface) bool
func (*SecretTracker) ClearSecretTracker ¶
func (c *SecretTracker) ClearSecretTracker()
func (*SecretTracker) RemoveSecretTracker ¶
func (c *SecretTracker) RemoveSecretTracker(namespace, name string)
type VLBOpts ¶
type VLBOpts struct { Enabled bool `gcfg:"enabled"` // if false, disables the controller InternalLB bool `gcfg:"internal-lb"` // default false FlavorID string `gcfg:"flavor-id"` // flavor id of load balancer LBMethod string `gcfg:"lb-method"` // default to ROUND_ROBIN. EnableVMonitor bool `gcfg:"enable-vmonitor"` // default to false }
Click to show internal directories.
Click to hide internal directories.