util

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogagentPort = "8090"
)

Variables

View Source
var ClusterNameToClient sync.Map

ClusterNameToClient mapping cluster to kubernetes client clusterName => kubernetes.Interface

Functions

func APIServerLocationByCluster

func APIServerLocationByCluster(ctx context.Context, clusterName string, platformClient platformversionedclient.PlatformV1Interface) (*url.URL, http.RoundTripper, string, error)

TODO: use api && controller instead of proxy

func BuildTransportV1

func BuildTransportV1(credential *platformv1.ClusterCredential) (http.RoundTripper, error)

BuildTransport create the http transport for communicate to backend kubernetes api server.

func FilterLogAgent

func FilterLogAgent(ctx context.Context, decorator *logagent.LogAgent) error

FilterLogAgent is used to filter log collector that do not belong to the tenant.

func GetClusterClient

func GetClusterClient(ctx context.Context, clusterName string, platformClient platformversionedclient.PlatformV1Interface) (kubernetes.Interface, error)

GetClusterClient get kubernetes client via cluster name

func GetClusterPodIP

func GetClusterPodIP(ctx context.Context, clusterName, namespace, podName string, platformClient platformversionedclient.PlatformV1Interface) (string, error)

use cache to optimize this function

func GetRegistryDomain

func GetRegistryDomain() string

func GetRegistryNamespace

func GetRegistryNamespace() string

func Init

func Init(domain string, namespace string)

func WriteResponseError

func WriteResponseError(rw http.ResponseWriter, code ErrorCode, message string)

Types

type ErrorCode

type ErrorCode string
const (
	ErrorNone             ErrorCode = ""
	ErrorInternalError    ErrorCode = "InternalError"
	ErrorInvalidParameter ErrorCode = "InvalidParameter"
)

type LocationStreamer

type LocationStreamer struct {
	IP              string
	Request         ReaderCloserGetter
	Location        *url.URL
	Transport       http.RoundTripper
	ContentType     string
	Flush           bool
	ResponseChecker genericrest.HttpResponseChecker
	RedirectChecker func(req *http.Request, via []*http.Request) error
}

LocationStreamer is a resource that streams the contents of a particular location URL.

func (*LocationStreamer) DeepCopyObject

func (s *LocationStreamer) DeepCopyObject() runtime.Object

func (*LocationStreamer) GetObjectKind

func (s *LocationStreamer) GetObjectKind() schema.ObjectKind

func (*LocationStreamer) InputStream

func (s *LocationStreamer) InputStream(ctx context.Context, apiVersion, acceptHeader string) (stream io.ReadCloser, flush bool, contentType string, err error)

InputStream returns a stream with the contents of the URL location. If no location is provided, a null stream is returned.

type ReaderCloserGetter

type ReaderCloserGetter interface {
	GetReaderCloser() (io.ReadCloser, error)
}

type ResponseError

type ResponseError struct {
	Code    ErrorCode `json:"Code,omitempty"`
	Message string    `json:"Message,omitempty"`
}

Jump to

Keyboard shortcuts

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