allocationfilterutil

package
v1.104.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamFilterClusters        = "filterClusters"
	ParamFilterNodes           = "filterNodes"
	ParamFilterNamespaces      = "filterNamespaces"
	ParamFilterControllerKinds = "filterControllerKinds"
	ParamFilterControllers     = "filterControllers"
	ParamFilterPods            = "filterPods"
	ParamFilterContainers      = "filterContainers"

	ParamFilterDepartments  = "filterDepartments"
	ParamFilterEnvironments = "filterEnvironments"
	ParamFilterOwners       = "filterOwners"
	ParamFilterProducts     = "filterProducts"
	ParamFilterTeams        = "filterTeams"

	ParamFilterAnnotations = "filterAnnotations"
	ParamFilterLabels      = "filterLabels"
	ParamFilterServices    = "filterServices"
)

Variables

This section is empty.

Functions

func AllHTTPParamKeys added in v1.102.0

func AllHTTPParamKeys() []string

AllHTTPParamKeys returns all HTTP GET parameters used for v1 filters. It is intended to help validate HTTP queries in handlers to help avoid e.g. spelling errors.

func AllocationFilterFromParamsV1

func AllocationFilterFromParamsV1(
	qp mapper.PrimitiveMapReader,
	labelConfig *kubecost.LabelConfig,
	clusterMap clusters.ClusterMap,
) kubecost.AllocationFilter

AllocationFilterFromParamsV1 takes a set of HTTP query parameters and converts them to an AllocationFilter, which is a structured in-Go representation of a set of filters.

The HTTP query parameters are the "v1" filters attached to the Allocation API: "filterNamespaces=", "filterNodes=", etc.

It takes an optional LabelConfig, which if provided enables "label-mapped" filters like "filterDepartments".

It takes an optional ClusterMap, which if provided enables cluster name filtering. This turns all `filterClusters=foo` arguments into the equivalent of `clusterID = "foo" OR clusterName = "foo"`.

func GetAllocationFilterForTheAllocationProperty added in v1.104.0

func GetAllocationFilterForTheAllocationProperty(allocationProp string) (string, error)

func ParseAllocationFilterV1 added in v1.104.0

func ParseAllocationFilterV1(filters FilterV1, labelConfig *kubecost.LabelConfig, clusterMap clusters.ClusterMap) kubecost.AllocationFilter

ParseAllocationFilterV1 takes a FilterV1 struct and converts them to an AllocationFilter, which is a structured in-Go representation of a set of filters.

The HTTP query parameters are the "v1" filters attached to the Allocation API: "filterNamespaces=", "filterNodes=", etc.

It takes an optional LabelConfig, which if provided enables "label-mapped" filters like "filterDepartments".

It takes an optional ClusterMap, which if provided enables cluster name filtering. This turns all `filterClusters=foo` arguments into the equivalent of `clusterID = "foo" OR clusterName = "foo"`.

Types

type FilterV1 added in v1.104.0

type FilterV1 struct {
	Annotations     []string `json:"annotations,omitempty"`
	Containers      []string `json:"containers,omitempty"`
	Controllers     []string `json:"controllers,omitempty"`
	ControllerKinds []string `json:"controllerKinds,omitempty"`
	Clusters        []string `json:"clusters,omitempty"`
	Departments     []string `json:"departments,omitempty"`
	Environments    []string `json:"environments,omitempty"`
	Labels          []string `json:"labels,omitempty"`
	Namespaces      []string `json:"namespaces,omitempty"`
	Nodes           []string `json:"nodes,omitempty"`
	Owners          []string `json:"owners,omitempty"`
	Pods            []string `json:"pods,omitempty"`
	Products        []string `json:"products,omitempty"`
	Services        []string `json:"services,omitempty"`
	Teams           []string `json:"teams,omitempty"`
}

func ConvertFilterQueryParams added in v1.104.0

func ConvertFilterQueryParams(qp mapper.PrimitiveMapReader, labelConfig *kubecost.LabelConfig) FilterV1

func (FilterV1) Equals added in v1.104.0

func (f FilterV1) Equals(that FilterV1) bool

Directories

Path Synopsis
allocationfilterutil provides functionality for parsing V2 of the Kubecost filter language for Allocation types.
allocationfilterutil provides functionality for parsing V2 of the Kubecost filter language for Allocation types.

Jump to

Keyboard shortcuts

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