kubernetes

package
v0.0.0-...-a23f37e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelsKeyServiceID is used to define the ID of the service
	LabelsKeyServiceID = "kratos-service-id"
	// LabelsKeyServiceName is used to define the name of the service
	LabelsKeyServiceName = "kratos-service-app"
	// LabelsKeyServiceVersion is used to define the version of the service
	LabelsKeyServiceVersion = "kratos-service-version"
	// AnnotationsKeyMetadata is used to define the metadata of the service
	AnnotationsKeyMetadata = "kratos-service-metadata"
	// AnnotationsKeyProtocolMap is used to define the protocols of the service
	// Through the value of this field, Kratos can obtain the application layer protocol corresponding to the port
	// Example value: {"80": "http", "8081": "grpc"}
	AnnotationsKeyProtocolMap = "kratos-service-protocols"
)
View Source
const ServiceAccountNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"

ServiceAccountNamespacePath defines the location of the namespace file

Variables

This section is empty.

Functions

func GetNamespace

func GetNamespace() string

func GetPodName

func GetPodName() string

GetPodName is used to get the name of the Pod where the current container is located

func LoadNamespace

func LoadNamespace() string

LoadNamespace is used to get the current namespace from the file

Types

type KubernetesRegistry

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

KubernetesRegistry It has not been verified in the production environment and is currently for reference only

func NewKubernetesRegistry

func NewKubernetesRegistry(clientSet *kubernetes.Clientset) *KubernetesRegistry

NewKubernetesRegistry is used to initialize the Registry

func (*KubernetesRegistry) Close

func (r *KubernetesRegistry) Close()

Close is used to close the Registry After closing, any callbacks generated by Watch will not be executed

func (*KubernetesRegistry) Deregister

Deregister the registration.

func (*KubernetesRegistry) Register

func (r *KubernetesRegistry) Register(ctx context.Context, service *registry.ServiceInstance) error

Register is used to register services Note that on Kubernetes, it can only be used to update the id/name/version/metadata/protocols of the current service, but it cannot be used to update node.

func (*KubernetesRegistry) Start

func (r *KubernetesRegistry) Start()

Start is used to start the Registry It is non-blocking

Jump to

Keyboard shortcuts

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