Skip to content
Open
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
263 changes: 263 additions & 0 deletions kwok/charts/crds/autoscaling.x-k8s.io_capacitybuffers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
name: capacitybuffers.autoscaling.x-k8s.io
spec:
group: autoscaling.x-k8s.io
names:
categories:
- autoscaling
kind: CapacityBuffer
listKind: CapacityBufferList
plural: capacitybuffers
shortNames:
- cb
singular: capacitybuffer
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The strategy to be used.
jsonPath: .spec.provisioningStrategy
name: Strategy
type: string
- description: The name of the PodTemplate used.
jsonPath: .status.podTemplateRef.name
name: PodTemplate
type: string
- description: The actual number of buffer chunks.
jsonPath: .status.replicas
name: Replicas
type: integer
- description: List of all condition types.
jsonPath: .status.conditions[*].type
name: ConditionsType
type: string
- description: List of all condition statuses.
jsonPath: .status.conditions[*].status
name: ConditionsStatus
type: string
- description: List of all condition reasons.
jsonPath: .status.conditions[*].reason
name: ConditionsReason
type: string
- description: The age of the CapacityBuffer.
jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: |-
CapacityBuffer is the configuration that an autoscaler can use to provision buffer capacity within a cluster.
This buffer is represented by placeholder pods that trigger the Cluster Autoscaler to scale up nodes in advance,
ensuring that there is always spare capacity available to handle sudden workload spikes or to speed up scaling events.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: spec defines the desired characteristics of the buffer.
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
limits specifies resource constraints that limit the number of chunks created for this buffer
based on total resource requests (e.g., CPU, memory). If there are no other
limitations for the number of chunks (i.e., `replicas` or `percentage` are not set),
this will be used to create as many chunks as fit into these limits.
type: object
percentage:
description: |-
percentage defines the desired buffer capacity as a percentage of the
`scalableRef`'s current replicas. This is only applicable if `scalableRef` is set.
The absolute number of replicas is calculated from the percentage by rounding up to a minimum of 1.
For example, if `scalableRef` has 10 replicas and `percentage` is 20, 2 buffer chunks will be created.
format: int32
minimum: 0
type: integer
podTemplateRef:
description: |-
podTemplateRef is a reference to a PodTemplate resource in the same namespace
that declares the shape of a single chunk of the buffer. The pods created
from this template will be used as placeholder pods for the buffer capacity.
Exactly one of `podTemplateRef`, `scalableRef` should be specified.
properties:
name:
description: name of the referent.
minLength: 1
type: string
required:
- name
type: object
provisioningStrategy:
default: buffer.x-k8s.io/active-capacity
description: |-
provisioningStrategy defines how the buffer is utilized.
"buffer.x-k8s.io/active-capacity" is the default strategy, where the buffer actively scales up the cluster by creating placeholder pods.
type: string
replicas:
description: |-
replicas defines the desired number of buffer chunks to provision.
If neither `replicas` nor `percentage` is set, as many chunks as fit within
defined resource limits (if any) will be created. If both are set, the maximum
of the two will be used.
format: int32
minimum: 0
type: integer
scalableRef:
description: |-
scalableRef is a reference to an object of a kind that has a scale subresource
and specifies its label selector field. This allows the CapacityBuffer to
manage the buffer by scaling an existing scalable resource.
Exactly one of `podTemplateRef`, `scalableRef` should be specified.
properties:
apiGroup:
description: |-
apiGroup is the API group of the referent.
Empty string for the core API group.
type: string
kind:
description: kind is the kind of the referent.
minLength: 1
type: string
name:
description: name is the name of the referent.
minLength: 1
type: string
required:
- kind
- name
type: object
type: object
x-kubernetes-validations:
- message: If podTemplateRef is set, replicas or limits must also be set
rule: '!has(self.podTemplateRef) || has(self.replicas) || has(self.limits)'
- message: You must define either PodTemplateRef or ScalableRef, but not
both
rule: '!(has(self.podTemplateRef) && has(self.scalableRef))'
status:
description: status represents the current state of the buffer and its
readiness for autoprovisioning.
properties:
conditions:
description: |-
conditions provide a standard mechanism for reporting the buffer's state.
The "Ready" condition indicates if the buffer is successfully provisioned
and active. Other conditions may report on various aspects of the buffer's
health and provisioning process.
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
podTemplateGeneration:
description: |-
podTemplateGeneration is the observed generation of the PodTemplate, used
to determine if the status is up-to-date with the desired `spec.podTemplateRef`.
format: int64
type: integer
podTemplateRef:
description: |-
podTemplateRef is the observed reference to the PodTemplate that was used
to provision the buffer. If this field is not set, and the `conditions`
indicate an error, it provides details about the error state.
properties:
name:
description: name of the referent.
minLength: 1
type: string
required:
- name
type: object
provisioningStrategy:
description: provisioningStrategy defines how the buffer should be
utilized.
type: string
replicas:
description: replicas is the actual number of buffer chunks currently
provisioned.
format: int32
type: integer
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
5 changes: 4 additions & 1 deletion pkg/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ var (
NodeClaimCRD []byte
//go:embed crds/karpenter.sh_nodeoverlays.yaml
NodeOverlayCRD []byte
CRDs = []*apiextensionsv1.CustomResourceDefinition{
//go:embed crds/autoscaling.x-k8s.io_capacitybuffers.yaml
CapacityBufferCRD []byte
CRDs = []*apiextensionsv1.CustomResourceDefinition{
object.Unmarshal[apiextensionsv1.CustomResourceDefinition](NodePoolCRD),
object.Unmarshal[apiextensionsv1.CustomResourceDefinition](NodeClaimCRD),
object.Unmarshal[apiextensionsv1.CustomResourceDefinition](NodeOverlayCRD),
object.Unmarshal[apiextensionsv1.CustomResourceDefinition](CapacityBufferCRD),
}
)
Loading
Loading