v1beta1

package
v2.0.0-...-345fa11 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 13

Documentation

Overview

Package v1beta1 contains API Schema definitions for the marketplace.redhat.com v1beta1 API group +kubebuilder:object:generate=true +groupName=marketplace.redhat.com

Index

Constants

View Source
const (
	WorkloadVertexOperatorGroup WorkloadVertex = "OperatorGroup"
	WorkloadVertexNamespace                    = "Namespace"

	ReconcileError                    status.ConditionType = "ReconcileError"
	MeterDefQueryPreviewSetupError    status.ConditionType = "QueryPreviewSetupError"
	MeterDefVerifyReportingSetupError status.ConditionType = "VerifyReportingSetupError"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "marketplace.redhat.com", Version: "v1beta1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme

	SchemeGroupVersion = GroupVersion
)
View Source
var (
	VerifyReportingErrorCondition = status.Condition{
		Type:   MeterDefVerifyReportingSetupError,
		Reason: "VerifyReportingError",
		Status: corev1.ConditionTrue,
	}

	PreviewErrorCondition = status.Condition{
		Type:   MeterDefQueryPreviewSetupError,
		Reason: "PreviewError",
		Status: corev1.ConditionTrue,
	}
)

Functions

func Resource

func Resource(resource string) schema.GroupResource

Types

type AnnotationFilter

type AnnotationFilter struct {
	// AnnotationSelector are used to filter to the correct workload.
	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	AnnotationSelector *metav1.LabelSelector `json:"annotationSelector,omitempty"`
}

func (*AnnotationFilter) DeepCopy

func (in *AnnotationFilter) DeepCopy() *AnnotationFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnnotationFilter.

func (*AnnotationFilter) DeepCopyInto

func (in *AnnotationFilter) DeepCopyInto(out *AnnotationFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CSVNamespacedName

type CSVNamespacedName common.NamespacedNameReference

func (*CSVNamespacedName) DeepCopy

func (in *CSVNamespacedName) DeepCopy() *CSVNamespacedName

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSVNamespacedName.

func (*CSVNamespacedName) DeepCopyInto

func (in *CSVNamespacedName) DeepCopyInto(out *CSVNamespacedName)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LabelFilter

type LabelFilter struct {
	// LabelSelector are used to filter to the correct workload.
	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
}

func (*LabelFilter) DeepCopy

func (in *LabelFilter) DeepCopy() *LabelFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelFilter.

func (*LabelFilter) DeepCopyInto

func (in *LabelFilter) DeepCopyInto(out *LabelFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MeterDefinition

type MeterDefinition struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   MeterDefinitionSpec   `json:"spec,omitempty"`
	Status MeterDefinitionStatus `json:"status,omitempty"`
}

MeterDefinition defines the meter workloads used to enable pay for use billing. +kubebuilder:object:root=true

+k8s:openapi-gen=true +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:resource:path=meterdefinitions,scope=Namespaced +operator-sdk:gen-csv:customresourcedefinitions.displayName="Meter Definitions" +genclient

func (*MeterDefinition) BuildMeterDefinitionFromString

func (meterdef *MeterDefinition) BuildMeterDefinitionFromString(
	meterdefString, name, namespace, nameLabel, namespaceLabel string) error

func (*MeterDefinition) DeepCopy

func (in *MeterDefinition) DeepCopy() *MeterDefinition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterDefinition.

func (*MeterDefinition) DeepCopyInto

func (in *MeterDefinition) DeepCopyInto(out *MeterDefinition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MeterDefinition) DeepCopyObject

func (in *MeterDefinition) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*MeterDefinition) Hub

func (*MeterDefinition) Hub()

Hub function to create conversion

func (*MeterDefinition) IsSigned

func (meterdef *MeterDefinition) IsSigned() bool

func (*MeterDefinition) ToPrometheusLabels

func (meterdef *MeterDefinition) ToPrometheusLabels() []*common.MeterDefPrometheusLabels

func (*MeterDefinition) ValidateSignature

func (r *MeterDefinition) ValidateSignature() error

type MeterDefinitionList

type MeterDefinitionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MeterDefinition `json:"items"`
}

MeterDefinitionList contains a list of MeterDefinition

func (*MeterDefinitionList) DeepCopy

func (in *MeterDefinitionList) DeepCopy() *MeterDefinitionList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterDefinitionList.

func (*MeterDefinitionList) DeepCopyInto

func (in *MeterDefinitionList) DeepCopyInto(out *MeterDefinitionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MeterDefinitionList) DeepCopyObject

func (in *MeterDefinitionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MeterDefinitionReference

type MeterDefinitionReference struct {
	// Name is the name of the MeterDefinition
	Name string `json:"name"`

	// Namespace is the namespace of the MeterDefinition
	Namespace string `json:"namespace"`

	// UID is the UID of the MeterDefinition
	UID types.UID `json:"uid,omitempty"`

	// ResourceVersion
	ResourceVersion string `json:"resourceVersion,omitempty"`

	// Spec is a copy of the meter definition spec, this can be left empty and later filled in by
	// the report tool.
	//
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	Spec *MeterDefinitionSpec `json:"spec,omitempty"`
}

MeterDefinitionReference is a more friendly form to set on the MeterReport providing the default meter definitions to use for the day.

func (*MeterDefinitionReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterDefinitionReference.

func (*MeterDefinitionReference) DeepCopyInto

func (in *MeterDefinitionReference) DeepCopyInto(out *MeterDefinitionReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MeterDefinitionReference) ToPrometheusLabels

func (meterdef *MeterDefinitionReference) ToPrometheusLabels() ([]*common.MeterDefPrometheusLabels, error)

type MeterDefinitionSpec

type MeterDefinitionSpec struct {
	// Group defines the operator group of the meter
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	Group string `json:"group"`

	// Kind defines the primary CRD kind of the meter
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	Kind string `json:"kind"`

	// ResourceFilters provide filters that will be used to find the workload objects.
	// This is to find the exact resources the query is interested in. At least one must
	// be provided.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +kubebuilder:validation:MinItems:=1
	ResourceFilters []ResourceFilter `json:"resourceFilters"`

	// Meters are the definitions related to the metrics that you would like to monitor.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	// +patchMergeKey=metricId
	// +patchStrategy=merge
	Meters []MeterWorkload `json:"meters"`

	// InstalledBy is a reference to the CSV that install the meter
	// definition. This is used to determine an operator group.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:hidden"
	// +optional
	InstalledBy *common.NamespacedNameReference `json:"installedBy,omitempty"`
}

MeterDefinitionSpec defines the desired metering spec +k8s:openapi-gen=true

func (*MeterDefinitionSpec) DeepCopy

func (in *MeterDefinitionSpec) DeepCopy() *MeterDefinitionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterDefinitionSpec.

func (*MeterDefinitionSpec) DeepCopyInto

func (in *MeterDefinitionSpec) DeepCopyInto(out *MeterDefinitionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MeterDefinitionSpec) ToPrometheusLabels

func (meterdefspec *MeterDefinitionSpec) ToPrometheusLabels(uid, name, namespace string) []*common.MeterDefPrometheusLabels

type MeterDefinitionStatus

type MeterDefinitionStatus struct {
	// Conditions represent the latest available observations of an object's state
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:io.kubernetes.conditions"
	// +optional
	Conditions status.Conditions `json:"conditions,omitempty"`

	// WorkloadResources is the list of resources discovered by
	// this meter definition
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	WorkloadResources []common.WorkloadResource `json:"workloadResource,omitempty"`

	// Results is a list of Results that get returned from a query to prometheus
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Results []common.Result `json:"results,omitempty"`
}

MeterDefinitionStatus defines the observed state of MeterDefinition +k8s:openapi-gen=true +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true

func (*MeterDefinitionStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterDefinitionStatus.

func (*MeterDefinitionStatus) DeepCopyInto

func (in *MeterDefinitionStatus) DeepCopyInto(out *MeterDefinitionStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MeterWorkload

type MeterWorkload struct {
	// Metric is the id of the meter
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	Metric string `json:"metricId"`

	// Name of the metric for humans to read.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	Name string `json:"name,omitempty"`

	// Description is the overview of what the metric is providing for humans to read.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	Description string `json:"description,omitempty"`

	// WorkloadType identifies the type of workload to look for. This can be
	// pod or service right now.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:select:Pod,urn:alm:descriptor:com.tectonic.ui:select:Service,urn:alm:descriptor:com.tectonic.ui:select:PersistentVolumeClaim"
	// +kubebuilder:validation:Enum:=Pod;Service;PersistentVolumeClaim
	WorkloadType common.WorkloadType `json:"workloadType"`

	// MetricType identifies the type of metric this meter definition reports. Currently "billable", "license", "adoption", or "infrastructure".
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:select:adoption,urn:alm:descriptor:com.tectonic.ui:select:billable,urn:alm:descriptor:com.tectonic.ui:select:license,urn:alm:descriptor:com.tectonic.ui:select:infrastructure"
	// +optional
	// +kubebuilder:validation:Enum:=billable;license;adoption;infrastructure
	MetricType common.MetricType `json:"metricType,omitempty"`

	// Group is the set of label fields returned by query to aggregate on.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	// +listType:=set
	GroupBy []string `json:"groupBy,omitempty"`

	// Labels to filter out automatically.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	// +listType:=set
	Without []string `json:"without,omitempty"`

	// Aggregation to use with the query
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:select:sum,urn:alm:descriptor:com.tectonic.ui:select:min,urn:alm:descriptor:com.tectonic.ui:select:max,urn:alm:descriptor:com.tectonic.ui:select:avg"
	// +kubebuilder:validation:Enum:=sum;min;max;avg;group
	Aggregation string `json:"aggregation"`

	// Period is the amount of time to segment the data into. Default is 1h.
	// +optional
	Period *metav1.Duration `json:"period,omitempty"`

	// Query to use for prometheus to find the metrics
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	Query string `json:"query"`

	// Label is the usage metrics key field on the report.
	// Defaults to the metricId field if not provided
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	Label string `json:"label,omitempty"`

	// Unit is the unit of the metrics.
	// Defaults to the metricId field if not provided
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	Unit string `json:"unit,omitempty"`

	// DateLabelOverride provides a means of overriding the date returned for the metric using a label.
	// This is to handle cases where the metric is a constant that is calculated.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	DateLabelOverride string `json:"dateLabelOverride,omitempty"`

	// ValueLabelOverride provides a means of overriding the value returned for the metric using a label.
	// This is to handle cases where the metric is a constant that is calculated.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	ValueLabelOverride string `json:"valueLabelOverride,omitempty"`
}

func (*MeterWorkload) DeepCopy

func (in *MeterWorkload) DeepCopy() *MeterWorkload

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeterWorkload.

func (*MeterWorkload) DeepCopyInto

func (in *MeterWorkload) DeepCopyInto(out *MeterWorkload)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceFilter

type NamespaceFilter struct {
	// UseOperatorGroup use your operator group for namespace filtering
	UseOperatorGroup bool `json:"useOperatorGroup"`

	// LabelSelector are used to filter to the correct workload.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +optional
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
}

func (*NamespaceFilter) DeepCopy

func (in *NamespaceFilter) DeepCopy() *NamespaceFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceFilter.

func (*NamespaceFilter) DeepCopyInto

func (in *NamespaceFilter) DeepCopyInto(out *NamespaceFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OwnerCRDFilter

type OwnerCRDFilter struct {
	common.GroupVersionKind `json:",inline"`
}

func (*OwnerCRDFilter) DeepCopy

func (in *OwnerCRDFilter) DeepCopy() *OwnerCRDFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OwnerCRDFilter.

func (*OwnerCRDFilter) DeepCopyInto

func (in *OwnerCRDFilter) DeepCopyInto(out *OwnerCRDFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceFilter

type ResourceFilter struct {
	// Namespace is the filter to control which namespaces to look for your resources.
	// Default is always Operator Group (supported by OLM)
	Namespace *NamespaceFilter `json:"namespace,omitempty"`

	// OwnerCRD uses the owning CRD to filter resources.
	OwnerCRD *OwnerCRDFilter `json:"ownerCRD,omitempty"`

	// Label uses the resource annotations to find resources to monitor.
	Label *LabelFilter `json:"label,omitempty"`

	// Annotation uses the resource annotations to find resources to monitor.
	Annotation *AnnotationFilter `json:"annotation,omitempty"`

	// WorkloadType identifies the type of workload to look for. This can be
	// pod or service right now.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:select:Pod,urn:alm:descriptor:com.tectonic.ui:select:Service,urn:alm:descriptor:com.tectonic.ui:select:PersistentVolumeClaim"
	// +kubebuilder:validation:Enum:=Pod;Service;PersistentVolumeClaim
	WorkloadType common.WorkloadType `json:"workloadType"`
}

func (*ResourceFilter) DeepCopy

func (in *ResourceFilter) DeepCopy() *ResourceFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceFilter.

func (*ResourceFilter) DeepCopyInto

func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkloadVertex

type WorkloadVertex string

Jump to

Keyboard shortcuts

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