controlplane

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePodIPTypeFromAnnotation

func ParsePodIPTypeFromAnnotation(pod *corev1.Pod) (*v1beta1.AllocationType, error)

ParsePodIPTypeFromAnnotation parse annotation and convert to v1beta1.IPType

func ParsePodNetworksFromAnnotation

func ParsePodNetworksFromAnnotation(pod *corev1.Pod) ([]*v1beta1.Allocation, error)

ParsePodNetworksFromAnnotation parse annotation and convert to []v1beta1.Allocation

Types

type Config

type Config struct {
	// controller config
	LeaseLockName       string `json:"leaseLockName" validate:"required" mod:"default=terway-controller-lock"`
	LeaseLockNamespace  string `json:"leaseLockNamespace" validate:"required" mod:"default=kube-system"`
	ControllerNamespace string `json:"controllerNamespace" validate:"required" mod:"default=kube-system"`
	ControllerName      string `json:"controllerName" validate:"required" mod:"default=terway-controlplane"`

	HealthzBindAddress string `json:"healthzBindAddress" validate:"required,tcp_addr" mod:"default=0.0.0.0:80"`
	MetricsBindAddress string `json:"metricsBindAddress" validate:"required" mod:"default=0"`
	ClusterDomain      string `json:"clusterDomain" validate:"required,fqdn" mod:"default=cluster.local"`
	WebhookPort        int    `json:"webhookPort" validate:"gt=0,lte=65535" mod:"default=4443"`
	CertDir            string `json:"certDir" validate:"required" mod:"default=/var/run/webhook-cert"`
	LeaderElection     bool   `json:"leaderElection"`
	RegisterEndpoint   bool   `json:"registerEndpoint"`

	PodMaxConcurrent    int `json:"podMaxConcurrent" validate:"gt=0,lte=100" mod:"default=1"`
	PodENIMaxConcurrent int `json:"podENIMaxConcurrent" validate:"gt=0,lte=100" mod:"default=1"`

	// cluster info for controlplane
	RegionID  string `json:"regionID" validate:"required"`
	ClusterID string `json:"clusterID" validate:"required"`
	VPCID     string `json:"vpcID" validate:"required"`

	EnableTrunk *bool  `json:"enableTrunk,omitempty"`
	IPStack     string `json:"ipStack,omitempty" validate:"oneof=ipv4 ipv6 dual" mod:"default=ipv4"`

	ReadOnlyQPS   int `json:"readOnlyQPS" validate:"gt=0,lte=10000" mod:"default=8"`
	ReadOnlyBurst int `json:"readOnlyBurst" validate:"gt=0,lte=10000" mod:"default=10"`
	MutatingQPS   int `json:"mutatingQPS" validate:"gt=0,lte=10000" mod:"default=4"`
	MutatingBurst int `json:"mutatingBurst" validate:"gt=0,lte=10000" mod:"default=5"`

	VSwitchPoolSize int    `json:"vSwitchPoolSize" validate:"gt=0" mod:"default=1000"`
	VSwitchCacheTTL string `json:"vSwitchCacheTTL" mod:"default=20m0s"`

	Credential
}

func GetConfig

func GetConfig() *Config

func ParseAndValidate

func ParseAndValidate() (*Config, error)

ParseAndValidate ready config and verify it

type Credential

type Credential struct {
	AccessKey       secret.Secret `json:"accessKey" validate:"required_with=AccessSecret"`
	AccessSecret    secret.Secret `json:"accessSecret" validate:"required_with=AccessKey"`
	CredentialPath  string        `json:"credentialPath"`
	SecretNamespace string        `json:"secretNamespace" validate:"required_with=SecretName"`
	SecretName      string        `json:"secretName" validate:"required_with=SecretNamespace"`
}

func ParseAndValidateCredential

func ParseAndValidateCredential(file string) (*Credential, error)

Jump to

Keyboard shortcuts

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