v1alpha1

package
v0.0.0-...-87be58c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the ratelimit v1alpha1 API group +kubebuilder:object:generate=true +groupName=gateway.kyma-project.io

Index

Constants

View Source
const (
	StatusReady   = "Ready"
	StatusWarning = "Warning"
	StatusError   = "Error"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "gateway.kyma-project.io", Version: "v1alpha1"}

	// 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
)

Functions

This section is empty.

Types

type BucketConfig

type BucketConfig struct {
	Path    string            `json:"path,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	// +kubebuilder:validation:Required
	Bucket BucketSpec `json:"bucket"`
}

BucketConfig represents a rate limit bucket configuration. +kubebuilder:validation:XValidation:rule="((has(self.path)?1:0)+(has(self.headers)?1:0))==1",message="path or headers must be set"

func (*BucketConfig) DeepCopy

func (in *BucketConfig) DeepCopy() *BucketConfig

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

func (*BucketConfig) DeepCopyInto

func (in *BucketConfig) DeepCopyInto(out *BucketConfig)

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

type BucketSpec

type BucketSpec struct {
	// +kubebuilder:validation:Required
	MaxTokens int64 `json:"maxTokens"`
	// +kubebuilder:validation:Required
	TokensPerFill int64 `json:"tokensPerFill"`
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Format=duration
	FillInterval *metav1.Duration `json:"fillInterval"`
}

BucketSpec defines the token bucket specification.

func (*BucketSpec) DeepCopy

func (in *BucketSpec) DeepCopy() *BucketSpec

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

func (*BucketSpec) DeepCopyInto

func (in *BucketSpec) DeepCopyInto(out *BucketSpec)

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

type LocalConfig

type LocalConfig struct {
	// +kubebuilder:validation:Required
	DefaultBucket BucketSpec     `json:"defaultBucket"`
	Buckets       []BucketConfig `json:"buckets,omitempty"`
}

LocalConfig represents the local rate limit configuration.

func (*LocalConfig) DeepCopy

func (in *LocalConfig) DeepCopy() *LocalConfig

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

func (*LocalConfig) DeepCopyInto

func (in *LocalConfig) DeepCopyInto(out *LocalConfig)

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

type RateLimit

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

	Spec   RateLimitSpec   `json:"spec,omitempty"`
	Status RateLimitStatus `json:"status,omitempty"`
}

RateLimit is the Schema for the ratelimits API +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

func (*RateLimit) DeepCopy

func (in *RateLimit) DeepCopy() *RateLimit

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

func (*RateLimit) DeepCopyInto

func (in *RateLimit) DeepCopyInto(out *RateLimit)

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

func (*RateLimit) DeepCopyObject

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

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

type RateLimitList

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

RateLimitList contains a list of RateLimit

func (*RateLimitList) DeepCopy

func (in *RateLimitList) DeepCopy() *RateLimitList

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

func (*RateLimitList) DeepCopyInto

func (in *RateLimitList) DeepCopyInto(out *RateLimitList)

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

func (*RateLimitList) DeepCopyObject

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

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

type RateLimitSpec

type RateLimitSpec struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinProperties=1
	SelectorLabels map[string]string `json:"selectorLabels"`
	// +kubebuilder:validation:Required
	Local LocalConfig `json:"local"`
	// EnableResponseHeaders enables x-rate-limit response headers. The default value is false.
	EnableResponseHeaders bool `json:"enableResponseHeaders,omitempty"`
	// Enforce specifies whether the rate limit should be enforced. The default value is `true`.
	//+kubebuilder:default:=true
	Enforce bool `json:"enforce,omitempty"`
}

RateLimitSpec defines the desired state of RateLimit

func (*RateLimitSpec) DeepCopy

func (in *RateLimitSpec) DeepCopy() *RateLimitSpec

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

func (*RateLimitSpec) DeepCopyInto

func (in *RateLimitSpec) DeepCopyInto(out *RateLimitSpec)

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

type RateLimitStatus

type RateLimitStatus struct {
	// Description defines the description of current State of RateLimit.
	Description string `json:"description,omitempty"`
	// State describes the overall status of RateLimit. Values are `Ready`, `Processing`, `Warning` and `Error`
	State string `json:"state,omitempty"`
}

RateLimitStatus defines the observed state of RateLimit

func (*RateLimitStatus) DeepCopy

func (in *RateLimitStatus) DeepCopy() *RateLimitStatus

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

func (*RateLimitStatus) DeepCopyInto

func (in *RateLimitStatus) DeepCopyInto(out *RateLimitStatus)

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

func (*RateLimitStatus) Error

func (s *RateLimitStatus) Error(err error)

func (*RateLimitStatus) Ready

func (s *RateLimitStatus) Ready()

func (*RateLimitStatus) Warning

func (s *RateLimitStatus) Warning(err error)

Jump to

Keyboard shortcuts

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