v1

package
v0.0.0-...-61a2cff Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package v1 contains API Schema definitions for the metering v1 API group +kubebuilder:object:generate=true +groupName=metering.sealos.io

Index

Constants

View Source
const (
	MeteringPrefix           = "metering-"
	ResourceQuotaPrefix      = "quota-"
	METERINGNAMESPACEENV     = "METERING_SYSTEM_NAMESPACE"
	DEFAULTMETERINGNAMESPACE = "metering-system"
	PodResourcePricePrefix   = "sealos-pod-controller"
	UserAnnotationOwnerKey   = "user.sealos.io/creator"
)
View Source
const (
	MINUTE   TimeIntervalType = "Minute"
	HOUR     TimeIntervalType = "Hour"
	DAY      TimeIntervalType = "Day"
	Complete Status           = "complete"
	Create   Status           = "create"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "metering.sealos.io", Version: "v1"}

	// 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
)
View Source
var DefaultPodResourceGVK = []meteringcommonv1.GroupVersionKind{{
	Group:   "",
	Version: "v1",
	Kind:    "pod",
}, {
	Group:   "apps",
	Version: "v1",
	Kind:    "deployment",
}, {
	Group:   "apps",
	Version: "v1",
	Kind:    "statefulset",
}, {
	Group:   "apps",
	Version: "v1",
	Kind:    "daemonset",
},
	{
		Group:   "apps",
		Version: "v1",
		Kind:    "replicaset",
	},
}

Functions

func DefaultResourceQuota

func DefaultResourceQuota() corev1.ResourceList

Types

type BillingList

type BillingList struct {
	Timestamp    int64            `json:"timestamp,omitempty"`
	TimeInterval TimeIntervalType `json:"timeInterval,omitempty"` //time interval,/Minute/Hour/Day
	Settled      bool             `json:"settled,omitempty"`      //is settled
	Amount       int64            `json:"amount,omitempty"`       //need to pay amount,100 = 1¥
}

func (*BillingList) DeepCopy

func (in *BillingList) DeepCopy() *BillingList

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

func (*BillingList) DeepCopyInto

func (in *BillingList) DeepCopyInto(out *BillingList)

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

type Metering

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

	Spec   MeteringSpec   `json:"spec,omitempty"`
	Status MeteringStatus `json:"status,omitempty"`
}

Metering is the Schema for the meterings API

func (*Metering) DeepCopy

func (in *Metering) DeepCopy() *Metering

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

func (*Metering) DeepCopyInto

func (in *Metering) DeepCopyInto(out *Metering)

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

func (*Metering) DeepCopyObject

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

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

type MeteringList

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

MeteringList contains a list of Metering

func (*MeteringList) DeepCopy

func (in *MeteringList) DeepCopy() *MeteringList

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

func (*MeteringList) DeepCopyInto

func (in *MeteringList) DeepCopyInto(out *MeteringList)

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

func (*MeteringList) DeepCopyObject

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

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

type MeteringSpec

type MeteringSpec struct {
	Namespace string `json:"namespace"`
	Owner     string `json:"owner"`

	//timeInterval unit is minutes
	TimeInterval int                                                   `json:"timeInterval,omitempty"`
	Resources    map[corev1.ResourceName]meteringcommonv1.ResourceInfo `json:"resources,omitempty"`
}

MeteringSpec defines the desired state of Metering

func (*MeteringSpec) DeepCopy

func (in *MeteringSpec) DeepCopy() *MeteringSpec

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

func (*MeteringSpec) DeepCopyInto

func (in *MeteringSpec) DeepCopyInto(out *MeteringSpec)

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

type MeteringStatus

type MeteringStatus struct {
	BillingListH     []BillingList `json:"billingListH,omitempty"`
	BillingListD     []BillingList `json:"billingListD,omitempty"`
	TotalAmount      int64         `json:"totalAmount,omitempty"`
	LatestUpdateTime int64         `json:"latestUpdateTime,omitempty"`
	SeqID            int64         `json:"seqID,omitempty"`
}

MeteringStatus defines the observed state of Metering

func (*MeteringStatus) DeepCopy

func (in *MeteringStatus) DeepCopy() *MeteringStatus

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

func (*MeteringStatus) DeepCopyInto

func (in *MeteringStatus) DeepCopyInto(out *MeteringStatus)

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

type PodResource

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

	Spec   PodResourceSpec   `json:"spec,omitempty"`
	Status PodResourceStatus `json:"status,omitempty"`
}

PodResource is the Schema for the podresources API

func (*PodResource) DeepCopy

func (in *PodResource) DeepCopy() *PodResource

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

func (*PodResource) DeepCopyInto

func (in *PodResource) DeepCopyInto(out *PodResource)

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

func (*PodResource) DeepCopyObject

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

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

type PodResourceList

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

PodResourceList contains a list of PodResource

func (*PodResourceList) DeepCopy

func (in *PodResourceList) DeepCopy() *PodResourceList

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

func (*PodResourceList) DeepCopyInto

func (in *PodResourceList) DeepCopyInto(out *PodResourceList)

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

func (*PodResourceList) DeepCopyObject

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

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

type PodResourceSpec

type PodResourceSpec struct {
	ResourceName string                                             `json:"resourceName,omitempty"`
	Resources    map[v1.ResourceName]meteringcommonv1.ResourcePrice `json:"resources,omitempty"`

	// update used resources every Interval minutes
	Interval int `json:"interval,omitempty"`
}

PodResourceSpec defines the desired state of PodResource

func (*PodResourceSpec) DeepCopy

func (in *PodResourceSpec) DeepCopy() *PodResourceSpec

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

func (*PodResourceSpec) DeepCopyInto

func (in *PodResourceSpec) DeepCopyInto(out *PodResourceSpec)

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

type PodResourceStatus

type PodResourceStatus struct {
	LatestUpdateTime int64 `json:"latestUpdateTime,omitempty"`
	SeqID            int64 `json:"seqID,omitempty"`
}

PodResourceStatus defines the observed state of PodResource

func (*PodResourceStatus) DeepCopy

func (in *PodResourceStatus) DeepCopy() *PodResourceStatus

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

func (*PodResourceStatus) DeepCopyInto

func (in *PodResourceStatus) DeepCopyInto(out *PodResourceStatus)

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

type ResourceMsg

type ResourceMsg struct {
	ResourceName corev1.ResourceName
	Amount       int64
	Used         *resource.Quantity
	Unit         *resource.Quantity
}

func (*ResourceMsg) DeepCopy

func (in *ResourceMsg) DeepCopy() *ResourceMsg

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

func (*ResourceMsg) DeepCopyInto

func (in *ResourceMsg) DeepCopyInto(out *ResourceMsg)

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

type Status

type Status string

type TimeIntervalType

type TimeIntervalType string

Jump to

Keyboard shortcuts

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