utils

package
v0.0.0-...-b5ad383 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotebookPod requestTarget = "pod"
	NotebookSvc requestTarget = "svc"

	JupyterProxy         proxyGroupType = "notebook"
	VSCodeProxy          proxyGroupType = "vscode"
	StableDiffusionProxy proxyGroupType = "sd"
	CommonPortProxy      proxyGroupType = "common"
)

Variables

This section is empty.

Functions

func Failed

func Failed(c *gin.Context, msg string)

func GetCacheKey

func GetCacheKey(namespace, name string, target requestTarget) string

func GetProxyCacheKey

func GetProxyCacheKey(namespace, name string, target proxyGroupType) string

func InitJobMetaObjectByKind

func InitJobMetaObjectByKind(kind string) metav1.Object

func InitJobRuntimeObjectByKind

func InitJobRuntimeObjectByKind(kind string) client.Object

func IsDomainNameAvailable

func IsDomainNameAvailable(domain string) bool

func NewKubeflowProxy

func NewKubeflowProxy() (*httputil.ReverseProxy, error)

func NewMlflowProxy

func NewMlflowProxy() (*httputil.ReverseProxy, error)

func Param

func Param(c *gin.Context, param string) string

Param gets space deduplicated param from URL.

func Query

func Query(c *gin.Context, param string) string

Query gets space deduplicated query from URL.

func Redirect1000

func Redirect1000(c *gin.Context)

func Redirect403

func Redirect403(c *gin.Context)

func Redirect404

func Redirect404(c *gin.Context)

func Redirect500

func Redirect500(c *gin.Context)

func RedirectTo

func RedirectTo(c *gin.Context, redirectTarget string)

func RequestWithHeader

func RequestWithHeader(method string, reqUrl string, header map[string]string, params map[string]string) (status int, body string, err error)

RequestWithHeader is a http client with header, url, and params

func RequestWithPost

func RequestWithPost(reqUrl string, header map[string]string, params map[string]string) (status int, body string, err error)

RequestWithPost is a http client with url, header and params

func RuntimeObjToMetaObj

func RuntimeObjToMetaObj(obj runtime.Object) (metaObj metav1.Object, ok bool)

func Succeed

func Succeed(c *gin.Context, obj interface{})

func TimeTransform

func TimeTransform(from, to string) (fromTime, toTime time.Time, err error)

TimeTransform transforms from-time and to-time from string to a Time instance formatted in RFC3339. Considering time differences between log-timestamp and job-timestamp, we shift 1h earlier for from-time and postpone 1h for to-time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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