controller

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceAnnotationIgnore = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/ignore"

	// Node annotations
	ServiceAnnotationTargetNodeLabels = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/target-node-labels"

	// LB annotations
	ServiceAnnotationLoadBalancerID   = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/load-balancer-id"
	ServiceAnnotationLoadBalancerName = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/load-balancer-name" // only set via the annotation
	ServiceAnnotationPackageID        = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/package-id"         // both annotation and cloud-config
	ServiceAnnotationSecurityGroups   = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/security-groups"
	ServiceAnnotationTags             = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/tags"
	ServiceAnnotationScheme           = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/scheme"
	ServiceAnnotationCertificateIDs   = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/certificate-ids"

	// Listener annotations
	ServiceAnnotationIdleTimeoutClient     = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/idle-timeout-client"     // both annotation and cloud-config
	ServiceAnnotationIdleTimeoutMember     = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/idle-timeout-member"     // both annotation and cloud-config
	ServiceAnnotationIdleTimeoutConnection = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/idle-timeout-connection" // both annotation and cloud-config
	ServiceAnnotationInboundCIDRs          = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/inbound-cidrs"

	// Pool annotations
	ServiceAnnotationPoolAlgorithm       = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/pool-algorithm" // both annotation and cloud-config
	ServiceAnnotationEnableStickySession = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/enable-sticky-session"
	ServiceAnnotationEnableTLSEncryption = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/enable-tls-encryption"
	ServiceAnnotationHealthcheckPort     = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-port"

	// Pool healthcheck annotations
	ServiceAnnotationHealthcheckProtocol        = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-protocol"
	ServiceAnnotationHealthcheckIntervalSeconds = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-interval-seconds"
	ServiceAnnotationHealthcheckTimeoutSeconds  = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-timeout-seconds"
	ServiceAnnotationHealthyThresholdCount      = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthy-threshold-count"
	ServiceAnnotationUnhealthyThresholdCount    = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/unhealthy-threshold-count"

	// Pool healthcheck annotations for HTTP
	ServiceAnnotationHealthcheckPath           = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-path"
	ServiceAnnotationSuccessCodes              = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/success-codes"
	ServiceAnnotationHealthcheckHttpMethod     = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-http-method"
	ServiceAnnotationHealthcheckHttpVersion    = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-http-version"
	ServiceAnnotationHealthcheckHttpDomainName = DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX + "/healthcheck-http-domain-name"
)

Annotations

View Source
const (
	DEFAULT_K8S_SERVICE_ANNOTATION_PREFIX = "vks.vngcloud.vn"
)

Variables

This section is empty.

Functions

func CheckIfPoolMemberExist

func CheckIfPoolMemberExist(mems []*pool.Member, mem *pool.Member) bool

func ComparePoolMembers

func ComparePoolMembers(p1, p2 []*pool.Member) bool

func ConvertObjectToPoolMember

func ConvertObjectToPoolMember(obj *lObjects.Member) *pool.Member

func ConvertObjectToPoolMemberArray

func ConvertObjectToPoolMemberArray(obj []*lObjects.Member) []*pool.Member

func IsValid

func IsValid(ing *nwv1.Ingress) bool

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 PointerOf

func PointerOf[T any](t T) *T

Types

type Controller

type Controller struct {
	// 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 Event

type Event struct {
	Type EventType
	Obj  interface{}
	// contains filtered or unexported fields
}

Event holds the context of an event

type EventType

type EventType string

EventType type of event associated with an informer

const (
	CreateEvent EventType = "CREATE"
	UpdateEvent EventType = "UPDATE"
	DeleteEvent EventType = "DELETE"
	SyncEvent   EventType = "SYNC"
)

type Expander

type Expander struct {
	*utils.IngressInspect
	// contains filtered or unexported fields
}

type IngressConfig

type IngressConfig struct {
	LoadBalancerID             string
	LoadBalancerName           string
	LoadBalancerType           loadbalancer.CreateOptsTypeOpt
	PackageID                  string
	Scheme                     loadbalancer.CreateOptsSchemeOpt
	IdleTimeoutClient          int
	IdleTimeoutMember          int
	IdleTimeoutConnection      int
	InboundCIDRs               []string
	HealthcheckProtocol        pool.CreateOptsHealthCheckProtocolOpt
	HealthcheckHttpMethod      pool.CreateOptsHealthCheckMethodOpt
	HealthcheckPath            string
	SuccessCodes               string
	HealthcheckHttpVersion     pool.CreateOptsHealthCheckHttpVersionOpt
	HealthcheckHttpDomainName  string
	PoolAlgorithm              pool.CreateOptsAlgorithmOpt
	HealthyThresholdCount      int
	UnhealthyThresholdCount    int
	HealthcheckTimeoutSeconds  int
	HealthcheckIntervalSeconds int
	HealthcheckPort            int
	Tags                       map[string]string
	TargetNodeLabels           map[string]string
	IsAutoCreateSecurityGroup  bool
	SecurityGroups             []string
	EnableStickySession        bool
	EnableTLSEncryption        bool
	CertificateIDs             []string
}

func NewIngressConfig

func NewIngressConfig(pService *nwv1.Ingress) *IngressConfig

func (*IngressConfig) CreateListenerOptions

func (s *IngressConfig) CreateListenerOptions(isHTTPS bool) *listener.CreateOpts

func (*IngressConfig) CreateLoadbalancerOptions

func (s *IngressConfig) CreateLoadbalancerOptions() *loadbalancer.CreateOpts

func (*IngressConfig) CreatePoolOptions

func (s *IngressConfig) CreatePoolOptions() *pool.CreateOpts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL