Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s CRD definition for Sentinel rules #182

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: circuitbreakerrules.datasource.sentinel.io
namespace: default
labels:
sentinel-datasource: k8s
spec:
group: datasource.sentinel.io
names:
kind: CircuitBreakerRules
listKind: CircuitBreakerRulesList
plural: circuitbreakerrules
singular: circuitbreakerrule
shortNames:
- cbrs
scope: Namespaced
validation:
openAPIV3Schema:
description: CircuitBreakerRules is the Schema for the circuit breaker rules API
properties:
apiVersion:
description: 'Kind is a string value representing the REST resource this object represents.'
type: string
kind:
description: 'APIVersion defines the versioned schema of this representation of an object.'
type: string
metadata:
type: object
spec:
description: CircuitBreakerRulesSpec defines the desired state of CircuitBreakerRules
properties:
rules:
description: 'rules is the circuit breaker rule list'
items:
properties:
resource:
type: string
minLength: 1
maxLength: 100
strategy:
type: string
enum:
- SlowRequestRatio
- ErrorRatio
- ErrorCount
retryTimeoutMs:
format: int32
type: integer
default: 1000
minimum: 1
minRequestAmount:
format: int64
type: integer
default: 10
minimum: 1
statIntervalMs:
format: int32
type: integer
default: 10000
minimum: 1
maxAllowedRtMs:
format: int64
type: integer
minimum: 1
maxSlowRequestRatio:
type: number
format: float
errorCountThreshold:
format: int64
type: integer
minimum: 1
errorRatioThreshold:
type: number
format: float
required:
- resource
- strategy
type: object
type: array
required:
- rules
type: object
status:
description: CircuitBreakerRulesStatus defines the observed state of CircuitBreakerRules
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: flowrules.datasource.sentinel.io
namespace: default
labels:
sentinel-datasource: k8s
spec:
group: datasource.sentinel.io
names:
kind: FlowRules
listKind: FlowRulesList
plural: flowrules
singular: flowrule
shortNames:
- frs
scope: Namespaced
validation:
openAPIV3Schema:
description: FlowRules is the Schema for the flowrules API
properties:
apiVersion:
description: 'Kind is a string value representing the REST resource this object represents.'
type: string
kind:
description: 'APIVersion defines the versioned schema of this representation of an object.'
type: string
metadata:
type: object
spec:
description: FlowRulesSpec defines the desired state of FlowRules
properties:
rules:
description: 'rules is the flow rule list'
items:
properties:
resource:
type: string
minLength: 1
maxLength: 100
limitOrigin:
type: string
minLength: 1
maxLength: 100
metricType:
type: string
enum:
- Concurrency
- QPS
count:
type: number
format: float
relationStrategy:
type: string
default: Direct
enum:
- Direct
- AssociatedResource
controlBehavior:
type: string
enum:
- Reject
- WarmUp
- Throttling
- WarmUpThrottling
refResource:
type: string
minLength: 1
maxLength: 100
warmUpPeriodSec:
format: int32
type: integer
default: 1
minimum: 0
maxQueueingTimeMs:
format: int32
type: integer
default: 10
minimum: 0
required:
- resource
- metricType
- count
- controlBehavior
type: object
type: array
required:
- rules
type: object
status:
description: FlowRulesStatus defines the observed state of FlowRules
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: hotspotrules.datasource.sentinel.io
namespace: default
labels:
sentinel-datasource: k8s
spec:
group: datasource.sentinel.io
names:
kind: HotspotRules
listKind: HotspotRulesList
plural: hotspotrules
singular: hotspotrule
shortNames:
- hrs
scope: Namespaced
validation:
openAPIV3Schema:
description: HotspotRules is the Schema for the hotspotrules API
properties:
apiVersion:
description: 'Kind is a string value representing the REST resource this object represents.'
type: string
kind:
description: 'APIVersion defines the versioned schema of this representation of an object.'
type: string
metadata:
type: object
spec:
description: HotspotRulesSpec defines the desired state of HotspotRules
properties:
rules:
description: 'rules is the hot spot(frequency) rule list'
items:
properties:
resource:
type: string
minLength: 1
maxLength: 100
metricType:
type: string
enum:
- Concurrency
- QPS
controlBehavior:
type: string
enum:
- Reject
- Throttling
paramIndex:
description: ParamIndex is the index in context arguments list.
type: integer
minimum: 0
threshold:
format: number
type: float
maxQueueingTimeMs:
description: MaxQueueingTimeMs is the max queueing time in Throttling ControlBehavior
format: int64
type: integer
default: 10
minimum: 0
burstCount:
format: int64
type: integer
default: 10
minimum: 0
durationInSec:
format: int64
type: integer
default: 10
minimum: 0
paramsMaxCapacity:
format: int64
type: integer
default: 20000
minimum: 1
specificItems:
description: specific item list
items:
description: 'specific item'
properties:
valKind:
format: string
enum:
- Int
- String
- Bool
- Float64
valStr:
type: string
minLength: 1
maxLength: 100
specificThreshold:
format: int64
type: integer
minimum: 0
required:
- valKind
- valStr
- specificThreshold
type: object
type: array
required:
- resource
- metricType
- controlBehavior
- paramIndex
- threshold
type: object
type: array
required:
- rules
type: object
status:
description: HotspotRulesStatus defines the observed state of HotspotRules
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: systemrules.datasource.sentinel.io
namespace: default
labels:
sentinel-datasource: k8s
spec:
group: datasource.sentinel.io
names:
kind: SystemRules
listKind: SystemRulesList
plural: systemrules
singular: systemrule
shortNames:
- srs
scope: Namespaced
validation:
openAPIV3Schema:
description: SystemRules is the Schema for the systemrules API
properties:
apiVersion:
description: 'Kind is a string value representing the REST resource this object represents.'
type: string
kind:
description: 'APIVersion defines the versioned schema of this representation of an object.'
type: string
metadata:
type: object
spec:
description: SystemRulesSpec defines the desired state of SystemRules
properties:
rules:
description: 'rules is the system rule list'
items:
properties:
metricType:
type: string
enum:
- Load
- AvgRT
- Concurrency
- InboundQPS
- CpuUsage
strategy:
type: string
enum:
- NoAdaptive
- BBR
triggerCount:
type: number
format: float
required:
- metricType
- strategy
- triggerCount
type: object
type: array
required:
- rules
type: object
status:
description: SystemRulesStatus defines the observed state of SystemRules
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true