Kinitiras
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Api Reference

Packages:

policy.kcloudlabs.io/v1alpha1

Resource Types:

ClusterOverridePolicy

ClusterOverridePolicy represents the cluster-wide policy that overrides a group of resources.

FieldDescription
apiVersion
string
policy.kcloudlabs.io/v1alpha1
kind
string
ClusterOverridePolicy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
OverridePolicySpec

Spec represents the desired behavior of ClusterOverridePolicy.



resourceSelectors
[]ResourceSelector
(Optional)

ResourceSelectors restricts resource types that this override policy applies to. nil means matching all resources.

overrideRules
[]RuleWithOperation
(Required)

OverrideRules defines a collection of override rules on target operations.

ClusterValidatePolicy

ClusterValidatePolicy represents the cluster-wide policy that validate a group of resources.

FieldDescription
apiVersion
string
policy.kcloudlabs.io/v1alpha1
kind
string
ClusterValidatePolicy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
ClusterValidatePolicySpec


resourceSelectors
[]ResourceSelector
(Optional)

ResourceSelectors restricts resource types that this validate policy applies to. nil means matching all resources.

validateRules
[]ValidateRuleWithOperation
(Required)

ValidateRules defines a collection of validate rules on target operations.

OverridePolicy

OverridePolicy represents the policy that overrides a group of resources.

FieldDescription
apiVersion
string
policy.kcloudlabs.io/v1alpha1
kind
string
OverridePolicy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
OverridePolicySpec


resourceSelectors
[]ResourceSelector
(Optional)

ResourceSelectors restricts resource types that this override policy applies to. nil means matching all resources.

overrideRules
[]RuleWithOperation
(Required)

OverrideRules defines a collection of override rules on target operations.

AffectMode (string alias)

(Appears on:ValidateCondition)

AffectMode is defining match affect

ClusterValidatePolicySpec

(Appears on:ClusterValidatePolicy)

ClusterValidatePolicySpec defines the desired behavior of ClusterValidatePolicy.

FieldDescription
resourceSelectors
[]ResourceSelector
(Optional)

ResourceSelectors restricts resource types that this validate policy applies to. nil means matching all resources.

validateRules
[]ValidateRuleWithOperation
(Required)

ValidateRules defines a collection of validate rules on target operations.

Cond (string alias)

(Appears on:ValidateCondition)

Cond is validation condition for validator

ValueDescription

"Equal"

CondEqual - Equal

"Exist"

CondExist - Exist

"Gt"

CondGreater - Gt

"Gte"

CondGreaterOrEqual - Gte

"In"

CondIn - In

"Lt"

CondLesser - Lt

"Lte"

CondLesserOrEqual - Lte

"NotEqual"

CondNotEqual - NotEqual

"NotExist"

CondNotExist - NotExist

"NotIn"

CondNotIn - NotIn

"Regex"

CondRegex match regex. e.g. /^\d{1,}$/

ConstantValue

(Appears on:OverrideRuleTemplate, ValidateCondition)

ConstantValue defines exact types. Only one of field can be set.

FieldDescription
string
string
(Optional)

String as a string

integer
int64
(Optional)

Integer as an integer(int64)

float
Float64
(Optional)

Float as float but use string to store, so please provide in comma (e.g. float: “1.2”)

boolean
bool
(Optional)

Boolean only true or false can be recognized.

stringSlice
[]string
(Optional)

StringSlice as a slice of string(e.g. [“a”,“b”])

integerSlice
[]int64
(Optional)

IntegerSlice as a slice of integer(int64) (e.g. [1,2,3])

floatSlice
[]Float64
(Optional)

FloatSlice as a slice of float but using string (e.g. [“1.2”, “2.3”])

stringMap
map[string]string
(Optional)

StringMap as key-value set and both are string.

FieldSelector

(Appears on:ResourceSelector)

FieldDescription
matchFields
map[string]string
(Optional)

matchFields is a map of {key,value} pairs. A single {key,value} in the matchFields map is equivalent to an element of matchExpressions, whose key field is “key”, the operator is “In”, and the values array contains only “value”.

matchExpressions
[]FieldSelectorRequirement
(Optional)

matchExpressions is a list of fields selector requirements. The requirements are ANDed.

FieldSelectorRequirement

(Appears on:FieldSelector)

FieldDescription
field
string

Field is the field key that the selector applies to. Must provide whole path of key, such as metadata.annotations.uid

operator
Kubernetes meta/v1.LabelSelectorOperator

operator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

value
[]string
(Optional)

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.

Float64 (string alias)

(Appears on:ConstantValue, ResourcesOversellRule)

Float64 is alias for float64 as string

HttpDataRef

(Appears on:ResourceRefer)

HttpDataRef defines a http request essential params

FieldDescription
url
string
(Required)

URL as whole http url

method
string
(Required)

Method as basic http method(e.g. GET or POST)

header
map[string]string
(Optional)

Header represents the custom header added to http request header.

params
map[string]string
(Optional)

Params represents the query value for http request.

body
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON
(Optional)

Body represents the json body when http method is POST.

auth
HttpRequestAuth

Auth defines basic info for get authorization token before do request. Note: it will request authURL with post and Header.Set("Authorization", "Basic "+basicAuth(username, password)) and get token from response body. Response Body must be a valid json and contains token like this: `{“token”: “xxx”} . After get the token, the request will add a new key value to header, key is “Authorization” and value is “Bearer xxx”.

HttpRequestAuth

(Appears on:HttpDataRef)

HttpRequestAuth defines basic info for get auth token from remote api

FieldDescription
staticToken
string
(Optional)

StaticToken represents for static token for call api instead of get token from remote api. StaticToken and other fields are mutually exclusive, staticToken is priority to take effect.

username
string
(Optional)

Username represents username for auth.

password
string
(Optional)

Password represents Password for auth.

authUrl
string
(Optional)

AuthURL represents remote url to request and get token.

expireDuration
Kubernetes meta/v1.Duration
(Optional)

ExpireDuration is providing for some auth api won’t return exact expire time, so can you this field set an expiry duration for token

token
string
(Optional)

Token stores the latest token get from AuthURL, and it’ll be updated when token expired. This filed is not fill by user, so don’t edit it.

expireAt
Kubernetes meta/v1.Time
(Optional)

ExpireAt sores the token expire time. Same as above field, this field also updated automatically. This filed is not fill by user, so don’t edit it.

OperationType (string alias)

(Appears on:ValueProcess)

OperationType defines the type of processing value.

OverridePolicySpec

(Appears on:ClusterOverridePolicy, OverridePolicy)

OverridePolicySpec defines the desired behavior of OverridePolicy.

FieldDescription
resourceSelectors
[]ResourceSelector
(Optional)

ResourceSelectors restricts resource types that this override policy applies to. nil means matching all resources.

overrideRules
[]RuleWithOperation
(Required)

OverrideRules defines a collection of override rules on target operations.

OverrideRuleTemplate

(Appears on:Overriders)

OverrideRuleTemplate represents a single template of rule definition

FieldDescription
type
OverrideRuleType
(Required)

Type represents current rule operate field type.

operation
OverriderOperator
(Required)

Operation represents current operation type.

path
string
(Optional)

Path is field path of current object(e.g. /spec/affinity) If current type is annotations or labels, then only need to provide the key, no need whole path.

value
ConstantValue
(Optional)

Value sets exact value for rule, like enum or numbers Must set value when type is regex.

valueRef
ResourceRefer
(Optional)

ValueRef represents for value reference from current or remote object. Need specify the type of object and how to get it.

resources
Kubernetes core/v1.ResourceRequirements
(Optional)

Resources valid only when the type is resources

resourcesOversell
ResourcesOversellRule
(Optional)

ResourcesOversell valid only when the type is resourcesOversell

tolerations
[]Kubernetes core/v1.Toleration
(Optional)

Tolerations valid only when the type is tolerations

affinity
Kubernetes core/v1.Affinity
(Optional)

Affinity valid only when the type is affinity

OverrideRuleType (string alias)

(Appears on:OverrideRuleTemplate)

OverrideRuleType is definition for type of single override rule template

ValueDescription

"affinity"

OverrideRuleTypeAffinity - affinity

"annotations"

OverrideRuleTypeAnnotations - annotations

"labels"

OverrideRuleTypeLabels - labels

"resources"

OverrideRuleTypeResources - resources

"resourcesOversell"

OverrideRuleTypeResourcesOversell - resourcesOversell

"tolerations"

OverrideRuleTypeTolerations - tolerations

OverriderOperator (string alias)

(Appears on:OverrideRuleTemplate, PlaintextOverrider)

OverriderOperator is the set of operators that can be used in an overrider.

ValueDescription

"add"

OverriderOpAdd - “add” value to object

"remove"

OverriderOpRemove - remove field form object

"replace"

OverriderOpReplace - remove and add value(if specified path doesn’t exist, it will add directly)

Overriders

(Appears on:RuleWithOperation)

Overriders offers various alternatives to represent the override rules.

If more than one alternative exist, they will be applied with following order: - RenderCue - Cue - Plaintext

FieldDescription
plaintext
[]PlaintextOverrider
(Optional)

Plaintext represents override rules defined with plaintext overriders.

cue
string
(Optional)

Cue represents override rules defined with cue code.

template
OverrideRuleTemplate
(Optional)

Template of rule which defines override rule, and it will be rendered to CUE and store in RenderedCue field, so if there are any data added manually will be erased.

renderedCue
string
(Optional)

RenderedCue represents override rule defined by Template. Don’t modify the value of this field, modify Rules instead of.

PlaintextOverrider

(Appears on:Overriders)

PlaintextOverrider is a simple overrider that overrides target fields according to path, operator and value.

FieldDescription
path
string

Path indicates the path of target field

op
OverriderOperator

Operator indicates the operation on target field. Available operators are: add, update and remove.

value
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON
(Optional)

Value to be applied to target field. Must be empty when operator is Remove.

ResourceRefer

(Appears on:OverrideRuleTemplate, ValidateCondition)

ResourceRefer defines different types of ref data

FieldDescription
from
ValueRefFrom
(Required)

From represents where this referenced object are.

path
string
(Optional)

Path has different meaning, it represents current object field path like “/spec/replica” when From equals “current” and it also can be format like “data.result.x.y” when From equals “http”, it represents the path in http response Only when From is owner(means refer current object owner), the path can be empty.

k8s
ResourceSelector
(Optional)

K8s means refer another object from current cluster.

http
HttpDataRef
(Optional)

Http means refer data from remote api.

ResourceSelector

(Appears on:ClusterValidatePolicySpec, OverridePolicySpec, ResourceRefer)

ResourceSelector the resources will be selected.

FieldDescription
apiVersion
string
(Required)

APIVersion represents the API version of the target resources.

kind
string
(Required)

Kind represents the Kind of the target resources.

namespace
string
(Optional)

Namespace of the target resource. Default is empty, which means inherit from the parent object scope.

name
string
(Optional)

Name of the target resource. Default is empty, which means selecting all resources.

labelSelector
Kubernetes meta/v1.LabelSelector
(Optional)

A label query over a set of resources. If name is not empty, labelSelector will be ignored.

fieldSelector
FieldSelector
(Optional)

A field query over a set of resources. If name is not empty, fieldSelector wil be ignored.

ResourcesOversellRule

(Appears on:OverrideRuleTemplate)

ResourcesOversellRule defines factor of resource oversell

FieldDescription
cpuFactor
Float64
(Optional)

CpuFactor factor of cup oversell, it is float number less than 1, the range of value is (0,1.0)

memoryFactor
Float64
(Optional)

MemoryFactor factor of cup oversell, it is float number less than 1, the range of value is (0,1.0)

diskFactor
Float64
(Optional)

DiskFactor factor of cup oversell, it is float number less than 1, the range of value is (0,1.0)

RuleWithOperation

(Appears on:OverridePolicySpec)

RuleWithOperation defines the override rules on operations.

FieldDescription
targetOperations
[]Kubernetes admission/v1.Operation

TargetOperations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If ‘*’ is present, the length of the slice must be one. Required.

overriders
Overriders
(Required)

Overriders represents the override rules that would apply on resources

ValidateCondition

(Appears on:ValidateRuleTemplate)

FieldDescription
affectMode
AffectMode
(Required)

AffectMode represents the mode of policy hit affect, in default case(reject), webhook rejects the operation when policy hit, otherwise it will allow the operation. If mode is allow, only allow the operation when policy hit, otherwise reject them all.

cond
Cond
(Required)

Cond represents type of condition (e.g. Equal, Exist)

dataRef
ResourceRefer
(Required)

DataRef represents for data reference from current or remote object. Need specify the type of object and how to get it.

message
string
(Required)

Message specify reject message when policy hit.

value
ConstantValue
(Optional)

Value sets exact value for rule, like enum or numbers

valueRef
ResourceRefer
(Optional)

ValueRef represents for value reference from current or remote object. Need specify the type of object and how to get it.

valueProcess
ValueProcess
(Optional)

ValueProcess represents handle process for value or valueRef. Currently only support for number value, so make sure value or value from remote is a number.

ValidateRuleTemplate

(Appears on:ValidateRuleWithOperation)

ValidateRuleTemplate defines template for validate rule

FieldDescription
type
ValidateRuleType
(Required)

Type represents current rule operate field type.

condition
ValidateCondition
(Optional)

Condition represents general condition rule for more custom demand.

ValidateRuleType (string alias)

(Appears on:ValidateRuleTemplate)

ValidateRuleType is definition for type of single validate rule template

ValidateRuleWithOperation

(Appears on:ClusterValidatePolicySpec)

ValidateRuleWithOperation defines validate rules on operations.

FieldDescription
targetOperations
[]Kubernetes admission/v1.Operation

Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If ‘*’ is present, the length of the slice must be one. Required.

cue
string
(Optional)

Cue represents validate rules defined with cue code.

template
ValidateRuleTemplate
(Optional)

Template of condition which defines validate cond, and it will be rendered to CUE and store in RenderedCue field, so if there are any data added manually will be erased.

renderedCue
string
(Optional)

RenderedCue represents validate rule defined by Template. Don’t modify the value of this field, modify Rules instead of.

ValueProcess

(Appears on:ValidateCondition)

ValueProcess defines operation to handle value to compare. E.g. operation: ‘*’ operationWith: 50% # or 0.5

FieldDescription
operation
OperationType
(Required)

Operation defines the type of operate value, and it should work with operationWith. For example, operation is * and operationWith is 0.5 then in cue the value will be multiplied by 0.5.

operationWith
k8s.io/apimachinery/pkg/util/intstr.IntOrString
(Required)

OperationWith defines value for operate to handle static value or value from remote.

ValueRefFrom (string alias)

(Appears on:ResourceRefer)

ValueRefFrom defines where the override value comes from when value is refer other object or http response

ValueDescription

"current"

FromCurrentObject means read data from current k8s object(the newest one when update operate intercept)

"http"

FromHTTP - read data from http response

"k8s"

FromK8s - read data from other object in current kubernetes

"old"

FromOldObject means read data from old object, only used when object be updated

ValueType (string alias)

ValueType defines whether value is specified by user or refer from other object

ValueDescription

"const"

ValueTypeConst means value is specified exactly.

"ref"

ValueTypeRefer means value is refer from other object


Generated with gen-crd-api-reference-docs .