v1

package
v1.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ValidTypeCreate = "valid-create"
	ValidTypeUpdate = "valid-update"
)

Constants for the validation of the pipeline

View Source
const (
	ISBServiceStatusHealthy  = "healthy"
	ISBServiceStatusCritical = "critical"
	ISBServiceStatusWarning  = "warning"
	ISBServiceStatusInactive = "inactive"
)

Variables

This section is empty.

Functions

func NewDexReverseProxy added in v1.0.0

func NewDexReverseProxy(target string) func(c *gin.Context)

NewDexReverseProxy sends the dex request to the dex server.

func NewHandler

func NewHandler(ctx context.Context, dexObj *DexObject, localUsersAuthObject *LocalUsersAuthObject, promQlServiceObj PromQl, opts ...HandlerOption) (*handler, error)

NewHandler is used to provide a new instance of the handler type

func NewNoAuthHandler added in v1.0.0

func NewNoAuthHandler(dexObj *DexObject, localUsersAuthObject *LocalUsersAuthObject) (*noAuthHandler, error)

NewNoAuthHandler is used to provide a new instance of the handler type

Types

type ActiveStatus added in v0.11.0

type ActiveStatus struct {
	Healthy  int `json:"Healthy"`
	Warning  int `json:"Warning"`
	Critical int `json:"Critical"`
}

ActiveStatus contains the number of objects in healthy, warning, and critical status.

type ClusterSummaryResponse added in v0.11.0

type ClusterSummaryResponse []NamespaceSummary

ClusterSummaryResponse is a list of NamespaceSummary of all the namespaces in a cluster wrapped in a list.

type ContainerDetails added in v1.4.0

type ContainerDetails struct {
	Name                   string `json:"name"`
	ID                     string `json:"id"`
	State                  string `json:"state"`
	LastStartedAt          string `json:"lastStartedAt"`
	RestartCount           int32  `json:"restartCount"`
	LastTerminationReason  string `json:"lastTerminationReason"`
	LastTerminationMessage string `json:"lastTerminationMessage"`
	WaitingReason          string `json:"waitingReason"`
	WaitingMessage         string `json:"waitingMessage"`
	TotalCPU               string `json:"totalCPU"`
	TotalMemory            string `json:"totalMemory"`
	RequestedCPU           string `json:"requestedCPU"`
	RequestedMemory        string `json:"requestedMemory"`
	LimitCPU               string `json:"limitCPU"`
	LimitMemory            string `json:"limitMemory"`
}

type DexObject added in v1.0.0

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

DexObject is a struct that holds details for dex handlers.

func NewDexObject added in v1.0.0

func NewDexObject(baseURL string, baseHref string, dexURL string) (*DexObject, error)

NewDexObject returns a new DexObject.

func (*DexObject) Authenticate added in v1.0.0

func (d *DexObject) Authenticate(c *gin.Context) (*authn.UserInfo, error)

type DexRewriteURLRoundTripper added in v1.0.0

type DexRewriteURLRoundTripper struct {
	DexURL *url.URL
	T      http.RoundTripper
}

DexRewriteURLRoundTripper is an HTTP RoundTripper to rewrite HTTP requests to the specified dex server address. This is used when reverse proxying Dex to avoid the API server from unnecessarily communicating to the numaflow server through its externally facing load balancer, which is not always permitted in firewalled/air-gapped networks.

func NewDexRewriteURLRoundTripper added in v1.0.0

func NewDexRewriteURLRoundTripper(dexServerAddr string, T http.RoundTripper) DexRewriteURLRoundTripper

NewDexRewriteURLRoundTripper creates a new DexRewriteURLRoundTripper

func (DexRewriteURLRoundTripper) RoundTrip added in v1.0.0

type Dimension added in v1.4.0

type Dimension struct {
	Name       string   `yaml:"name"`
	Expression string   `yaml:"expr"`
	Filters    []Filter `yaml:"filters"`
}

type Dimensions added in v1.4.0

type Dimensions struct {
	Name    string   `json:"name"`
	Filters []Filter `json:"filters"`
	Params  []Params `json:"params"`
}

type DiscoveryResponse added in v1.4.0

type DiscoveryResponse struct {
	MetricName string       `json:"metric_name"`
	Dimensions []Dimensions `json:"dimensions"`
}

func NewDiscoveryResponse added in v1.4.0

func NewDiscoveryResponse(metricName string, dimensions []Dimensions) DiscoveryResponse

NewDiscoveryResponse creates a new DiscoveryResponse object for each metric.

type Filter added in v1.4.0

type Filter struct {
	Name     string `yaml:"name"`
	Required bool   `yaml:"required"`
}

type HandlerOption added in v1.3.0

type HandlerOption func(*handlerOptions)

func WithDaemonClientProtocol added in v1.3.0

func WithDaemonClientProtocol(protocol string) HandlerOption

WithDaemonClientProtocol sets the protocol of the daemon client.

func WithReadOnlyMode added in v1.3.0

func WithReadOnlyMode() HandlerOption

WithReadOnlyMode sets the server to read-only mode.

type HealthChecker added in v1.2.0

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

HealthChecker is the struct to hold the resource status cache for the pipeline and Mono Vertex

func NewHealthChecker added in v1.2.0

func NewHealthChecker(ctx context.Context) *HealthChecker

NewHealthChecker is used to create a new health checker

type HealthResponse added in v1.2.0

type HealthResponse struct {
	ResourceHealthStatus  string `json:"resourceHealthStatus"`
	DataHealthStatus      string `json:"dataHealthStatus"`
	ResourceHealthMessage string `json:"resourceHealthMessage"`
	DataHealthMessage     string `json:"dataHealthMessage"`
	ResourceHealthCode    string `json:"resourceHealthCode"`
	DataHealthCode        string `json:"dataHealthCode"`
}

HealthResponse is the response payload for health API. It contains the health status of the vertex and data. We include the Status, Message and Code for both resources and data.

func NewHealthResponse added in v1.2.0

func NewHealthResponse(resourceHealthStatus string, dataHealthStatus string,
	resourceHealthMessage string, dataHealthMessage string, resourceHealthCode string,
	dataHealthCode string) HealthResponse

NewHealthResponse returns a HealthResponse object for the given status, message and code.

type ISBService added in v0.11.0

type ISBService struct {
	Name       string                          `json:"name"`
	Status     string                          `json:"status"`
	ISBService v1alpha1.InterStepBufferService `json:"isbService"`
}

ISBService gives the summarized information of an InterStepBufferService

func NewISBService added in v0.11.0

func NewISBService(status string, isb *v1alpha1.InterStepBufferService) ISBService

NewISBService creates a new ISBService object with the given specifications

type ISBServices added in v0.11.0

type ISBServices []ISBService

ISBServices is a list of InterStepBufferServices

type IsbServiceSummary added in v0.11.0

type IsbServiceSummary struct {
	Active   ActiveStatus `json:"active"`
	Inactive int          `json:"inactive"`
}

IsbServiceSummary summarizes the number of active and inactive ISB Service.

type K8sEventsResponse added in v0.11.0

type K8sEventsResponse struct {
	TimeStamp int64  `json:"timestamp"`
	Type      string `json:"type"`
	// Object is in the format of "kind/name", e.g. "Pipeline/simple-pipeline"
	Object  string `json:"object"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

func NewK8sEventsResponse added in v0.11.0

func NewK8sEventsResponse(timestamp int64, eventType, objectKind, objectName, reason, message string) K8sEventsResponse

NewK8sEventsResponse creates a new K8sEventsResponse object with the given inputs.

type LocalUsersAuthObject added in v1.1.0

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

func NewLocalUsersAuthObject added in v1.1.0

func NewLocalUsersAuthObject(ctx context.Context, authDisabled bool) (*LocalUsersAuthObject, error)

NewLocalUsersAuthObject is used to provide a new LocalUsersAuthObject

func (*LocalUsersAuthObject) Authenticate added in v1.1.0

func (l *LocalUsersAuthObject) Authenticate(c *gin.Context) (*authn.UserInfo, error)

func (*LocalUsersAuthObject) GenerateToken added in v1.1.0

func (l *LocalUsersAuthObject) GenerateToken(c *gin.Context, username string) (string, error)

GenerateToken generates a jwt token for the given username

func (*LocalUsersAuthObject) ParseToken added in v1.1.0

func (l *LocalUsersAuthObject) ParseToken(c *gin.Context, tokenString string) (jwt.MapClaims, error)

ParseToken parses a jwt token and returns the claims

func (*LocalUsersAuthObject) VerifyUser added in v1.1.0

func (l *LocalUsersAuthObject) VerifyUser(c *gin.Context, username string, password string) error

type LoginInput added in v1.1.0

type LoginInput struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type LoginResponse added in v1.0.0

type LoginResponse struct {
	AuthCodeURL string `json:"AuthCodeURL"`
}

LoginResponse is the response payload for login API.

func NewLoginResponse added in v1.0.0

func NewLoginResponse(url string) LoginResponse

NewLoginResponse returns a LoginResponse object for the given url.

type Metric added in v1.4.0

type Metric struct {
	Name string `yaml:"metric_name"`
	// array of required labels.
	Filters []string `yaml:"required_filters"`
	//array of dimensions and their data
	Dimensions []Dimension `yaml:"dimensions"`
}

type MetricsDiscoveryResponse added in v1.4.0

type MetricsDiscoveryResponse []DiscoveryResponse

MetricsDiscoveryResponse is a list of DiscoveryResponse

type MetricsRequestBody added in v1.4.0

type MetricsRequestBody struct {
	MetricName string            `json:"metric_name"`
	Dimension  string            `json:"dimension"`
	Filters    map[string]string `json:"filters"`
	Duration   string            `json:"duration"`
	Quantile   string            `json:"quantile"`
	StartTime  string            `json:"start_time"`
	EndTime    string            `json:"end_time"`
}

type MonoVertexInfo added in v1.3.0

type MonoVertexInfo struct {
	Name string `json:"name"`
	// Status shows whether the mono vertex is healthy, warning, critical or inactive.
	Status string `json:"status"`
	// MonoVertex contains the detailed mono vertex spec.
	MonoVertex v1alpha1.MonoVertex `json:"monoVertex"`
}

func NewMonoVertexInfo added in v1.3.0

func NewMonoVertexInfo(status string, mvt *v1alpha1.MonoVertex) MonoVertexInfo

NewMonoVertexInfo creates a new MonoVertexInfo object with the given status and lag

type MonoVertexSummary added in v1.3.0

type MonoVertexSummary struct {
	Active   ActiveStatus `json:"active"`
	Inactive int          `json:"inactive"`
}

MonoVertexSummary summarizes the number of active and inactive mono vertices.

type MonoVertices added in v1.3.0

type MonoVertices []MonoVertexInfo

MonoVertices is a list of mono vertices

type NamespaceSummary added in v1.0.0

type NamespaceSummary struct {
	// IsEmpty indicates whether there are numaflow resources in the namespace.
	// resources include pipelines and ISB services.
	IsEmpty bool `json:"isEmpty"`
	// Namespace is the name of the namespace.
	Namespace         string            `json:"namespace"`
	PipelineSummary   PipelineSummary   `json:"pipelineSummary"`
	IsbServiceSummary IsbServiceSummary `json:"isbServiceSummary"`
	MonoVertexSummary MonoVertexSummary `json:"monoVertexSummary"`
}

NamespaceSummary summarizes information for a given namespace.

func NewNamespaceSummary added in v1.0.0

func NewNamespaceSummary(
	namespace string,
	pipelineSummary PipelineSummary,
	isbSummary IsbServiceSummary,
	monoVertexSummary MonoVertexSummary) NamespaceSummary

NewNamespaceSummary creates a new NamespaceSummary object with the given specifications.

type NumaflowAPIResponse added in v0.11.0

type NumaflowAPIResponse struct {
	// ErrMsg provides more detailed error information. If API call succeeds, the ErrMsg is nil.
	ErrMsg *string `json:"errMsg,omitempty"`
	// Data is the response body.
	Data any `json:"data"`
}

func NewNumaflowAPIResponse added in v0.11.0

func NewNumaflowAPIResponse(errMsg *string, data any) NumaflowAPIResponse

NewNumaflowAPIResponse creates a new NumaflowAPIResponse.

func (NumaflowAPIResponse) MarshalJSON added in v1.3.0

func (r NumaflowAPIResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will marshal the response into a JSON object without having nested "value" field in the JSON for google.protobuf.* types.

type Params added in v1.4.0

type Params struct {
	Name     string `yaml:"name"`
	Required bool   `yaml:"required"`
}

type Pattern added in v1.4.0

type Pattern struct {
	Name        string   `yaml:"name" json:"name"`
	Object      string   `yaml:"object" json:"object"`
	Title       string   `yaml:"title"`
	Description string   `yaml:"description"`
	Expression  string   `yaml:"expr"`
	Params      []Params `yaml:"params"`
	Metrics     []Metric `yaml:"metrics"`
}

type PipelineInfo added in v0.11.0

type PipelineInfo struct {
	Name string `json:"name"`
	// Status shows whether the pipeline is healthy, warning, critical or inactive.
	Status string `json:"status"`
	// Lag shows the pipeline lag.
	Lag *int64 `json:"lag,omitempty"`
	// Pipeline contains the detailed pipeline spec.
	Pipeline v1alpha1.Pipeline `json:"pipeline"`
}

func NewPipelineInfo added in v0.11.0

func NewPipelineInfo(status string, lag *int64, pl *v1alpha1.Pipeline) PipelineInfo

NewPipelineInfo creates a new PipelineInfo object with the given status and lag

type PipelineSummary added in v0.11.0

type PipelineSummary struct {
	Active   ActiveStatus `json:"active"`
	Inactive int          `json:"inactive"`
}

PipelineSummary summarizes the number of active and inactive pipelines.

type Pipelines added in v0.11.0

type Pipelines []PipelineInfo

Pipelines is a list of pipelines

type PodDetails added in v1.4.0

type PodDetails struct {
	Name                string                      `json:"name"`
	Status              string                      `json:"status"`
	Message             string                      `json:"message"`
	Reason              string                      `json:"reason"`
	ContainerDetailsMap map[string]ContainerDetails `json:"containerDetailsMap"`
	TotalCPU            string                      `json:"totalCPU"`
	TotalMemory         string                      `json:"totalMemory"`
}

type PromQl added in v1.4.0

type PromQl interface {
	QueryPrometheus(context.Context, string, time.Time, time.Time) (model.Value, error)
	BuildQuery(MetricsRequestBody) (string, error)
	PopulateReqMap(MetricsRequestBody) map[string]string
	GetConfigData() *PrometheusConfig
	DisableMetricsChart() bool
}

func NewPromQlServiceObject added in v1.4.0

func NewPromQlServiceObject() (PromQl, error)

NewPromQlServiceObject creates a new PromQlService instance

type PromQlService added in v1.4.0

type PromQlService struct {
	PrometheusClient *Prometheus
	PlaceHolders     map[string]map[string][]string
	Expression       map[string]map[string]string
	ConfigData       *PrometheusConfig
}

func (*PromQlService) BuildQuery added in v1.4.0

func (b *PromQlService) BuildQuery(requestBody MetricsRequestBody) (string, error)

BuildQuery build constructs the PromQL query string

func (*PromQlService) DisableMetricsChart added in v1.4.0

func (b *PromQlService) DisableMetricsChart() bool

func (*PromQlService) GetConfigData added in v1.4.0

func (b *PromQlService) GetConfigData() *PrometheusConfig

GetConfigData returns the PrometheusConfig

func (*PromQlService) PopulateReqMap added in v1.4.0

func (b *PromQlService) PopulateReqMap(requestBody MetricsRequestBody) map[string]string

PopulateReqMap populate map based on req fields

func (*PromQlService) QueryPrometheus added in v1.4.0

func (b *PromQlService) QueryPrometheus(ctx context.Context, promql string, start, end time.Time) (model.Value, error)

QueryPrometheus query prometheus server

type Prometheus added in v1.4.0

type Prometheus struct {
	Client PrometheusClient
	Api    PrometheusAPI
}

Prometheus struct holds the client and API

type PrometheusAPI added in v1.4.0

type PrometheusAPI interface {
	QueryRange(ctx context.Context, query string, r v1.Range, opts ...v1.Option) (model.Value, v1.Warnings, error)
}

PrometheusAPI interface for the Prometheus API

type PrometheusClient added in v1.4.0

type PrometheusClient interface {
	// Do implement client methods here
	Do(context.Context, *http.Request) (*http.Response, []byte, error)
}

PrometheusClient interface for the Prometheus HTTP client

type PrometheusConfig added in v1.4.0

type PrometheusConfig struct {
	// prometheus server url in the config
	ServerUrl string `yaml:"url"`
	// patterns in the config
	Patterns []Pattern `yaml:"patterns"`
}

Jump to

Keyboard shortcuts

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