cue.dev/x/k8s.io@v0.7.0

api/policy/v1/schema.cue raw

  1package v1
  2
  3import (
  4	"cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
  5	"cue.dev/x/k8s.io/apimachinery/pkg/util/intstr"
  6)
  7
  8// Eviction evicts a pod from its node subject to certain policies
  9// and safety constraints. This is a subresource of Pod. A
 10// request to cause such an eviction is created by POSTing to
 11// .../pods/<pod name>/evictions.
 12#Eviction: {
 13	// APIVersion defines the versioned schema of this representation
 14	// of an object. Servers should convert recognized schemas to the
 15	// latest internal value, and may reject unrecognized values.
 16	// More info:
 17	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
 18	"apiVersion": "policy/v1"
 19
 20	// DeleteOptions may be provided
 21	"deleteOptions"?: v1.#DeleteOptions
 22
 23	// Kind is a string value representing the REST resource this
 24	// object represents. Servers may infer this from the endpoint
 25	// the client submits requests to. Cannot be updated. In
 26	// CamelCase. More info:
 27	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
 28	"kind": "Eviction"
 29
 30	// ObjectMeta describes the pod that is being evicted.
 31	"metadata"?: v1.#ObjectMeta
 32}
 33
 34// PodDisruptionBudget is an object to define the max disruption
 35// that can be caused to a collection of pods
 36#PodDisruptionBudget: {
 37	// APIVersion defines the versioned schema of this representation
 38	// of an object. Servers should convert recognized schemas to the
 39	// latest internal value, and may reject unrecognized values.
 40	// More info:
 41	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
 42	"apiVersion": "policy/v1"
 43
 44	// Kind is a string value representing the REST resource this
 45	// object represents. Servers may infer this from the endpoint
 46	// the client submits requests to. Cannot be updated. In
 47	// CamelCase. More info:
 48	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
 49	"kind": "PodDisruptionBudget"
 50
 51	// Standard object's metadata. More info:
 52	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
 53	"metadata"?: v1.#ObjectMeta
 54
 55	// Specification of the desired behavior of the
 56	// PodDisruptionBudget.
 57	"spec"?: #PodDisruptionBudgetSpec
 58
 59	// Most recently observed status of the PodDisruptionBudget.
 60	"status"?: #PodDisruptionBudgetStatus
 61}
 62
 63// PodDisruptionBudgetList is a collection of
 64// PodDisruptionBudgets.
 65#PodDisruptionBudgetList: {
 66	// APIVersion defines the versioned schema of this representation
 67	// of an object. Servers should convert recognized schemas to the
 68	// latest internal value, and may reject unrecognized values.
 69	// More info:
 70	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
 71	"apiVersion": "policy/v1"
 72
 73	// Items is a list of PodDisruptionBudgets
 74	"items"!: [...#PodDisruptionBudget]
 75
 76	// Kind is a string value representing the REST resource this
 77	// object represents. Servers may infer this from the endpoint
 78	// the client submits requests to. Cannot be updated. In
 79	// CamelCase. More info:
 80	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
 81	"kind": "PodDisruptionBudgetList"
 82
 83	// Standard object's metadata. More info:
 84	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
 85	"metadata"?: v1.#ListMeta
 86}
 87
 88// PodDisruptionBudgetSpec is a description of a
 89// PodDisruptionBudget.
 90#PodDisruptionBudgetSpec: {
 91	// An eviction is allowed if at most "maxUnavailable" pods
 92	// selected by "selector" are unavailable after the eviction,
 93	// i.e. even in absence of the evicted pod. For example, one can
 94	// prevent all voluntary evictions by specifying 0. This is a
 95	// mutually exclusive setting with "minAvailable".
 96	"maxUnavailable"?: intstr.#IntOrString
 97
 98	// An eviction is allowed if at least "minAvailable" pods selected
 99	// by "selector" will still be available after the eviction, i.e.
100	// even in the absence of the evicted pod. So for example you can
101	// prevent all voluntary evictions by specifying "100%".
102	"minAvailable"?: intstr.#IntOrString
103
104	// Label query over pods whose evictions are managed by the
105	// disruption budget. A null selector will match no pods, while
106	// an empty ({}) selector will select all pods within the
107	// namespace.
108	"selector"?: v1.#LabelSelector
109
110	// UnhealthyPodEvictionPolicy defines the criteria for when
111	// unhealthy pods should be considered for eviction. Current
112	// implementation considers healthy pods, as pods that have
113	// status.conditions item with type="Ready",status="True".
114	//
115	// Valid policies are IfHealthyBudget and AlwaysAllow. If no
116	// policy is specified, the default behavior will be used, which
117	// corresponds to the IfHealthyBudget policy.
118	//
119	// IfHealthyBudget policy means that running pods
120	// (status.phase="Running"), but not yet healthy can be evicted
121	// only if the guarded application is not disrupted
122	// (status.currentHealthy is at least equal to
123	// status.desiredHealthy). Healthy pods will be subject to the
124	// PDB for eviction.
125	//
126	// AlwaysAllow policy means that all running pods
127	// (status.phase="Running"), but not yet healthy are considered
128	// disrupted and can be evicted regardless of whether the
129	// criteria in a PDB is met. This means perspective running pods
130	// of a disrupted application might not get a chance to become
131	// healthy. Healthy pods will be subject to the PDB for eviction.
132	//
133	// Additional policies may be added in the future. Clients making
134	// eviction decisions should disallow eviction of unhealthy pods
135	// if they encounter an unrecognized policy in this field.
136	"unhealthyPodEvictionPolicy"?: string
137}
138
139// PodDisruptionBudgetStatus represents information about the
140// status of a PodDisruptionBudget. Status may trail the actual
141// state of a system.
142#PodDisruptionBudgetStatus: {
143	// Conditions contain conditions for PDB. The disruption
144	// controller sets the DisruptionAllowed condition. The following
145	// are known values for the reason field (additional reasons
146	// could be added in the future): - SyncFailed: The controller
147	// encountered an error and wasn't able to compute
148	// the number of allowed disruptions. Therefore no disruptions are
149	// allowed and the status of the condition will be False.
150	// - InsufficientPods: The number of pods are either at or below
151	// the number
152	// required by the PodDisruptionBudget. No disruptions are
153	// allowed and the status of the condition will be False.
154	// - SufficientPods: There are more pods than required by the
155	// PodDisruptionBudget.
156	// The condition will be True, and the number of allowed
157	// disruptions are provided by the disruptionsAllowed property.
158	"conditions"?: [...v1.#Condition]
159
160	// current number of healthy pods
161	"currentHealthy"!: int32 & int
162
163	// minimum desired number of healthy pods
164	"desiredHealthy"!: int32 & int
165
166	// DisruptedPods contains information about pods whose eviction
167	// was processed by the API server eviction subresource handler
168	// but has not yet been observed by the PodDisruptionBudget
169	// controller. A pod will be in this map from the time when the
170	// API server processed the eviction request to the time when the
171	// pod is seen by PDB controller as having been marked for
172	// deletion (or after a timeout). The key in the map is the name
173	// of the pod and the value is the time when the API server
174	// processed the eviction request. If the deletion didn't occur
175	// and a pod is still there it will be removed from the list
176	// automatically by PodDisruptionBudget controller after some
177	// time. If everything goes smooth this map should be empty for
178	// the most of the time. Large number of entries in the map may
179	// indicate problems with pod deletions.
180	"disruptedPods"?: {
181		[string]: v1.#Time
182	}
183
184	// Number of pod disruptions that are currently allowed.
185	"disruptionsAllowed"!: int32 & int
186
187	// total number of pods counted by this disruption budget
188	"expectedPods"!: int32 & int
189
190	// Most recent generation observed when updating this PDB status.
191	// DisruptionsAllowed and other status information is valid only
192	// if observedGeneration equals to PDB's object generation.
193	"observedGeneration"?: int64 & int
194}