k8s

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REWRITE_HOST_KEY         = string(annotationscommon.AnnotationRewriteUpstreamVHost)
	REWRITE_PATH_KEY         = string(annotationscommon.AnnotationRewriteRewriteTarget)
	USE_REGEX_KEY            = string(annotationscommon.AnnotationUseRegex)
	SERVICE_PROTOCOL         = string(annotationscommon.AnnotationBackendProtocol)
	Erda_Runtime_Project_Id  = "erda.gateway.projectId"
	Erda_Runtime_ProjectName = "erda.gateway.projectName"
	Erda_Runtime_ClusterName = "erda.gateway.clusterName"
	Erda_Runtime_Runtime_Id  = "erda.gateway.runtimeId"
	Erda_Runtime_ServiceName = "erda.gateway.serviceName"
	Erda_Runtime_AppName     = "erda.gateway.appName"
)
View Source
const (
	HEPA_BEGIN              = "###HEPA-AUTO-BEGIN###\n"
	HEPA_END                = "###HEPA-AUTO-END###\n"
	INGRESS_NS              = "ingress-nginx"
	SYSTEM_NS               = "kube-system"
	GATEWAY_SVC_NAME        = "api-gateway"
	INGRESS_APP_LABEL       = "app.kubernetes.io/name=ingress-nginx"
	INGRESS_APP_LABEL_NEW   = "app=ingress-nginx"
	INGRESS_CONFIG_NAME     = "nginx-configuration"
	INGRESS_CONFIG_NAME_NEW = "ingress-nginx-controller"
	LOC_SNIPPET_KEY         = string(annotationscommon.AnnotationConfigurationSnippet)
	MAIN_SNIPPET_KEY        = "main-snippet"
	HTTP_SNIPPET_KEY        = "http-snippet"
	SERVER_SNIPPET_KEY      = "server-snippet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendProtocl

type BackendProtocl string
const (
	HTTP  BackendProtocl = "http"
	HTTPS BackendProtocl = "https"
	GRPC  BackendProtocl = "grpc"
	GRPCS BackendProtocl = "grpcs"
	FCGI  BackendProtocl = "fastcgi"
)

type IngressBackend

type IngressBackend union_interface.IngressBackend

type IngressRoute

type IngressRoute union_interface.IngressRoute

type K8SAdapter

type K8SAdapter interface {
	IsGatewaySupportHttps(namespace, svcName string) (bool, error)
	MakeGatewaySupportHttps(namespace, svcName string) error
	MakeGatewaySupportMesh(namespace string) error
	CountIngressController() (int, error)
	CheckDomainExist(name string) (bool, error)
	DeleteIngress(namespace, name string) error
	CreateOrUpdateIngress(namespace, name string, routes []IngressRoute, backend IngressBackend, gatewayProvider string, options ...RouteOptions) (bool, error)
	SetUpstreamHost(namespace, name, host string) error
	SetRewritePath(namespace, name, target string) error
	EnableRegex(namespace, name string) error
	CheckIngressExist(namespace, name string) (bool, error)
	UpdateIngressAnnotation(namespace, name string, annotaion map[string]*string, snippet *string) error
	UpdateIngressController(options map[string]*string, mainSnippet, httpSnippet, serverSnippet *string) error
	ListAllServices(namespace string) ([]v1.Service, error)
	GetServiceByName(namespace, name string) (*v1.Service, error)
	CreateOrUpdateService(service *v1.Service) (*v1.Service, error)
	DeleteService(namespace, name string) error
	GetDeployment(namespace, name string) (*appsv1.Deployment, error)
}

func NewAdapter

func NewAdapter(clusterKey string) (K8SAdapter, error)

type K8SAdapterImpl

type K8SAdapterImpl struct {
	// contains filtered or unexported fields
}

func (*K8SAdapterImpl) CheckDomainExist

func (impl *K8SAdapterImpl) CheckDomainExist(domain string) (bool, error)

func (*K8SAdapterImpl) CheckIngressExist

func (impl *K8SAdapterImpl) CheckIngressExist(namespace, name string) (bool, error)

func (*K8SAdapterImpl) CountIngressController

func (impl *K8SAdapterImpl) CountIngressController() (count int, err error)

func (*K8SAdapterImpl) CreateOrUpdateIngress

func (impl *K8SAdapterImpl) CreateOrUpdateIngress(namespace, name string, routes []IngressRoute, backend IngressBackend, gatewayProvider string, options ...RouteOptions) (bool, error)

func (*K8SAdapterImpl) CreateOrUpdateService

func (impl *K8SAdapterImpl) CreateOrUpdateService(service *v1.Service) (*v1.Service, error)

func (*K8SAdapterImpl) DeleteIngress

func (impl *K8SAdapterImpl) DeleteIngress(namespace, name string) error

func (*K8SAdapterImpl) DeleteService

func (impl *K8SAdapterImpl) DeleteService(namespace, name string) error

func (*K8SAdapterImpl) EnableRegex

func (impl *K8SAdapterImpl) EnableRegex(namespace, name string) error

func (*K8SAdapterImpl) GetDeployment

func (impl *K8SAdapterImpl) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

func (*K8SAdapterImpl) GetServiceByName

func (impl *K8SAdapterImpl) GetServiceByName(namespace, name string) (*v1.Service, error)

func (*K8SAdapterImpl) IsGatewaySupportHttps

func (impl *K8SAdapterImpl) IsGatewaySupportHttps(namespace, svcName string) (bool, error)

func (*K8SAdapterImpl) ListAllServices

func (impl *K8SAdapterImpl) ListAllServices(namespace string) ([]v1.Service, error)

func (*K8SAdapterImpl) MakeGatewaySupportHttps

func (impl *K8SAdapterImpl) MakeGatewaySupportHttps(namespace, svcName string) error

func (*K8SAdapterImpl) MakeGatewaySupportMesh

func (impl *K8SAdapterImpl) MakeGatewaySupportMesh(namespace string) error

func (*K8SAdapterImpl) SetRewritePath

func (impl *K8SAdapterImpl) SetRewritePath(namespace, name, target string) error

func (*K8SAdapterImpl) SetUpstreamHost

func (impl *K8SAdapterImpl) SetUpstreamHost(namespace, name, host string) error

func (*K8SAdapterImpl) UpdateIngressAnnotation

func (impl *K8SAdapterImpl) UpdateIngressAnnotation(namespace, name string, annotaion map[string]*string, snippet *string) error

func (*K8SAdapterImpl) UpdateIngressController

func (impl *K8SAdapterImpl) UpdateIngressController(options map[string]*string, mainSnippet, httpSnippet, serverSnippet *string) (err error)

type RouteOptions

type RouteOptions struct {
	RewriteHost         *string
	RewritePath         *string
	UseRegex            bool
	EnableTLS           bool
	BackendProtocol     *BackendProtocl
	InjectRuntimeDomain bool
	Annotations         map[string]*string
	LocationSnippet     *string
}

Jump to

Keyboard shortcuts

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