Api Reference
Packages:
policy.kcloudlabs.io/v1alpha1
Resource Types:ClusterOverridePolicy
ClusterOverridePolicy represents the cluster-wide policy that overrides a group of resources.
| Field | Description | ||||
|---|---|---|---|---|---|
apiVersionstring | policy.kcloudlabs.io/v1alpha1 | ||||
kindstring | ClusterOverridePolicy | ||||
metadataKubernetes meta/v1.ObjectMeta | Refer to the Kubernetes API documentation for the fields of the
metadata field. | ||||
specOverridePolicySpec | Spec represents the desired behavior of ClusterOverridePolicy.
|
ClusterValidatePolicy
ClusterValidatePolicy represents the cluster-wide policy that validate a group of resources.
| Field | Description | ||||
|---|---|---|---|---|---|
apiVersionstring | policy.kcloudlabs.io/v1alpha1 | ||||
kindstring | ClusterValidatePolicy | ||||
metadataKubernetes meta/v1.ObjectMeta | Refer to the Kubernetes API documentation for the fields of the
metadata field. | ||||
specClusterValidatePolicySpec |
|
OverridePolicy
OverridePolicy represents the policy that overrides a group of resources.
| Field | Description | ||||
|---|---|---|---|---|---|
apiVersionstring | policy.kcloudlabs.io/v1alpha1 | ||||
kindstring | OverridePolicy | ||||
metadataKubernetes meta/v1.ObjectMeta | Refer to the Kubernetes API documentation for the fields of the
metadata field. | ||||
specOverridePolicySpec |
|
AffectMode
(string alias)
(Appears on:ValidateCondition)
AffectMode is defining match affect
ClusterValidatePolicySpec
(Appears on:ClusterValidatePolicy)
ClusterValidatePolicySpec defines the desired behavior of ClusterValidatePolicy.
| Field | Description |
|---|---|
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
| Value | Description |
|---|---|
"Equal" | CondEqual - |
"Exist" | CondExist - |
"Gt" | CondGreater - |
"Gte" | CondGreaterOrEqual - |
"In" | CondIn - |
"Lt" | CondLesser - |
"Lte" | CondLesserOrEqual - |
"NotEqual" | CondNotEqual - |
"NotExist" | CondNotExist - |
"NotIn" | CondNotIn - |
"Regex" | CondRegex match regex. e.g. |
ConstantValue
(Appears on:OverrideRuleTemplate, ValidateCondition)
ConstantValue defines exact types. Only one of field can be set.
| Field | Description |
|---|---|
stringstring | (Optional) String as a string |
integerint64 | (Optional) Integer as an integer(int64) |
floatFloat64 | (Optional) Float as float but use string to store, so please provide in comma (e.g. float: “1.2”) |
booleanbool | (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”]) |
stringMapmap[string]string | (Optional) StringMap as key-value set and both are string. |
FieldSelector
(Appears on:ResourceSelector)
| Field | Description |
|---|---|
matchFieldsmap[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)
| Field | Description |
|---|---|
fieldstring | Field is the field key that the selector applies to.
Must provide whole path of key, such as |
operatorKubernetes 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
| Field | Description |
|---|---|
urlstring | (Required)URL as whole http url |
methodstring | (Required)Method as basic http method(e.g. GET or POST) |
headermap[string]string | (Optional) Header represents the custom header added to http request header. |
paramsmap[string]string | (Optional) Params represents the query value for http request. |
bodyk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON | (Optional) Body represents the json body when http method is POST. |
authHttpRequestAuth | Auth defines basic info for get authorization token before do request.
Note: it will request authURL with post and |
HttpRequestAuth
(Appears on:HttpDataRef)
HttpRequestAuth defines basic info for get auth token from remote api
| Field | Description |
|---|---|
staticTokenstring | (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. |
usernamestring | (Optional) Username represents username for auth. |
passwordstring | (Optional) Password represents Password for auth. |
authUrlstring | (Optional) AuthURL represents remote url to request and get token. |
expireDurationKubernetes 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 |
tokenstring | (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. |
expireAtKubernetes 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.
| Field | Description |
|---|---|
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
| Field | Description |
|---|---|
typeOverrideRuleType | (Required)Type represents current rule operate field type. |
operationOverriderOperator | (Required)Operation represents current operation type. |
pathstring | (Optional) Path is field path of current object(e.g. |
valueConstantValue | (Optional) Value sets exact value for rule, like enum or numbers Must set value when type is regex. |
valueRefResourceRefer | (Optional) ValueRef represents for value reference from current or remote object. Need specify the type of object and how to get it. |
resourcesKubernetes core/v1.ResourceRequirements | (Optional) Resources valid only when the type is |
resourcesOversellResourcesOversellRule | (Optional) ResourcesOversell valid only when the type is |
tolerations[]Kubernetes core/v1.Toleration | (Optional) Tolerations valid only when the type is |
affinityKubernetes core/v1.Affinity | (Optional) Affinity valid only when the type is |
OverrideRuleType
(string alias)
(Appears on:OverrideRuleTemplate)
OverrideRuleType is definition for type of single override rule template
| Value | Description |
|---|---|
"affinity" | OverrideRuleTypeAffinity - |
"annotations" | OverrideRuleTypeAnnotations - |
"labels" | OverrideRuleTypeLabels - |
"resources" | OverrideRuleTypeResources - |
"resourcesOversell" | OverrideRuleTypeResourcesOversell - |
"tolerations" | OverrideRuleTypeTolerations - |
OverriderOperator
(string alias)
(Appears on:OverrideRuleTemplate, PlaintextOverrider)
OverriderOperator is the set of operators that can be used in an overrider.
| Value | Description |
|---|---|
"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
| Field | Description |
|---|---|
plaintext[]PlaintextOverrider | (Optional) Plaintext represents override rules defined with plaintext overriders. |
cuestring | (Optional) Cue represents override rules defined with cue code. |
templateOverrideRuleTemplate | (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. |
renderedCuestring | (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.
| Field | Description |
|---|---|
pathstring | Path indicates the path of target field |
opOverriderOperator | Operator indicates the operation on target field. Available operators are: add, update and remove. |
valuek8s.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
| Field | Description |
|---|---|
fromValueRefFrom | (Required)From represents where this referenced object are. |
pathstring | (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. |
k8sResourceSelector | (Optional) K8s means refer another object from current cluster. |
httpHttpDataRef | (Optional) Http means refer data from remote api. |
ResourceSelector
(Appears on:ClusterValidatePolicySpec, OverridePolicySpec, ResourceRefer)
ResourceSelector the resources will be selected.
| Field | Description |
|---|---|
apiVersionstring | (Required)APIVersion represents the API version of the target resources. |
kindstring | (Required)Kind represents the Kind of the target resources. |
namespacestring | (Optional) Namespace of the target resource. Default is empty, which means inherit from the parent object scope. |
namestring | (Optional) Name of the target resource. Default is empty, which means selecting all resources. |
labelSelectorKubernetes meta/v1.LabelSelector | (Optional) A label query over a set of resources. If name is not empty, labelSelector will be ignored. |
fieldSelectorFieldSelector | (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
| Field | Description |
|---|---|
cpuFactorFloat64 | (Optional) CpuFactor factor of cup oversell, it is float number less than 1, the range of value is (0,1.0) |
memoryFactorFloat64 | (Optional) MemoryFactor factor of cup oversell, it is float number less than 1, the range of value is (0,1.0) |
diskFactorFloat64 | (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.
| Field | Description |
|---|---|
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. |
overridersOverriders | (Required)Overriders represents the override rules that would apply on resources |
ValidateCondition
(Appears on:ValidateRuleTemplate)
| Field | Description |
|---|---|
affectModeAffectMode | (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 |
condCond | (Required)Cond represents type of condition (e.g. Equal, Exist) |
dataRefResourceRefer | (Required)DataRef represents for data reference from current or remote object. Need specify the type of object and how to get it. |
messagestring | (Required)Message specify reject message when policy hit. |
valueConstantValue | (Optional) Value sets exact value for rule, like enum or numbers |
valueRefResourceRefer | (Optional) ValueRef represents for value reference from current or remote object. Need specify the type of object and how to get it. |
valueProcessValueProcess | (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
| Field | Description |
|---|---|
typeValidateRuleType | (Required)Type represents current rule operate field type. |
conditionValidateCondition | (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.
| Field | Description |
|---|---|
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. |
cuestring | (Optional) Cue represents validate rules defined with cue code. |
templateValidateRuleTemplate | (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. |
renderedCuestring | (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
| Field | Description |
|---|---|
operationOperationType | (Required)Operation defines the type of operate value, and it should work with operationWith.
For example, operation is |
operationWithk8s.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
| Value | Description |
|---|---|
"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
| Value | Description |
|---|---|
"const" | ValueTypeConst means value is specified exactly. |
"ref" | ValueTypeRefer means value is refer from other object |
Generated with gen-crd-api-reference-docs
.