Documentation
¶
Index ¶
- func GetViper() *viper.Viper
- func InitViper(configFilePath string, onConfigChange func(e fsnotify.Event)) error
- func IsControllerEnabled(name string, enable bool, controllers []string) bool
- func SetConfig(c *Config)
- type Config
- type Credential
- type Degradation
- type ENIController
- type MultiIPController
- type NodeController
- type PodNetworkRef
- type PodNetworks
- type PodNetworksAnnotation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsControllerEnabled ¶ added in v1.3.0
IsControllerEnabled check if a specified controller enabled or not.
Types ¶
type Config ¶
type Config struct {
// controller config
LeaseLockName string `json:"leaseLockName" validate:"required" mod:"default=terway-controller-lock" yaml:"leaseLockName"`
LeaseLockNamespace string `json:"leaseLockNamespace" validate:"required" mod:"default=kube-system" yaml:"leaseLockNamespace"`
LeaseDuration string `json:"leaseDuration" yaml:"leaseDuration"`
RenewDeadline string `json:"renewDeadline" yaml:"renewDeadline"`
RetryPeriod string `json:"retryPeriod" yaml:"retryPeriod"`
ControllerNamespace string `json:"controllerNamespace" validate:"required" mod:"default=kube-system" yaml:"controllerNamespace"`
ControllerName string `json:"controllerName" validate:"required" mod:"default=terway-controlplane" yaml:"controllerName"`
HealthzBindAddress string `json:"healthzBindAddress" validate:"required,tcp_addr" mod:"default=0.0.0.0:80" yaml:"healthzBindAddress"`
MetricsBindAddress string `json:"metricsBindAddress" validate:"required" mod:"default=0" yaml:"metricsBindAddress"`
ClusterDomain string `json:"clusterDomain" validate:"required" mod:"default=cluster.local" yaml:"clusterDomain"`
DisableWebhook bool `json:"disableWebhook" yaml:"disableWebhook"`
WebhookPort int `json:"webhookPort" validate:"gt=0,lte=65535" mod:"default=4443" yaml:"webhookPort"`
CertDir string `json:"certDir" validate:"required" mod:"default=/var/run/webhook-cert" yaml:"certDir"`
LeaderElection bool `json:"leaderElection" yaml:"leaderElection"`
EnableTrace bool `json:"enableTrace" yaml:"enableTrace"`
PodMaxConcurrent int `json:"podMaxConcurrent" validate:"gt=0,lte=10000" mod:"default=10" yaml:"podMaxConcurrent"`
PodENIMaxConcurrent int `json:"podENIMaxConcurrent" validate:"gt=0,lte=10000" mod:"default=10" yaml:"podENIMaxConcurrent"`
NodeController
MultiIPController
ENIController
Controllers []string `json:"controllers" yaml:"controllers"`
// cluster info for controlplane
RegionID string `json:"regionID" validate:"required" yaml:"regionID"`
ClusterID string `json:"clusterID" validate:"required" yaml:"clusterID"`
VPCID string `json:"vpcID" validate:"required" yaml:"vpcID"`
EnableTrunk *bool `json:"enableTrunk,omitempty" yaml:"enableTrunk,omitempty"`
EnableDevicePlugin bool `json:"enableDevicePlugin" yaml:"enableDevicePlugin"`
IPStack string `json:"ipStack,omitempty" validate:"oneof=ipv4 ipv6 dual" mod:"default=ipv4" yaml:"ipStack,omitempty"`
EnableWebhookInjectResource *bool `json:"enableWebhookInjectResource,omitempty" yaml:"enableWebhookInjectResource,omitempty"`
KubeClientQPS float32 `json:"kubeClientQPS" validate:"gt=0,lte=10000" mod:"default=20" yaml:"kubeClientQPS"`
KubeClientBurst int `json:"kubeClientBurst" validate:"gt=0,lte=10000" mod:"default=30" yaml:"kubeClientBurst"`
VSwitchPoolSize int `json:"vSwitchPoolSize" validate:"gt=0" mod:"default=1000" yaml:"vSwitchPoolSize"`
VSwitchCacheTTL string `json:"vSwitchCacheTTL" mod:"default=20m0s" yaml:"vSwitchCacheTTL"`
CustomStatefulWorkloadKinds []string `json:"customStatefulWorkloadKinds" yaml:"customStatefulWorkloadKinds"`
BackoffOverride map[string]backoff.ExtendedBackoff `json:"backoffOverride,omitempty" yaml:"backoffOverride,omitempty"`
IPAMType string `json:"ipamType" yaml:"ipamType"`
CentralizedIPAM bool `json:"centralizedIPAM,omitempty" yaml:"centralizedIPAM,omitempty"`
RateLimit map[string]int `json:"rateLimit" yaml:"rateLimit"`
Degradation Degradation `json:"degradation" yaml:"degradation"`
Credential
}
func ParseAndValidate ¶
ParseAndValidate ready config and verify it
type Credential ¶
type Credential struct {
AccessKey secret.Secret `json:"accessKey" validate:"required_with=AccessSecret" yaml:"accessKey"`
AccessSecret secret.Secret `json:"accessSecret" validate:"required_with=AccessKey" yaml:"accessSecret"`
CredentialPath string `json:"credentialPath" yaml:"credentialPath"`
OtelEndpoint string `json:"otelEndpoint" yaml:"otelEndpoint"`
OtelToken secret.Secret `json:"otelToken" yaml:"otelToken"`
}
func ParseAndValidateCredential ¶
func ParseAndValidateCredential(file string) (*Credential, error)
type Degradation ¶ added in v1.15.0
type Degradation string
const ( DegradationL0 Degradation = "l0" DegradationL1 Degradation = "l1" )
type ENIController ¶ added in v1.15.0
type ENIController struct {
ENIMaxConcurrent int `json:"eniMaxConcurrent" validate:"gt=0,lte=10000" mod:"default=300" yaml:"eniMaxConcurrent"`
}
type MultiIPController ¶ added in v1.15.0
type MultiIPController struct {
MultiIPPodMaxConcurrent int `json:"multiIPPodMaxConcurrent" validate:"gt=0,lte=20000" mod:"default=500" yaml:"multiIPPodMaxConcurrent"`
MultiIPNodeMaxConcurrent int `json:"multiIPNodeMaxConcurrent" validate:"gt=0,lte=20000" mod:"default=500" yaml:"multiIPNodeMaxConcurrent"`
MultiIPNodeSyncPeriod string `json:"multiIPNodeSyncPeriod" mod:"default=12h" yaml:"multiIPNodeSyncPeriod"`
MultiIPGCPeriod string `json:"multiIPGCPeriod" mod:"default=2m" yaml:"multiIPGCPeriod"`
MultiIPMinSyncPeriodOnFailure string `json:"multiIPMinSyncPeriodOnFailure" mod:"default=1s" yaml:"multiIPMinSyncPeriodOnFailure"`
MultiIPMaxSyncPeriodOnFailure string `json:"multiIPMaxSyncPeriodOnFailure" mod:"default=300s" yaml:"multiIPMaxSyncPeriodOnFailure"`
}
type NodeController ¶ added in v1.15.0
type PodNetworkRef ¶ added in v1.13.7
type PodNetworkRef struct {
InterfaceName string `json:"interfaceName"`
Network string `json:"network"`
DefaultRoute bool `json:"defaultRoute,omitempty"`
Routes []route.Route `json:"routes,omitempty"`
}
func ParsePodNetworksFromRequest ¶ added in v1.13.7
func ParsePodNetworksFromRequest(anno map[string]string) ([]PodNetworkRef, error)
type PodNetworks ¶ added in v1.15.0
type PodNetworks struct {
VSwitchOptions []string `json:"vSwitchOptions"`
SecurityGroupIDs []string `json:"securityGroupIDs"`
Interface string `json:"interface"`
ExtraRoutes []route.Route `json:"extraRoutes,omitempty"`
ENIOptions v1beta1.ENIOptions `json:"eniOptions,omitempty"`
VSwitchSelectOptions v1beta1.VSwitchSelectOptions `json:"vSwitchSelectOptions,omitempty"`
ResourceGroupID string `json:"resourceGroupID"`
NetworkInterfaceTrafficMode string `json:"networkInterfaceTrafficMode"` // "Standard"|"HighPerformance"
DefaultRoute bool `json:"defaultRoute"`
AllocationType *v1beta1.AllocationType `json:"allocationType"`
}
type PodNetworksAnnotation ¶ added in v1.2.0
type PodNetworksAnnotation struct {
PodNetworks []PodNetworks `json:"podNetworks"`
}
func ParsePodNetworksFromAnnotation ¶
func ParsePodNetworksFromAnnotation(pod *corev1.Pod) (*PodNetworksAnnotation, error)
ParsePodNetworksFromAnnotation parse annotation and convert to PodNetworksAnnotation
Click to show internal directories.
Click to hide internal directories.