blob: bb57f2cc436736c85a44ca8e1081a61e8893d234 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright 2015 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Package v1 contains API types that are common to all versions.
18//
19// The package contains two categories of types:
20// - external (serialized) types that lack their own version (e.g TypeMeta)
21// - internal (never-serialized) types that are needed by several different
22// api groups, and so live here, to avoid duplication and/or import loops
23// (e.g. LabelSelector).
24// In the future, we will probably move these categories of objects into
25// separate packages.
26package v1
27
28import (
29 "fmt"
30 "strings"
31
32 "k8s.io/apimachinery/pkg/runtime"
33 "k8s.io/apimachinery/pkg/types"
34)
35
36// TypeMeta describes an individual object in an API response or request
37// with strings representing the type of the object and its API schema version.
38// Structures that are versioned or persisted should inline TypeMeta.
39//
40// +k8s:deepcopy-gen=false
41type TypeMeta struct {
42 // Kind is a string value representing the REST resource this object represents.
43 // Servers may infer this from the endpoint the client submits requests to.
44 // Cannot be updated.
45 // In CamelCase.
46 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
47 // +optional
48 Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
49
50 // APIVersion defines the versioned schema of this representation of an object.
51 // Servers should convert recognized schemas to the latest internal value, and
52 // may reject unrecognized values.
53 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
54 // +optional
55 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"`
56}
57
58// ListMeta describes metadata that synthetic resources must have, including lists and
59// various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
60type ListMeta struct {
61 // selfLink is a URL representing this object.
62 // Populated by the system.
63 // Read-only.
64 //
65 // DEPRECATED
66 // Kubernetes will stop propagating this field in 1.20 release and the field is planned
67 // to be removed in 1.21 release.
68 // +optional
69 SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
70
71 // String that identifies the server's internal version of this object that
72 // can be used by clients to determine when objects have changed.
73 // Value must be treated as opaque by clients and passed unmodified back to the server.
74 // Populated by the system.
75 // Read-only.
76 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
77 // +optional
78 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
79
80 // continue may be set if the user set a limit on the number of items returned, and indicates that
81 // the server has more data available. The value is opaque and may be used to issue another request
82 // to the endpoint that served this list to retrieve the next set of available objects. Continuing a
83 // consistent list may not be possible if the server configuration has changed or more than a few
84 // minutes have passed. The resourceVersion field returned when using this continue value will be
85 // identical to the value in the first response, unless you have received this token from an error
86 // message.
87 Continue string `json:"continue,omitempty" protobuf:"bytes,3,opt,name=continue"`
88
89 // remainingItemCount is the number of subsequent items in the list which are not included in this
90 // list response. If the list request contained label or field selectors, then the number of
91 // remaining items is unknown and the field will be left unset and omitted during serialization.
92 // If the list is complete (either because it is not chunking or because this is the last chunk),
93 // then there are no more remaining items and this field will be left unset and omitted during
94 // serialization.
95 // Servers older than v1.15 do not set this field.
96 // The intended use of the remainingItemCount is *estimating* the size of a collection. Clients
97 // should not rely on the remainingItemCount to be set or to be exact.
98 // +optional
99 RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"`
100}
101
102// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
103const (
104 FinalizerOrphanDependents string = "orphan"
105 FinalizerDeleteDependents string = "foregroundDeletion"
106)
107
108// ObjectMeta is metadata that all persisted resources must have, which includes all objects
109// users must create.
110type ObjectMeta struct {
111 // Name must be unique within a namespace. Is required when creating resources, although
112 // some resources may allow a client to request the generation of an appropriate name
113 // automatically. Name is primarily intended for creation idempotence and configuration
114 // definition.
115 // Cannot be updated.
116 // More info: http://kubernetes.io/docs/user-guide/identifiers#names
117 // +optional
118 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
119
120 // GenerateName is an optional prefix, used by the server, to generate a unique
121 // name ONLY IF the Name field has not been provided.
122 // If this field is used, the name returned to the client will be different
123 // than the name passed. This value will also be combined with a unique suffix.
124 // The provided value has the same validation rules as the Name field,
125 // and may be truncated by the length of the suffix required to make the value
126 // unique on the server.
127 //
128 // If this field is specified and the generated name exists, the server will
129 // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason
130 // ServerTimeout indicating a unique name could not be found in the time allotted, and the client
131 // should retry (optionally after the time indicated in the Retry-After header).
132 //
133 // Applied only if Name is not specified.
134 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
135 // +optional
136 GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"`
137
138 // Namespace defines the space within which each name must be unique. An empty namespace is
139 // equivalent to the "default" namespace, but "default" is the canonical representation.
140 // Not all objects are required to be scoped to a namespace - the value of this field for
141 // those objects will be empty.
142 //
143 // Must be a DNS_LABEL.
144 // Cannot be updated.
145 // More info: http://kubernetes.io/docs/user-guide/namespaces
146 // +optional
147 Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
148
149 // SelfLink is a URL representing this object.
150 // Populated by the system.
151 // Read-only.
152 //
153 // DEPRECATED
154 // Kubernetes will stop propagating this field in 1.20 release and the field is planned
155 // to be removed in 1.21 release.
156 // +optional
157 SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
158
159 // UID is the unique in time and space value for this object. It is typically generated by
160 // the server on successful creation of a resource and is not allowed to change on PUT
161 // operations.
162 //
163 // Populated by the system.
164 // Read-only.
165 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
166 // +optional
167 UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"`
168
169 // An opaque value that represents the internal version of this object that can
170 // be used by clients to determine when objects have changed. May be used for optimistic
171 // concurrency, change detection, and the watch operation on a resource or set of resources.
172 // Clients must treat these values as opaque and passed unmodified back to the server.
173 // They may only be valid for a particular resource or set of resources.
174 //
175 // Populated by the system.
176 // Read-only.
177 // Value must be treated as opaque by clients and .
178 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
179 // +optional
180 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"`
181
182 // A sequence number representing a specific generation of the desired state.
183 // Populated by the system. Read-only.
184 // +optional
185 Generation int64 `json:"generation,omitempty" protobuf:"varint,7,opt,name=generation"`
186
187 // CreationTimestamp is a timestamp representing the server time when this object was
188 // created. It is not guaranteed to be set in happens-before order across separate operations.
189 // Clients may not set this value. It is represented in RFC3339 form and is in UTC.
190 //
191 // Populated by the system.
192 // Read-only.
193 // Null for lists.
194 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
195 // +optional
196 CreationTimestamp Time `json:"creationTimestamp,omitempty" protobuf:"bytes,8,opt,name=creationTimestamp"`
197
198 // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
199 // field is set by the server when a graceful deletion is requested by the user, and is not
200 // directly settable by a client. The resource is expected to be deleted (no longer visible
201 // from resource lists, and not reachable by name) after the time in this field, once the
202 // finalizers list is empty. As long as the finalizers list contains items, deletion is blocked.
203 // Once the deletionTimestamp is set, this value may not be unset or be set further into the
204 // future, although it may be shortened or the resource may be deleted prior to this time.
205 // For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react
206 // by sending a graceful termination signal to the containers in the pod. After that 30 seconds,
207 // the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup,
208 // remove the pod from the API. In the presence of network partitions, this object may still
209 // exist after this timestamp, until an administrator or automated process can determine the
210 // resource is fully terminated.
211 // If not set, graceful deletion of the object has not been requested.
212 //
213 // Populated by the system when a graceful deletion is requested.
214 // Read-only.
215 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
216 // +optional
217 DeletionTimestamp *Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"`
218
219 // Number of seconds allowed for this object to gracefully terminate before
220 // it will be removed from the system. Only set when deletionTimestamp is also set.
221 // May only be shortened.
222 // Read-only.
223 // +optional
224 DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty" protobuf:"varint,10,opt,name=deletionGracePeriodSeconds"`
225
226 // Map of string keys and values that can be used to organize and categorize
227 // (scope and select) objects. May match selectors of replication controllers
228 // and services.
229 // More info: http://kubernetes.io/docs/user-guide/labels
230 // +optional
231 Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`
232
233 // Annotations is an unstructured key value map stored with a resource that may be
234 // set by external tools to store and retrieve arbitrary metadata. They are not
235 // queryable and should be preserved when modifying objects.
236 // More info: http://kubernetes.io/docs/user-guide/annotations
237 // +optional
238 Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`
239
240 // List of objects depended by this object. If ALL objects in the list have
241 // been deleted, this object will be garbage collected. If this object is managed by a controller,
242 // then an entry in this list will point to this controller, with the controller field set to true.
243 // There cannot be more than one managing controller.
244 // +optional
245 // +patchMergeKey=uid
246 // +patchStrategy=merge
247 OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
248
249 // Must be empty before the object is deleted from the registry. Each entry
250 // is an identifier for the responsible component that will remove the entry
251 // from the list. If the deletionTimestamp of the object is non-nil, entries
252 // in this list can only be removed.
253 // Finalizers may be processed and removed in any order. Order is NOT enforced
254 // because it introduces significant risk of stuck finalizers.
255 // finalizers is a shared field, any actor with permission can reorder it.
256 // If the finalizer list is processed in order, then this can lead to a situation
257 // in which the component responsible for the first finalizer in the list is
258 // waiting for a signal (field value, external system, or other) produced by a
259 // component responsible for a finalizer later in the list, resulting in a deadlock.
260 // Without enforced ordering finalizers are free to order amongst themselves and
261 // are not vulnerable to ordering changes in the list.
262 // +optional
263 // +patchStrategy=merge
264 Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
265
266 // The name of the cluster which the object belongs to.
267 // This is used to distinguish resources with same name and namespace in different clusters.
268 // This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
269 // +optional
270 ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
271
272 // ManagedFields maps workflow-id and version to the set of fields
273 // that are managed by that workflow. This is mostly for internal
274 // housekeeping, and users typically shouldn't need to set or
275 // understand this field. A workflow can be the user's name, a
276 // controller's name, or the name of a specific apply path like
277 // "ci-cd". The set of fields is always in the version that the
278 // workflow used when modifying the object.
279 //
280 // +optional
281 ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
282}
283
284const (
285 // NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
286 NamespaceDefault string = "default"
287 // NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
288 NamespaceAll string = ""
289 // NamespaceNone is the argument for a context when there is no namespace.
290 NamespaceNone string = ""
291 // NamespaceSystem is the system namespace where we place system components.
292 NamespaceSystem string = "kube-system"
293 // NamespacePublic is the namespace where we place public info (ConfigMaps)
294 NamespacePublic string = "kube-public"
295)
296
297// OwnerReference contains enough information to let you identify an owning
298// object. An owning object must be in the same namespace as the dependent, or
299// be cluster-scoped, so there is no namespace field.
300type OwnerReference struct {
301 // API version of the referent.
302 APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`
303 // Kind of the referent.
304 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
305 Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
306 // Name of the referent.
307 // More info: http://kubernetes.io/docs/user-guide/identifiers#names
308 Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
309 // UID of the referent.
310 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
311 UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
312 // If true, this reference points to the managing controller.
313 // +optional
314 Controller *bool `json:"controller,omitempty" protobuf:"varint,6,opt,name=controller"`
315 // If true, AND if the owner has the "foregroundDeletion" finalizer, then
316 // the owner cannot be deleted from the key-value store until this
317 // reference is removed.
318 // Defaults to false.
319 // To set this field, a user needs "delete" permission of the owner,
320 // otherwise 422 (Unprocessable Entity) will be returned.
321 // +optional
322 BlockOwnerDeletion *bool `json:"blockOwnerDeletion,omitempty" protobuf:"varint,7,opt,name=blockOwnerDeletion"`
323}
324
325// +k8s:conversion-gen:explicit-from=net/url.Values
326// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
327
328// ListOptions is the query options to a standard REST list call.
329type ListOptions struct {
330 TypeMeta `json:",inline"`
331
332 // A selector to restrict the list of returned objects by their labels.
333 // Defaults to everything.
334 // +optional
335 LabelSelector string `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
336 // A selector to restrict the list of returned objects by their fields.
337 // Defaults to everything.
338 // +optional
339 FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
340
341 // +k8s:deprecated=includeUninitialized,protobuf=6
342
343 // Watch for changes to the described resources and return them as a stream of
344 // add, update, and remove notifications. Specify resourceVersion.
345 // +optional
346 Watch bool `json:"watch,omitempty" protobuf:"varint,3,opt,name=watch"`
347 // allowWatchBookmarks requests watch events with type "BOOKMARK".
348 // Servers that do not implement bookmarks may ignore this flag and
349 // bookmarks are sent at the server's discretion. Clients should not
350 // assume bookmarks are returned at any specific interval, nor may they
351 // assume the server will send any BOOKMARK event during a session.
352 // If this is not a watch, this field is ignored.
353 // If the feature gate WatchBookmarks is not enabled in apiserver,
354 // this field is ignored.
355 // +optional
356 AllowWatchBookmarks bool `json:"allowWatchBookmarks,omitempty" protobuf:"varint,9,opt,name=allowWatchBookmarks"`
357
358 // resourceVersion sets a constraint on what resource versions a request may be served from.
359 // See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
360 // details.
361 //
362 // Defaults to unset
363 // +optional
364 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"`
365
366 // resourceVersionMatch determines how resourceVersion is applied to list calls.
367 // It is highly recommended that resourceVersionMatch be set for list calls where
368 // resourceVersion is set
369 // See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
370 // details.
371 //
372 // Defaults to unset
373 // +optional
374 ResourceVersionMatch ResourceVersionMatch `json:"resourceVersionMatch,omitempty" protobuf:"bytes,10,opt,name=resourceVersionMatch,casttype=ResourceVersionMatch"`
375 // Timeout for the list/watch call.
376 // This limits the duration of the call, regardless of any activity or inactivity.
377 // +optional
378 TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,5,opt,name=timeoutSeconds"`
379
380 // limit is a maximum number of responses to return for a list call. If more items exist, the
381 // server will set the `continue` field on the list metadata to a value that can be used with the
382 // same initial query to retrieve the next set of results. Setting a limit may return fewer than
383 // the requested amount of items (up to zero items) in the event all requested objects are
384 // filtered out and clients should only use the presence of the continue field to determine whether
385 // more results are available. Servers may choose not to support the limit argument and will return
386 // all of the available results. If limit is specified and the continue field is empty, clients may
387 // assume that no more results are available. This field is not supported if watch is true.
388 //
389 // The server guarantees that the objects returned when using continue will be identical to issuing
390 // a single list call without a limit - that is, no objects created, modified, or deleted after the
391 // first request is issued will be included in any subsequent continued requests. This is sometimes
392 // referred to as a consistent snapshot, and ensures that a client that is using limit to receive
393 // smaller chunks of a very large result can ensure they see all possible objects. If objects are
394 // updated during a chunked list the version of the object that was present at the time the first list
395 // result was calculated is returned.
396 Limit int64 `json:"limit,omitempty" protobuf:"varint,7,opt,name=limit"`
397 // The continue option should be set when retrieving more results from the server. Since this value is
398 // server defined, clients may only use the continue value from a previous query result with identical
399 // query parameters (except for the value of continue) and the server may reject a continue value it
400 // does not recognize. If the specified continue value is no longer valid whether due to expiration
401 // (generally five to fifteen minutes) or a configuration change on the server, the server will
402 // respond with a 410 ResourceExpired error together with a continue token. If the client needs a
403 // consistent list, it must restart their list without the continue field. Otherwise, the client may
404 // send another list request with the token received with the 410 error, the server will respond with
405 // a list starting from the next key, but from the latest snapshot, which is inconsistent from the
406 // previous list results - objects that are created, modified, or deleted after the first list request
407 // will be included in the response, as long as their keys are after the "next key".
408 //
409 // This field is not supported when watch is true. Clients may start a watch from the last
410 // resourceVersion value returned by the server and not miss any modifications.
411 Continue string `json:"continue,omitempty" protobuf:"bytes,8,opt,name=continue"`
412}
413
414// resourceVersionMatch specifies how the resourceVersion parameter is applied. resourceVersionMatch
415// may only be set if resourceVersion is also set.
416//
417// "NotOlderThan" matches data at least as new as the provided resourceVersion.
418// "Exact" matches data at the exact resourceVersion provided.
419//
420// See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
421// details.
422type ResourceVersionMatch string
423
424const (
425 // ResourceVersionMatchNotOlderThan matches data at least as new as the provided
426 // resourceVersion.
427 ResourceVersionMatchNotOlderThan ResourceVersionMatch = "NotOlderThan"
428 // ResourceVersionMatchExact matches data at the exact resourceVersion
429 // provided.
430 ResourceVersionMatchExact ResourceVersionMatch = "Exact"
431)
432
433// +k8s:conversion-gen:explicit-from=net/url.Values
434// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
435
436// ExportOptions is the query options to the standard REST get call.
437// Deprecated. Planned for removal in 1.18.
438type ExportOptions struct {
439 TypeMeta `json:",inline"`
440 // Should this value be exported. Export strips fields that a user can not specify.
441 // Deprecated. Planned for removal in 1.18.
442 Export bool `json:"export" protobuf:"varint,1,opt,name=export"`
443 // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.
444 // Deprecated. Planned for removal in 1.18.
445 Exact bool `json:"exact" protobuf:"varint,2,opt,name=exact"`
446}
447
448// +k8s:conversion-gen:explicit-from=net/url.Values
449// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
450
451// GetOptions is the standard query options to the standard REST get call.
452type GetOptions struct {
453 TypeMeta `json:",inline"`
454 // resourceVersion sets a constraint on what resource versions a request may be served from.
455 // See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for
456 // details.
457 //
458 // Defaults to unset
459 // +optional
460 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,1,opt,name=resourceVersion"`
461 // +k8s:deprecated=includeUninitialized,protobuf=2
462}
463
464// DeletionPropagation decides if a deletion will propagate to the dependents of
465// the object, and how the garbage collector will handle the propagation.
466type DeletionPropagation string
467
468const (
469 // Orphans the dependents.
470 DeletePropagationOrphan DeletionPropagation = "Orphan"
471 // Deletes the object from the key-value store, the garbage collector will
472 // delete the dependents in the background.
473 DeletePropagationBackground DeletionPropagation = "Background"
474 // The object exists in the key-value store until the garbage collector
475 // deletes all the dependents whose ownerReference.blockOwnerDeletion=true
476 // from the key-value store. API sever will put the "foregroundDeletion"
477 // finalizer on the object, and sets its deletionTimestamp. This policy is
478 // cascading, i.e., the dependents will be deleted with Foreground.
479 DeletePropagationForeground DeletionPropagation = "Foreground"
480)
481
482const (
483 // DryRunAll means to complete all processing stages, but don't
484 // persist changes to storage.
485 DryRunAll = "All"
486)
487
488// +k8s:conversion-gen:explicit-from=net/url.Values
489// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
490
491// DeleteOptions may be provided when deleting an API object.
492type DeleteOptions struct {
493 TypeMeta `json:",inline"`
494
495 // The duration in seconds before the object should be deleted. Value must be non-negative integer.
496 // The value zero indicates delete immediately. If this value is nil, the default grace period for the
497 // specified type will be used.
498 // Defaults to a per object value if not specified. zero means delete immediately.
499 // +optional
500 GracePeriodSeconds *int64 `json:"gracePeriodSeconds,omitempty" protobuf:"varint,1,opt,name=gracePeriodSeconds"`
501
502 // Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
503 // returned.
504 // +k8s:conversion-gen=false
505 // +optional
506 Preconditions *Preconditions `json:"preconditions,omitempty" protobuf:"bytes,2,opt,name=preconditions"`
507
508 // Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7.
509 // Should the dependent objects be orphaned. If true/false, the "orphan"
510 // finalizer will be added to/removed from the object's finalizers list.
511 // Either this field or PropagationPolicy may be set, but not both.
512 // +optional
513 OrphanDependents *bool `json:"orphanDependents,omitempty" protobuf:"varint,3,opt,name=orphanDependents"`
514
515 // Whether and how garbage collection will be performed.
516 // Either this field or OrphanDependents may be set, but not both.
517 // The default policy is decided by the existing finalizer set in the
518 // metadata.finalizers and the resource-specific default policy.
519 // Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
520 // allow the garbage collector to delete the dependents in the background;
521 // 'Foreground' - a cascading policy that deletes all dependents in the
522 // foreground.
523 // +optional
524 PropagationPolicy *DeletionPropagation `json:"propagationPolicy,omitempty" protobuf:"varint,4,opt,name=propagationPolicy"`
525
526 // When present, indicates that modifications should not be
527 // persisted. An invalid or unrecognized dryRun directive will
528 // result in an error response and no further processing of the
529 // request. Valid values are:
530 // - All: all dry run stages will be processed
531 // +optional
532 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
533}
534
535// +k8s:conversion-gen:explicit-from=net/url.Values
536// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
537
538// CreateOptions may be provided when creating an API object.
539type CreateOptions struct {
540 TypeMeta `json:",inline"`
541
542 // When present, indicates that modifications should not be
543 // persisted. An invalid or unrecognized dryRun directive will
544 // result in an error response and no further processing of the
545 // request. Valid values are:
546 // - All: all dry run stages will be processed
547 // +optional
548 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
549 // +k8s:deprecated=includeUninitialized,protobuf=2
550
551 // fieldManager is a name associated with the actor or entity
552 // that is making these changes. The value must be less than or
553 // 128 characters long, and only contain printable characters,
554 // as defined by https://golang.org/pkg/unicode/#IsPrint.
555 // +optional
556 FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
557}
558
559// +k8s:conversion-gen:explicit-from=net/url.Values
560// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
561
562// PatchOptions may be provided when patching an API object.
563// PatchOptions is meant to be a superset of UpdateOptions.
564type PatchOptions struct {
565 TypeMeta `json:",inline"`
566
567 // When present, indicates that modifications should not be
568 // persisted. An invalid or unrecognized dryRun directive will
569 // result in an error response and no further processing of the
570 // request. Valid values are:
571 // - All: all dry run stages will be processed
572 // +optional
573 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
574
575 // Force is going to "force" Apply requests. It means user will
576 // re-acquire conflicting fields owned by other people. Force
577 // flag must be unset for non-apply patch requests.
578 // +optional
579 Force *bool `json:"force,omitempty" protobuf:"varint,2,opt,name=force"`
580
581 // fieldManager is a name associated with the actor or entity
582 // that is making these changes. The value must be less than or
583 // 128 characters long, and only contain printable characters,
584 // as defined by https://golang.org/pkg/unicode/#IsPrint. This
585 // field is required for apply requests
586 // (application/apply-patch) but optional for non-apply patch
587 // types (JsonPatch, MergePatch, StrategicMergePatch).
588 // +optional
589 FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,3,name=fieldManager"`
590}
591
592// +k8s:conversion-gen:explicit-from=net/url.Values
593// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
594
595// UpdateOptions may be provided when updating an API object.
596// All fields in UpdateOptions should also be present in PatchOptions.
597type UpdateOptions struct {
598 TypeMeta `json:",inline"`
599
600 // When present, indicates that modifications should not be
601 // persisted. An invalid or unrecognized dryRun directive will
602 // result in an error response and no further processing of the
603 // request. Valid values are:
604 // - All: all dry run stages will be processed
605 // +optional
606 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
607
608 // fieldManager is a name associated with the actor or entity
609 // that is making these changes. The value must be less than or
610 // 128 characters long, and only contain printable characters,
611 // as defined by https://golang.org/pkg/unicode/#IsPrint.
612 // +optional
613 FieldManager string `json:"fieldManager,omitempty" protobuf:"bytes,2,name=fieldManager"`
614}
615
616// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
617type Preconditions struct {
618 // Specifies the target UID.
619 // +optional
620 UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
621 // Specifies the target ResourceVersion
622 // +optional
623 ResourceVersion *string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
624}
625
626// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
627
628// Status is a return value for calls that don't return other objects.
629type Status struct {
630 TypeMeta `json:",inline"`
631 // Standard list metadata.
632 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
633 // +optional
634 ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
635
636 // Status of the operation.
637 // One of: "Success" or "Failure".
638 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
639 // +optional
640 Status string `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
641 // A human-readable description of the status of this operation.
642 // +optional
643 Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
644 // A machine-readable description of why this operation is in the
645 // "Failure" status. If this value is empty there
646 // is no information available. A Reason clarifies an HTTP status
647 // code but does not override it.
648 // +optional
649 Reason StatusReason `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason,casttype=StatusReason"`
650 // Extended data associated with the reason. Each reason may define its
651 // own extended details. This field is optional and the data returned
652 // is not guaranteed to conform to any schema except that defined by
653 // the reason type.
654 // +optional
655 Details *StatusDetails `json:"details,omitempty" protobuf:"bytes,5,opt,name=details"`
656 // Suggested HTTP return code for this status, 0 if not set.
657 // +optional
658 Code int32 `json:"code,omitempty" protobuf:"varint,6,opt,name=code"`
659}
660
661// StatusDetails is a set of additional properties that MAY be set by the
662// server to provide additional information about a response. The Reason
663// field of a Status object defines what attributes will be set. Clients
664// must ignore fields that do not match the defined type of each attribute,
665// and should assume that any attribute may be empty, invalid, or under
666// defined.
667type StatusDetails struct {
668 // The name attribute of the resource associated with the status StatusReason
669 // (when there is a single name which can be described).
670 // +optional
671 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
672 // The group attribute of the resource associated with the status StatusReason.
673 // +optional
674 Group string `json:"group,omitempty" protobuf:"bytes,2,opt,name=group"`
675 // The kind attribute of the resource associated with the status StatusReason.
676 // On some operations may differ from the requested resource Kind.
677 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
678 // +optional
679 Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
680 // UID of the resource.
681 // (when there is a single resource which can be described).
682 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
683 // +optional
684 UID types.UID `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
685 // The Causes array includes more details associated with the StatusReason
686 // failure. Not all StatusReasons may provide detailed causes.
687 // +optional
688 Causes []StatusCause `json:"causes,omitempty" protobuf:"bytes,4,rep,name=causes"`
689 // If specified, the time in seconds before the operation should be retried. Some errors may indicate
690 // the client must take an alternate action - for those errors this field may indicate how long to wait
691 // before taking the alternate action.
692 // +optional
693 RetryAfterSeconds int32 `json:"retryAfterSeconds,omitempty" protobuf:"varint,5,opt,name=retryAfterSeconds"`
694}
695
696// Values of Status.Status
697const (
698 StatusSuccess = "Success"
699 StatusFailure = "Failure"
700)
701
702// StatusReason is an enumeration of possible failure causes. Each StatusReason
703// must map to a single HTTP status code, but multiple reasons may map
704// to the same HTTP status code.
705// TODO: move to apiserver
706type StatusReason string
707
708const (
709 // StatusReasonUnknown means the server has declined to indicate a specific reason.
710 // The details field may contain other information about this error.
711 // Status code 500.
712 StatusReasonUnknown StatusReason = ""
713
714 // StatusReasonUnauthorized means the server can be reached and understood the request, but requires
715 // the user to present appropriate authorization credentials (identified by the WWW-Authenticate header)
716 // in order for the action to be completed. If the user has specified credentials on the request, the
717 // server considers them insufficient.
718 // Status code 401
719 StatusReasonUnauthorized StatusReason = "Unauthorized"
720
721 // StatusReasonForbidden means the server can be reached and understood the request, but refuses
722 // to take any further action. It is the result of the server being configured to deny access for some reason
723 // to the requested resource by the client.
724 // Details (optional):
725 // "kind" string - the kind attribute of the forbidden resource
726 // on some operations may differ from the requested
727 // resource.
728 // "id" string - the identifier of the forbidden resource
729 // Status code 403
730 StatusReasonForbidden StatusReason = "Forbidden"
731
732 // StatusReasonNotFound means one or more resources required for this operation
733 // could not be found.
734 // Details (optional):
735 // "kind" string - the kind attribute of the missing resource
736 // on some operations may differ from the requested
737 // resource.
738 // "id" string - the identifier of the missing resource
739 // Status code 404
740 StatusReasonNotFound StatusReason = "NotFound"
741
742 // StatusReasonAlreadyExists means the resource you are creating already exists.
743 // Details (optional):
744 // "kind" string - the kind attribute of the conflicting resource
745 // "id" string - the identifier of the conflicting resource
746 // Status code 409
747 StatusReasonAlreadyExists StatusReason = "AlreadyExists"
748
749 // StatusReasonConflict means the requested operation cannot be completed
750 // due to a conflict in the operation. The client may need to alter the
751 // request. Each resource may define custom details that indicate the
752 // nature of the conflict.
753 // Status code 409
754 StatusReasonConflict StatusReason = "Conflict"
755
756 // StatusReasonGone means the item is no longer available at the server and no
757 // forwarding address is known.
758 // Status code 410
759 StatusReasonGone StatusReason = "Gone"
760
761 // StatusReasonInvalid means the requested create or update operation cannot be
762 // completed due to invalid data provided as part of the request. The client may
763 // need to alter the request. When set, the client may use the StatusDetails
764 // message field as a summary of the issues encountered.
765 // Details (optional):
766 // "kind" string - the kind attribute of the invalid resource
767 // "id" string - the identifier of the invalid resource
768 // "causes" - one or more StatusCause entries indicating the data in the
769 // provided resource that was invalid. The code, message, and
770 // field attributes will be set.
771 // Status code 422
772 StatusReasonInvalid StatusReason = "Invalid"
773
774 // StatusReasonServerTimeout means the server can be reached and understood the request,
775 // but cannot complete the action in a reasonable time. The client should retry the request.
776 // This is may be due to temporary server load or a transient communication issue with
777 // another server. Status code 500 is used because the HTTP spec provides no suitable
778 // server-requested client retry and the 5xx class represents actionable errors.
779 // Details (optional):
780 // "kind" string - the kind attribute of the resource being acted on.
781 // "id" string - the operation that is being attempted.
782 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
783 // Status code 500
784 StatusReasonServerTimeout StatusReason = "ServerTimeout"
785
786 // StatusReasonTimeout means that the request could not be completed within the given time.
787 // Clients can get this response only when they specified a timeout param in the request,
788 // or if the server cannot complete the operation within a reasonable amount of time.
789 // The request might succeed with an increased value of timeout param. The client *should*
790 // wait at least the number of seconds specified by the retryAfterSeconds field.
791 // Details (optional):
792 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
793 // Status code 504
794 StatusReasonTimeout StatusReason = "Timeout"
795
796 // StatusReasonTooManyRequests means the server experienced too many requests within a
797 // given window and that the client must wait to perform the action again. A client may
798 // always retry the request that led to this error, although the client should wait at least
799 // the number of seconds specified by the retryAfterSeconds field.
800 // Details (optional):
801 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
802 // Status code 429
803 StatusReasonTooManyRequests StatusReason = "TooManyRequests"
804
805 // StatusReasonBadRequest means that the request itself was invalid, because the request
806 // doesn't make any sense, for example deleting a read-only object. This is different than
807 // StatusReasonInvalid above which indicates that the API call could possibly succeed, but the
808 // data was invalid. API calls that return BadRequest can never succeed.
809 // Status code 400
810 StatusReasonBadRequest StatusReason = "BadRequest"
811
812 // StatusReasonMethodNotAllowed means that the action the client attempted to perform on the
813 // resource was not supported by the code - for instance, attempting to delete a resource that
814 // can only be created. API calls that return MethodNotAllowed can never succeed.
815 // Status code 405
816 StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
817
818 // StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable
819 // to the server - for instance, attempting to receive protobuf for a resource that supports only json and yaml.
820 // API calls that return NotAcceptable can never succeed.
821 // Status code 406
822 StatusReasonNotAcceptable StatusReason = "NotAcceptable"
823
824 // StatusReasonRequestEntityTooLarge means that the request entity is too large.
825 // Status code 413
826 StatusReasonRequestEntityTooLarge StatusReason = "RequestEntityTooLarge"
827
828 // StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
829 // to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
830 // API calls that return UnsupportedMediaType can never succeed.
831 // Status code 415
832 StatusReasonUnsupportedMediaType StatusReason = "UnsupportedMediaType"
833
834 // StatusReasonInternalError indicates that an internal error occurred, it is unexpected
835 // and the outcome of the call is unknown.
836 // Details (optional):
837 // "causes" - The original error
838 // Status code 500
839 StatusReasonInternalError StatusReason = "InternalError"
840
841 // StatusReasonExpired indicates that the request is invalid because the content you are requesting
842 // has expired and is no longer available. It is typically associated with watches that can't be
843 // serviced.
844 // Status code 410 (gone)
845 StatusReasonExpired StatusReason = "Expired"
846
847 // StatusReasonServiceUnavailable means that the request itself was valid,
848 // but the requested service is unavailable at this time.
849 // Retrying the request after some time might succeed.
850 // Status code 503
851 StatusReasonServiceUnavailable StatusReason = "ServiceUnavailable"
852)
853
854// StatusCause provides more information about an api.Status failure, including
855// cases when multiple errors are encountered.
856type StatusCause struct {
857 // A machine-readable description of the cause of the error. If this value is
858 // empty there is no information available.
859 // +optional
860 Type CauseType `json:"reason,omitempty" protobuf:"bytes,1,opt,name=reason,casttype=CauseType"`
861 // A human-readable description of the cause of the error. This field may be
862 // presented as-is to a reader.
863 // +optional
864 Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
865 // The field of the resource that has caused this error, as named by its JSON
866 // serialization. May include dot and postfix notation for nested attributes.
867 // Arrays are zero-indexed. Fields may appear more than once in an array of
868 // causes due to fields having multiple errors.
869 // Optional.
870 //
871 // Examples:
872 // "name" - the field "name" on the current resource
873 // "items[0].name" - the field "name" on the first array entry in "items"
874 // +optional
875 Field string `json:"field,omitempty" protobuf:"bytes,3,opt,name=field"`
876}
877
878// CauseType is a machine readable value providing more detail about what
879// occurred in a status response. An operation may have multiple causes for a
880// status (whether Failure or Success).
881type CauseType string
882
883const (
884 // CauseTypeFieldValueNotFound is used to report failure to find a requested value
885 // (e.g. looking up an ID).
886 CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound"
887 // CauseTypeFieldValueRequired is used to report required values that are not
888 // provided (e.g. empty strings, null values, or empty arrays).
889 CauseTypeFieldValueRequired CauseType = "FieldValueRequired"
890 // CauseTypeFieldValueDuplicate is used to report collisions of values that must be
891 // unique (e.g. unique IDs).
892 CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate"
893 // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex
894 // match).
895 CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid"
896 // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
897 // values that can not be handled (e.g. an enumerated string).
898 CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
899 // CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
900 // without the expected return type. The presence of this cause indicates the error may be
901 // due to an intervening proxy or the server software malfunctioning.
902 CauseTypeUnexpectedServerResponse CauseType = "UnexpectedServerResponse"
903 // FieldManagerConflict is used to report when another client claims to manage this field,
904 // It should only be returned for a request using server-side apply.
905 CauseTypeFieldManagerConflict CauseType = "FieldManagerConflict"
906 // CauseTypeResourceVersionTooLarge is used to report that the requested resource version
907 // is newer than the data observed by the API server, so the request cannot be served.
908 CauseTypeResourceVersionTooLarge CauseType = "ResourceVersionTooLarge"
909)
910
911// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
912
913// List holds a list of objects, which may not be known by the server.
914type List struct {
915 TypeMeta `json:",inline"`
916 // Standard list metadata.
917 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
918 // +optional
919 ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
920
921 // List of objects
922 Items []runtime.RawExtension `json:"items" protobuf:"bytes,2,rep,name=items"`
923}
924
925// APIVersions lists the versions that are available, to allow clients to
926// discover the API at /api, which is the root path of the legacy v1 API.
927//
928// +protobuf.options.(gogoproto.goproto_stringer)=false
929// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
930type APIVersions struct {
931 TypeMeta `json:",inline"`
932 // versions are the api versions that are available.
933 Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"`
934 // a map of client CIDR to server address that is serving this group.
935 // This is to help clients reach servers in the most network-efficient way possible.
936 // Clients can use the appropriate server address as per the CIDR that they match.
937 // In case of multiple matches, clients should use the longest matching CIDR.
938 // The server returns only those CIDRs that it thinks that the client can match.
939 // For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
940 // Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
941 ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" protobuf:"bytes,2,rep,name=serverAddressByClientCIDRs"`
942}
943
944// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
945
946// APIGroupList is a list of APIGroup, to allow clients to discover the API at
947// /apis.
948type APIGroupList struct {
949 TypeMeta `json:",inline"`
950 // groups is a list of APIGroup.
951 Groups []APIGroup `json:"groups" protobuf:"bytes,1,rep,name=groups"`
952}
953
954// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
955
956// APIGroup contains the name, the supported versions, and the preferred version
957// of a group.
958type APIGroup struct {
959 TypeMeta `json:",inline"`
960 // name is the name of the group.
961 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
962 // versions are the versions supported in this group.
963 Versions []GroupVersionForDiscovery `json:"versions" protobuf:"bytes,2,rep,name=versions"`
964 // preferredVersion is the version preferred by the API server, which
965 // probably is the storage version.
966 // +optional
967 PreferredVersion GroupVersionForDiscovery `json:"preferredVersion,omitempty" protobuf:"bytes,3,opt,name=preferredVersion"`
968 // a map of client CIDR to server address that is serving this group.
969 // This is to help clients reach servers in the most network-efficient way possible.
970 // Clients can use the appropriate server address as per the CIDR that they match.
971 // In case of multiple matches, clients should use the longest matching CIDR.
972 // The server returns only those CIDRs that it thinks that the client can match.
973 // For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
974 // Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
975 // +optional
976 ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs,omitempty" protobuf:"bytes,4,rep,name=serverAddressByClientCIDRs"`
977}
978
979// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
980type ServerAddressByClientCIDR struct {
981 // The CIDR with which clients can match their IP to figure out the server address that they should use.
982 ClientCIDR string `json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
983 // Address of this server, suitable for a client that matches the above CIDR.
984 // This can be a hostname, hostname:port, IP or IP:port.
985 ServerAddress string `json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
986}
987
988// GroupVersion contains the "group/version" and "version" string of a version.
989// It is made a struct to keep extensibility.
990type GroupVersionForDiscovery struct {
991 // groupVersion specifies the API group and version in the form "group/version"
992 GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
993 // version specifies the version in the form of "version". This is to save
994 // the clients the trouble of splitting the GroupVersion.
995 Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
996}
997
998// APIResource specifies the name of a resource and whether it is namespaced.
999type APIResource struct {
1000 // name is the plural name of the resource.
1001 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
1002 // singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely.
1003 // The singularName is more correct for reporting status on a single item and both singular and plural are allowed
1004 // from the kubectl CLI interface.
1005 SingularName string `json:"singularName" protobuf:"bytes,6,opt,name=singularName"`
1006 // namespaced indicates if a resource is namespaced or not.
1007 Namespaced bool `json:"namespaced" protobuf:"varint,2,opt,name=namespaced"`
1008 // group is the preferred group of the resource. Empty implies the group of the containing resource list.
1009 // For subresources, this may have a different value, for example: Scale".
1010 Group string `json:"group,omitempty" protobuf:"bytes,8,opt,name=group"`
1011 // version is the preferred version of the resource. Empty implies the version of the containing resource list
1012 // For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)".
1013 Version string `json:"version,omitempty" protobuf:"bytes,9,opt,name=version"`
1014 // kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')
1015 Kind string `json:"kind" protobuf:"bytes,3,opt,name=kind"`
1016 // verbs is a list of supported kube verbs (this includes get, list, watch, create,
1017 // update, patch, delete, deletecollection, and proxy)
1018 Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
1019 // shortNames is a list of suggested short names of the resource.
1020 ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"`
1021 // categories is a list of the grouped resources this resource belongs to (e.g. 'all')
1022 Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"`
1023 // The hash value of the storage version, the version this resource is
1024 // converted to when written to the data store. Value must be treated
1025 // as opaque by clients. Only equality comparison on the value is valid.
1026 // This is an alpha feature and may change or be removed in the future.
1027 // The field is populated by the apiserver only if the
1028 // StorageVersionHash feature gate is enabled.
1029 // This field will remain optional even if it graduates.
1030 // +optional
1031 StorageVersionHash string `json:"storageVersionHash,omitempty" protobuf:"bytes,10,opt,name=storageVersionHash"`
1032}
1033
1034// Verbs masks the value so protobuf can generate
1035//
1036// +protobuf.nullable=true
1037// +protobuf.options.(gogoproto.goproto_stringer)=false
1038type Verbs []string
1039
1040func (vs Verbs) String() string {
1041 return fmt.Sprintf("%v", []string(vs))
1042}
1043
1044// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1045
1046// APIResourceList is a list of APIResource, it is used to expose the name of the
1047// resources supported in a specific group and version, and if the resource
1048// is namespaced.
1049type APIResourceList struct {
1050 TypeMeta `json:",inline"`
1051 // groupVersion is the group and version this APIResourceList is for.
1052 GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
1053 // resources contains the name of the resources and if they are namespaced.
1054 APIResources []APIResource `json:"resources" protobuf:"bytes,2,rep,name=resources"`
1055}
1056
1057// RootPaths lists the paths available at root.
1058// For example: "/healthz", "/apis".
1059type RootPaths struct {
1060 // paths are the paths available at root.
1061 Paths []string `json:"paths" protobuf:"bytes,1,rep,name=paths"`
1062}
1063
1064// TODO: remove me when watch is refactored
1065func LabelSelectorQueryParam(version string) string {
1066 return "labelSelector"
1067}
1068
1069// TODO: remove me when watch is refactored
1070func FieldSelectorQueryParam(version string) string {
1071 return "fieldSelector"
1072}
1073
1074// String returns available api versions as a human-friendly version string.
1075func (apiVersions APIVersions) String() string {
1076 return strings.Join(apiVersions.Versions, ",")
1077}
1078
1079func (apiVersions APIVersions) GoString() string {
1080 return apiVersions.String()
1081}
1082
1083// Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
1084type Patch struct{}
1085
1086// Note:
1087// There are two different styles of label selectors used in versioned types:
1088// an older style which is represented as just a string in versioned types, and a
1089// newer style that is structured. LabelSelector is an internal representation for the
1090// latter style.
1091
1092// A label selector is a label query over a set of resources. The result of matchLabels and
1093// matchExpressions are ANDed. An empty label selector matches all objects. A null
1094// label selector matches no objects.
1095type LabelSelector struct {
1096 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1097 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1098 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1099 // +optional
1100 MatchLabels map[string]string `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"`
1101 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1102 // +optional
1103 MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"`
1104}
1105
1106// A label selector requirement is a selector that contains values, a key, and an operator that
1107// relates the key and values.
1108type LabelSelectorRequirement struct {
1109 // key is the label key that the selector applies to.
1110 // +patchMergeKey=key
1111 // +patchStrategy=merge
1112 Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
1113 // operator represents a key's relationship to a set of values.
1114 // Valid operators are In, NotIn, Exists and DoesNotExist.
1115 Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"`
1116 // values is an array of string values. If the operator is In or NotIn,
1117 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1118 // the values array must be empty. This array is replaced during a strategic
1119 // merge patch.
1120 // +optional
1121 Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
1122}
1123
1124// A label selector operator is the set of operators that can be used in a selector requirement.
1125type LabelSelectorOperator string
1126
1127const (
1128 LabelSelectorOpIn LabelSelectorOperator = "In"
1129 LabelSelectorOpNotIn LabelSelectorOperator = "NotIn"
1130 LabelSelectorOpExists LabelSelectorOperator = "Exists"
1131 LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist"
1132)
1133
1134// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
1135// that the fieldset applies to.
1136type ManagedFieldsEntry struct {
1137 // Manager is an identifier of the workflow managing these fields.
1138 Manager string `json:"manager,omitempty" protobuf:"bytes,1,opt,name=manager"`
1139 // Operation is the type of operation which lead to this ManagedFieldsEntry being created.
1140 // The only valid values for this field are 'Apply' and 'Update'.
1141 Operation ManagedFieldsOperationType `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation,casttype=ManagedFieldsOperationType"`
1142 // APIVersion defines the version of this resource that this field set
1143 // applies to. The format is "group/version" just like the top-level
1144 // APIVersion field. It is necessary to track the version of a field
1145 // set because it cannot be automatically converted.
1146 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"`
1147 // Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'
1148 // +optional
1149 Time *Time `json:"time,omitempty" protobuf:"bytes,4,opt,name=time"`
1150
1151 // Fields is tombstoned to show why 5 is a reserved protobuf tag.
1152 //Fields *Fields `json:"fields,omitempty" protobuf:"bytes,5,opt,name=fields,casttype=Fields"`
1153
1154 // FieldsType is the discriminator for the different fields format and version.
1155 // There is currently only one possible value: "FieldsV1"
1156 FieldsType string `json:"fieldsType,omitempty" protobuf:"bytes,6,opt,name=fieldsType"`
1157 // FieldsV1 holds the first JSON version format as described in the "FieldsV1" type.
1158 // +optional
1159 FieldsV1 *FieldsV1 `json:"fieldsV1,omitempty" protobuf:"bytes,7,opt,name=fieldsV1"`
1160}
1161
1162// ManagedFieldsOperationType is the type of operation which lead to a ManagedFieldsEntry being created.
1163type ManagedFieldsOperationType string
1164
1165const (
1166 ManagedFieldsOperationApply ManagedFieldsOperationType = "Apply"
1167 ManagedFieldsOperationUpdate ManagedFieldsOperationType = "Update"
1168)
1169
1170// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.
1171//
1172// Each key is either a '.' representing the field itself, and will always map to an empty set,
1173// or a string representing a sub-field or item. The string will follow one of these four formats:
1174// 'f:<name>', where <name> is the name of a field in a struct, or key in a map
1175// 'v:<value>', where <value> is the exact json formatted value of a list item
1176// 'i:<index>', where <index> is position of a item in a list
1177// 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
1178// If a key maps to an empty Fields value, the field that key represents is part of the set.
1179//
1180// The exact format is defined in sigs.k8s.io/structured-merge-diff
1181// +protobuf.options.(gogoproto.goproto_stringer)=false
1182type FieldsV1 struct {
1183 // Raw is the underlying serialization of this object.
1184 Raw []byte `json:"-" protobuf:"bytes,1,opt,name=Raw"`
1185}
1186
1187func (f FieldsV1) String() string {
1188 return string(f.Raw)
1189}
1190
1191// TODO: Table does not generate to protobuf because of the interface{} - fix protobuf
1192// generation to support a meta type that can accept any valid JSON. This can be introduced
1193// in a v1 because clients a) receive an error if they try to access proto today, and b)
1194// once introduced they would be able to gracefully switch over to using it.
1195
1196// Table is a tabular representation of a set of API resources. The server transforms the
1197// object into a set of preferred columns for quickly reviewing the objects.
1198// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1199// +protobuf=false
1200type Table struct {
1201 TypeMeta `json:",inline"`
1202 // Standard list metadata.
1203 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1204 // +optional
1205 ListMeta `json:"metadata,omitempty"`
1206
1207 // columnDefinitions describes each column in the returned items array. The number of cells per row
1208 // will always match the number of column definitions.
1209 ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
1210 // rows is the list of items in the table.
1211 Rows []TableRow `json:"rows"`
1212}
1213
1214// TableColumnDefinition contains information about a column returned in the Table.
1215// +protobuf=false
1216type TableColumnDefinition struct {
1217 // name is a human readable name for the column.
1218 Name string `json:"name"`
1219 // type is an OpenAPI type definition for this column, such as number, integer, string, or
1220 // array.
1221 // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
1222 Type string `json:"type"`
1223 // format is an optional OpenAPI type modifier for this column. A format modifies the type and
1224 // imposes additional rules, like date or time formatting for a string. The 'name' format is applied
1225 // to the primary identifier column which has type 'string' to assist in clients identifying column
1226 // is the resource name.
1227 // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
1228 Format string `json:"format"`
1229 // description is a human readable description of this column.
1230 Description string `json:"description"`
1231 // priority is an integer defining the relative importance of this column compared to others. Lower
1232 // numbers are considered higher priority. Columns that may be omitted in limited space scenarios
1233 // should be given a higher priority.
1234 Priority int32 `json:"priority"`
1235}
1236
1237// TableRow is an individual row in a table.
1238// +protobuf=false
1239type TableRow struct {
1240 // cells will be as wide as the column definitions array and may contain strings, numbers (float64 or
1241 // int64), booleans, simple maps, lists, or null. See the type field of the column definition for a
1242 // more detailed description.
1243 Cells []interface{} `json:"cells"`
1244 // conditions describe additional status of a row that are relevant for a human user. These conditions
1245 // apply to the row, not to the object, and will be specific to table output. The only defined
1246 // condition type is 'Completed', for a row that indicates a resource that has run to completion and
1247 // can be given less visual priority.
1248 // +optional
1249 Conditions []TableRowCondition `json:"conditions,omitempty"`
1250 // This field contains the requested additional information about each object based on the includeObject
1251 // policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
1252 // default serialization of the object for the current API version, and if "Metadata" (the default) will
1253 // contain the object metadata. Check the returned kind and apiVersion of the object before parsing.
1254 // The media type of the object will always match the enclosing list - if this as a JSON table, these
1255 // will be JSON encoded objects.
1256 // +optional
1257 Object runtime.RawExtension `json:"object,omitempty"`
1258}
1259
1260// TableRowCondition allows a row to be marked with additional information.
1261// +protobuf=false
1262type TableRowCondition struct {
1263 // Type of row condition. The only defined value is 'Completed' indicating that the
1264 // object this row represents has reached a completed state and may be given less visual
1265 // priority than other rows. Clients are not required to honor any conditions but should
1266 // be consistent where possible about handling the conditions.
1267 Type RowConditionType `json:"type"`
1268 // Status of the condition, one of True, False, Unknown.
1269 Status ConditionStatus `json:"status"`
1270 // (brief) machine readable reason for the condition's last transition.
1271 // +optional
1272 Reason string `json:"reason,omitempty"`
1273 // Human readable message indicating details about last transition.
1274 // +optional
1275 Message string `json:"message,omitempty"`
1276}
1277
1278type RowConditionType string
1279
1280// These are valid conditions of a row. This list is not exhaustive and new conditions may be
1281// included by other resources.
1282const (
1283 // RowCompleted means the underlying resource has reached completion and may be given less
1284 // visual priority than other resources.
1285 RowCompleted RowConditionType = "Completed"
1286)
1287
1288type ConditionStatus string
1289
1290// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
1291// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
1292// can't decide if a resource is in the condition or not. In the future, we could add other
1293// intermediate conditions, e.g. ConditionDegraded.
1294const (
1295 ConditionTrue ConditionStatus = "True"
1296 ConditionFalse ConditionStatus = "False"
1297 ConditionUnknown ConditionStatus = "Unknown"
1298)
1299
1300// IncludeObjectPolicy controls which portion of the object is returned with a Table.
1301type IncludeObjectPolicy string
1302
1303const (
1304 // IncludeNone returns no object.
1305 IncludeNone IncludeObjectPolicy = "None"
1306 // IncludeMetadata serializes the object containing only its metadata field.
1307 IncludeMetadata IncludeObjectPolicy = "Metadata"
1308 // IncludeObject contains the full object.
1309 IncludeObject IncludeObjectPolicy = "Object"
1310)
1311
1312// TableOptions are used when a Table is requested by the caller.
1313// +k8s:conversion-gen:explicit-from=net/url.Values
1314// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1315type TableOptions struct {
1316 TypeMeta `json:",inline"`
1317
1318 // NoHeaders is only exposed for internal callers. It is not included in our OpenAPI definitions
1319 // and may be removed as a field in a future release.
1320 NoHeaders bool `json:"-"`
1321
1322 // includeObject decides whether to include each object along with its columnar information.
1323 // Specifying "None" will return no object, specifying "Object" will return the full object contents, and
1324 // specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
1325 // in version v1beta1 of the meta.k8s.io API group.
1326 IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
1327}
1328
1329// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
1330// to get access to a particular ObjectMeta schema without knowing the details of the version.
1331// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1332type PartialObjectMetadata struct {
1333 TypeMeta `json:",inline"`
1334 // Standard object's metadata.
1335 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
1336 // +optional
1337 ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
1338}
1339
1340// PartialObjectMetadataList contains a list of objects containing only their metadata
1341// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1342type PartialObjectMetadataList struct {
1343 TypeMeta `json:",inline"`
1344 // Standard list metadata.
1345 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1346 // +optional
1347 ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
1348
1349 // items contains each of the included items.
1350 Items []PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"`
1351}
1352
1353// Condition contains details for one aspect of the current state of this API Resource.
1354// ---
1355// This struct is intended for direct use as an array at the field path .status.conditions. For example,
1356// type FooStatus struct{
1357// // Represents the observations of a foo's current state.
1358// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
1359// // +patchMergeKey=type
1360// // +patchStrategy=merge
1361// // +listType=map
1362// // +listMapKey=type
1363// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
1364//
1365// // other fields
1366// }
1367type Condition struct {
1368 // type of condition in CamelCase or in foo.example.com/CamelCase.
1369 // ---
1370 // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
1371 // useful (see .node.status.conditions), the ability to deconflict is important.
1372 // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
1373 // +required
1374 // +kubebuilder:validation:Required
1375 // +kubebuilder:validation: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])$`
1376 // +kubebuilder:validation:MaxLength=316
1377 Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
1378 // status of the condition, one of True, False, Unknown.
1379 // +required
1380 // +kubebuilder:validation:Required
1381 // +kubebuilder:validation:Enum=True;False;Unknown
1382 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
1383 // observedGeneration represents the .metadata.generation that the condition was set based upon.
1384 // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
1385 // with respect to the current state of the instance.
1386 // +optional
1387 // +kubebuilder:validation:Minimum=0
1388 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
1389 // lastTransitionTime is the last time the condition transitioned from one status to another.
1390 // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
1391 // +required
1392 // +kubebuilder:validation:Required
1393 // +kubebuilder:validation:Type=string
1394 // +kubebuilder:validation:Format=date-time
1395 LastTransitionTime Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
1396 // reason contains a programmatic identifier indicating the reason for the condition's last transition.
1397 // Producers of specific condition types may define expected values and meanings for this field,
1398 // and whether the values are considered a guaranteed API.
1399 // The value should be a CamelCase string.
1400 // This field may not be empty.
1401 // +required
1402 // +kubebuilder:validation:Required
1403 // +kubebuilder:validation:MaxLength=1024
1404 // +kubebuilder:validation:MinLength=1
1405 // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
1406 Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"`
1407 // message is a human readable message indicating details about the transition.
1408 // This may be an empty string.
1409 // +required
1410 // +kubebuilder:validation:Required
1411 // +kubebuilder:validation:MaxLength=32768
1412 Message string `json:"message" protobuf:"bytes,6,opt,name=message"`
1413}