blob: e957849ba515e7b467fe7c38126846d7c31e6b8b [file] [log] [blame]
sslobodrd046be82019-01-16 10:02:22 -05001/*
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/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/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 // +optional
65 SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
66
67 // String that identifies the server's internal version of this object that
68 // can be used by clients to determine when objects have changed.
69 // Value must be treated as opaque by clients and passed unmodified back to the server.
70 // Populated by the system.
71 // Read-only.
72 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
73 // +optional
74 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
75
76 // continue may be set if the user set a limit on the number of items returned, and indicates that
77 // the server has more data available. The value is opaque and may be used to issue another request
78 // to the endpoint that served this list to retrieve the next set of available objects. Continuing a
79 // consistent list may not be possible if the server configuration has changed or more than a few
80 // minutes have passed. The resourceVersion field returned when using this continue value will be
81 // identical to the value in the first response, unless you have received this token from an error
82 // message.
83 Continue string `json:"continue,omitempty" protobuf:"bytes,3,opt,name=continue"`
84}
85
86// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here
87const (
88 FinalizerOrphanDependents string = "orphan"
89 FinalizerDeleteDependents string = "foregroundDeletion"
90)
91
92// ObjectMeta is metadata that all persisted resources must have, which includes all objects
93// users must create.
94type ObjectMeta struct {
95 // Name must be unique within a namespace. Is required when creating resources, although
96 // some resources may allow a client to request the generation of an appropriate name
97 // automatically. Name is primarily intended for creation idempotence and configuration
98 // definition.
99 // Cannot be updated.
100 // More info: http://kubernetes.io/docs/user-guide/identifiers#names
101 // +optional
102 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
103
104 // GenerateName is an optional prefix, used by the server, to generate a unique
105 // name ONLY IF the Name field has not been provided.
106 // If this field is used, the name returned to the client will be different
107 // than the name passed. This value will also be combined with a unique suffix.
108 // The provided value has the same validation rules as the Name field,
109 // and may be truncated by the length of the suffix required to make the value
110 // unique on the server.
111 //
112 // If this field is specified and the generated name exists, the server will
113 // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason
114 // ServerTimeout indicating a unique name could not be found in the time allotted, and the client
115 // should retry (optionally after the time indicated in the Retry-After header).
116 //
117 // Applied only if Name is not specified.
118 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency
119 // +optional
120 GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"`
121
122 // Namespace defines the space within each name must be unique. An empty namespace is
123 // equivalent to the "default" namespace, but "default" is the canonical representation.
124 // Not all objects are required to be scoped to a namespace - the value of this field for
125 // those objects will be empty.
126 //
127 // Must be a DNS_LABEL.
128 // Cannot be updated.
129 // More info: http://kubernetes.io/docs/user-guide/namespaces
130 // +optional
131 Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
132
133 // SelfLink is a URL representing this object.
134 // Populated by the system.
135 // Read-only.
136 // +optional
137 SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
138
139 // UID is the unique in time and space value for this object. It is typically generated by
140 // the server on successful creation of a resource and is not allowed to change on PUT
141 // operations.
142 //
143 // Populated by the system.
144 // Read-only.
145 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
146 // +optional
147 UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"`
148
149 // An opaque value that represents the internal version of this object that can
150 // be used by clients to determine when objects have changed. May be used for optimistic
151 // concurrency, change detection, and the watch operation on a resource or set of resources.
152 // Clients must treat these values as opaque and passed unmodified back to the server.
153 // They may only be valid for a particular resource or set of resources.
154 //
155 // Populated by the system.
156 // Read-only.
157 // Value must be treated as opaque by clients and .
158 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency
159 // +optional
160 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"`
161
162 // A sequence number representing a specific generation of the desired state.
163 // Populated by the system. Read-only.
164 // +optional
165 Generation int64 `json:"generation,omitempty" protobuf:"varint,7,opt,name=generation"`
166
167 // CreationTimestamp is a timestamp representing the server time when this object was
168 // created. It is not guaranteed to be set in happens-before order across separate operations.
169 // Clients may not set this value. It is represented in RFC3339 form and is in UTC.
170 //
171 // Populated by the system.
172 // Read-only.
173 // Null for lists.
174 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
175 // +optional
176 CreationTimestamp Time `json:"creationTimestamp,omitempty" protobuf:"bytes,8,opt,name=creationTimestamp"`
177
178 // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
179 // field is set by the server when a graceful deletion is requested by the user, and is not
180 // directly settable by a client. The resource is expected to be deleted (no longer visible
181 // from resource lists, and not reachable by name) after the time in this field, once the
182 // finalizers list is empty. As long as the finalizers list contains items, deletion is blocked.
183 // Once the deletionTimestamp is set, this value may not be unset or be set further into the
184 // future, although it may be shortened or the resource may be deleted prior to this time.
185 // For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react
186 // by sending a graceful termination signal to the containers in the pod. After that 30 seconds,
187 // the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup,
188 // remove the pod from the API. In the presence of network partitions, this object may still
189 // exist after this timestamp, until an administrator or automated process can determine the
190 // resource is fully terminated.
191 // If not set, graceful deletion of the object has not been requested.
192 //
193 // Populated by the system when a graceful deletion is requested.
194 // Read-only.
195 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
196 // +optional
197 DeletionTimestamp *Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"`
198
199 // Number of seconds allowed for this object to gracefully terminate before
200 // it will be removed from the system. Only set when deletionTimestamp is also set.
201 // May only be shortened.
202 // Read-only.
203 // +optional
204 DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty" protobuf:"varint,10,opt,name=deletionGracePeriodSeconds"`
205
206 // Map of string keys and values that can be used to organize and categorize
207 // (scope and select) objects. May match selectors of replication controllers
208 // and services.
209 // More info: http://kubernetes.io/docs/user-guide/labels
210 // +optional
211 Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`
212
213 // Annotations is an unstructured key value map stored with a resource that may be
214 // set by external tools to store and retrieve arbitrary metadata. They are not
215 // queryable and should be preserved when modifying objects.
216 // More info: http://kubernetes.io/docs/user-guide/annotations
217 // +optional
218 Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`
219
220 // List of objects depended by this object. If ALL objects in the list have
221 // been deleted, this object will be garbage collected. If this object is managed by a controller,
222 // then an entry in this list will point to this controller, with the controller field set to true.
223 // There cannot be more than one managing controller.
224 // +optional
225 // +patchMergeKey=uid
226 // +patchStrategy=merge
227 OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
228
229 // An initializer is a controller which enforces some system invariant at object creation time.
230 // This field is a list of initializers that have not yet acted on this object. If nil or empty,
231 // this object has been completely initialized. Otherwise, the object is considered uninitialized
232 // and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
233 // observe uninitialized objects.
234 //
235 // When an object is created, the system will populate this list with the current set of initializers.
236 // Only privileged users may set or modify this list. Once it is empty, it may not be modified further
237 // by any user.
Stephane Barbarie260a5632019-02-26 16:12:49 -0500238 //
239 // DEPRECATED - initializers are an alpha field and will be removed in v1.15.
sslobodrd046be82019-01-16 10:02:22 -0500240 Initializers *Initializers `json:"initializers,omitempty" protobuf:"bytes,16,opt,name=initializers"`
241
242 // Must be empty before the object is deleted from the registry. Each entry
243 // is an identifier for the responsible component that will remove the entry
244 // from the list. If the deletionTimestamp of the object is non-nil, entries
245 // in this list can only be removed.
246 // +optional
247 // +patchStrategy=merge
248 Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
249
250 // The name of the cluster which the object belongs to.
251 // This is used to distinguish resources with same name and namespace in different clusters.
252 // This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
253 // +optional
254 ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
Stephane Barbarie260a5632019-02-26 16:12:49 -0500255
256 // ManagedFields maps workflow-id and version to the set of fields
257 // that are managed by that workflow. This is mostly for internal
258 // housekeeping, and users typically shouldn't need to set or
259 // understand this field. A workflow can be the user's name, a
260 // controller's name, or the name of a specific apply path like
261 // "ci-cd". The set of fields is always in the version that the
262 // workflow used when modifying the object.
263 //
264 // This field is alpha and can be changed or removed without notice.
265 //
266 // +optional
267 ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
sslobodrd046be82019-01-16 10:02:22 -0500268}
269
270// Initializers tracks the progress of initialization.
271type Initializers struct {
272 // Pending is a list of initializers that must execute in order before this object is visible.
273 // When the last pending initializer is removed, and no failing result is set, the initializers
274 // struct will be set to nil and the object is considered as initialized and visible to all
275 // clients.
276 // +patchMergeKey=name
277 // +patchStrategy=merge
278 Pending []Initializer `json:"pending" protobuf:"bytes,1,rep,name=pending" patchStrategy:"merge" patchMergeKey:"name"`
279 // If result is set with the Failure field, the object will be persisted to storage and then deleted,
280 // ensuring that other clients can observe the deletion.
281 Result *Status `json:"result,omitempty" protobuf:"bytes,2,opt,name=result"`
282}
283
284// Initializer is information about an initializer that has not yet completed.
285type Initializer struct {
286 // name of the process that is responsible for initializing this object.
287 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
288}
289
290const (
291 // NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
292 NamespaceDefault string = "default"
293 // NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
294 NamespaceAll string = ""
295 // NamespaceNone is the argument for a context when there is no namespace.
296 NamespaceNone string = ""
297 // NamespaceSystem is the system namespace where we place system components.
298 NamespaceSystem string = "kube-system"
299 // NamespacePublic is the namespace where we place public info (ConfigMaps)
300 NamespacePublic string = "kube-public"
301)
302
303// OwnerReference contains enough information to let you identify an owning
304// object. An owning object must be in the same namespace as the dependent, or
305// be cluster-scoped, so there is no namespace field.
306type OwnerReference struct {
307 // API version of the referent.
308 APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`
309 // Kind of the referent.
310 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
311 Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
312 // Name of the referent.
313 // More info: http://kubernetes.io/docs/user-guide/identifiers#names
314 Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
315 // UID of the referent.
316 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
317 UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
318 // If true, this reference points to the managing controller.
319 // +optional
320 Controller *bool `json:"controller,omitempty" protobuf:"varint,6,opt,name=controller"`
321 // If true, AND if the owner has the "foregroundDeletion" finalizer, then
322 // the owner cannot be deleted from the key-value store until this
323 // reference is removed.
324 // Defaults to false.
325 // To set this field, a user needs "delete" permission of the owner,
326 // otherwise 422 (Unprocessable Entity) will be returned.
327 // +optional
328 BlockOwnerDeletion *bool `json:"blockOwnerDeletion,omitempty" protobuf:"varint,7,opt,name=blockOwnerDeletion"`
329}
330
331// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
332
333// ListOptions is the query options to a standard REST list call.
334type ListOptions struct {
335 TypeMeta `json:",inline"`
336
337 // A selector to restrict the list of returned objects by their labels.
338 // Defaults to everything.
339 // +optional
340 LabelSelector string `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
341 // A selector to restrict the list of returned objects by their fields.
342 // Defaults to everything.
343 // +optional
344 FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
Stephane Barbarie260a5632019-02-26 16:12:49 -0500345
346 // +k8s:deprecated=includeUninitialized,protobuf=6
347
sslobodrd046be82019-01-16 10:02:22 -0500348 // Watch for changes to the described resources and return them as a stream of
349 // add, update, and remove notifications. Specify resourceVersion.
350 // +optional
351 Watch bool `json:"watch,omitempty" protobuf:"varint,3,opt,name=watch"`
352 // When specified with a watch call, shows changes that occur after that particular version of a resource.
353 // Defaults to changes from the beginning of history.
354 // When specified for list:
355 // - if unset, then the result is returned from remote storage based on quorum-read flag;
356 // - if it's 0, then we simply return what we currently have in cache, no guarantee;
357 // - if set to non zero, then the result is at least as fresh as given rv.
358 // +optional
359 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"`
360 // Timeout for the list/watch call.
361 // This limits the duration of the call, regardless of any activity or inactivity.
362 // +optional
363 TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,5,opt,name=timeoutSeconds"`
364
365 // limit is a maximum number of responses to return for a list call. If more items exist, the
366 // server will set the `continue` field on the list metadata to a value that can be used with the
367 // same initial query to retrieve the next set of results. Setting a limit may return fewer than
368 // the requested amount of items (up to zero items) in the event all requested objects are
369 // filtered out and clients should only use the presence of the continue field to determine whether
370 // more results are available. Servers may choose not to support the limit argument and will return
371 // all of the available results. If limit is specified and the continue field is empty, clients may
372 // assume that no more results are available. This field is not supported if watch is true.
373 //
374 // The server guarantees that the objects returned when using continue will be identical to issuing
375 // a single list call without a limit - that is, no objects created, modified, or deleted after the
376 // first request is issued will be included in any subsequent continued requests. This is sometimes
377 // referred to as a consistent snapshot, and ensures that a client that is using limit to receive
378 // smaller chunks of a very large result can ensure they see all possible objects. If objects are
379 // updated during a chunked list the version of the object that was present at the time the first list
380 // result was calculated is returned.
381 Limit int64 `json:"limit,omitempty" protobuf:"varint,7,opt,name=limit"`
382 // The continue option should be set when retrieving more results from the server. Since this value is
383 // server defined, clients may only use the continue value from a previous query result with identical
384 // query parameters (except for the value of continue) and the server may reject a continue value it
385 // does not recognize. If the specified continue value is no longer valid whether due to expiration
386 // (generally five to fifteen minutes) or a configuration change on the server, the server will
387 // respond with a 410 ResourceExpired error together with a continue token. If the client needs a
388 // consistent list, it must restart their list without the continue field. Otherwise, the client may
389 // send another list request with the token received with the 410 error, the server will respond with
390 // a list starting from the next key, but from the latest snapshot, which is inconsistent from the
391 // previous list results - objects that are created, modified, or deleted after the first list request
392 // will be included in the response, as long as their keys are after the "next key".
393 //
394 // This field is not supported when watch is true. Clients may start a watch from the last
395 // resourceVersion value returned by the server and not miss any modifications.
396 Continue string `json:"continue,omitempty" protobuf:"bytes,8,opt,name=continue"`
397}
398
399// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
400
401// ExportOptions is the query options to the standard REST get call.
Stephane Barbarie260a5632019-02-26 16:12:49 -0500402// Deprecated. Planned for removal in 1.18.
sslobodrd046be82019-01-16 10:02:22 -0500403type ExportOptions struct {
404 TypeMeta `json:",inline"`
405 // Should this value be exported. Export strips fields that a user can not specify.
Stephane Barbarie260a5632019-02-26 16:12:49 -0500406 // Deprecated. Planned for removal in 1.18.
sslobodrd046be82019-01-16 10:02:22 -0500407 Export bool `json:"export" protobuf:"varint,1,opt,name=export"`
408 // Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.
Stephane Barbarie260a5632019-02-26 16:12:49 -0500409 // Deprecated. Planned for removal in 1.18.
sslobodrd046be82019-01-16 10:02:22 -0500410 Exact bool `json:"exact" protobuf:"varint,2,opt,name=exact"`
411}
412
413// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
414
415// GetOptions is the standard query options to the standard REST get call.
416type GetOptions struct {
417 TypeMeta `json:",inline"`
418 // When specified:
419 // - if unset, then the result is returned from remote storage based on quorum-read flag;
420 // - if it's 0, then we simply return what we currently have in cache, no guarantee;
421 // - if set to non zero, then the result is at least as fresh as given rv.
422 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,1,opt,name=resourceVersion"`
Stephane Barbarie260a5632019-02-26 16:12:49 -0500423 // +k8s:deprecated=includeUninitialized,protobuf=2
sslobodrd046be82019-01-16 10:02:22 -0500424}
425
426// DeletionPropagation decides if a deletion will propagate to the dependents of
427// the object, and how the garbage collector will handle the propagation.
428type DeletionPropagation string
429
430const (
431 // Orphans the dependents.
432 DeletePropagationOrphan DeletionPropagation = "Orphan"
433 // Deletes the object from the key-value store, the garbage collector will
434 // delete the dependents in the background.
435 DeletePropagationBackground DeletionPropagation = "Background"
436 // The object exists in the key-value store until the garbage collector
437 // deletes all the dependents whose ownerReference.blockOwnerDeletion=true
438 // from the key-value store. API sever will put the "foregroundDeletion"
439 // finalizer on the object, and sets its deletionTimestamp. This policy is
440 // cascading, i.e., the dependents will be deleted with Foreground.
441 DeletePropagationForeground DeletionPropagation = "Foreground"
442)
443
444const (
445 // DryRunAll means to complete all processing stages, but don't
446 // persist changes to storage.
447 DryRunAll = "All"
448)
449
450// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
451
452// DeleteOptions may be provided when deleting an API object.
453type DeleteOptions struct {
454 TypeMeta `json:",inline"`
455
456 // The duration in seconds before the object should be deleted. Value must be non-negative integer.
457 // The value zero indicates delete immediately. If this value is nil, the default grace period for the
458 // specified type will be used.
459 // Defaults to a per object value if not specified. zero means delete immediately.
460 // +optional
461 GracePeriodSeconds *int64 `json:"gracePeriodSeconds,omitempty" protobuf:"varint,1,opt,name=gracePeriodSeconds"`
462
463 // Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be
464 // returned.
465 // +optional
466 Preconditions *Preconditions `json:"preconditions,omitempty" protobuf:"bytes,2,opt,name=preconditions"`
467
468 // Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7.
469 // Should the dependent objects be orphaned. If true/false, the "orphan"
470 // finalizer will be added to/removed from the object's finalizers list.
471 // Either this field or PropagationPolicy may be set, but not both.
472 // +optional
473 OrphanDependents *bool `json:"orphanDependents,omitempty" protobuf:"varint,3,opt,name=orphanDependents"`
474
475 // Whether and how garbage collection will be performed.
476 // Either this field or OrphanDependents may be set, but not both.
477 // The default policy is decided by the existing finalizer set in the
478 // metadata.finalizers and the resource-specific default policy.
479 // Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
480 // allow the garbage collector to delete the dependents in the background;
481 // 'Foreground' - a cascading policy that deletes all dependents in the
482 // foreground.
483 // +optional
484 PropagationPolicy *DeletionPropagation `json:"propagationPolicy,omitempty" protobuf:"varint,4,opt,name=propagationPolicy"`
485
486 // When present, indicates that modifications should not be
487 // persisted. An invalid or unrecognized dryRun directive will
488 // result in an error response and no further processing of the
489 // request. Valid values are:
490 // - All: all dry run stages will be processed
491 // +optional
492 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
493}
494
495// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
496
497// CreateOptions may be provided when creating an API object.
498type CreateOptions struct {
499 TypeMeta `json:",inline"`
500
501 // When present, indicates that modifications should not be
502 // persisted. An invalid or unrecognized dryRun directive will
503 // result in an error response and no further processing of the
504 // request. Valid values are:
505 // - All: all dry run stages will be processed
506 // +optional
507 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
Stephane Barbarie260a5632019-02-26 16:12:49 -0500508 // +k8s:deprecated=includeUninitialized,protobuf=2
509}
sslobodrd046be82019-01-16 10:02:22 -0500510
Stephane Barbarie260a5632019-02-26 16:12:49 -0500511// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
512
513// PatchOptions may be provided when patching an API object.
514// PatchOptions is meant to be a superset of UpdateOptions.
515type PatchOptions struct {
516 TypeMeta `json:",inline"`
517
518 // When present, indicates that modifications should not be
519 // persisted. An invalid or unrecognized dryRun directive will
520 // result in an error response and no further processing of the
521 // request. Valid values are:
522 // - All: all dry run stages will be processed
523 // +optional
524 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
525
526 // Force is going to "force" Apply requests. It means user will
527 // re-acquire conflicting fields owned by other people. Force
528 // flag must be unset for non-apply patch requests.
529 // +optional
530 Force *bool `json:"force,omitempty" protobuf:"varint,2,opt,name=force"`
sslobodrd046be82019-01-16 10:02:22 -0500531}
532
533// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
534
535// UpdateOptions may be provided when updating an API object.
Stephane Barbarie260a5632019-02-26 16:12:49 -0500536// All fields in UpdateOptions should also be present in PatchOptions.
sslobodrd046be82019-01-16 10:02:22 -0500537type UpdateOptions struct {
538 TypeMeta `json:",inline"`
539
540 // When present, indicates that modifications should not be
541 // persisted. An invalid or unrecognized dryRun directive will
542 // result in an error response and no further processing of the
543 // request. Valid values are:
544 // - All: all dry run stages will be processed
545 // +optional
546 DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
547}
548
549// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
550type Preconditions struct {
551 // Specifies the target UID.
552 // +optional
553 UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
554}
555
556// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
557
558// Status is a return value for calls that don't return other objects.
559type Status struct {
560 TypeMeta `json:",inline"`
561 // Standard list metadata.
562 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
563 // +optional
564 ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
565
566 // Status of the operation.
567 // One of: "Success" or "Failure".
568 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
569 // +optional
570 Status string `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
571 // A human-readable description of the status of this operation.
572 // +optional
573 Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
574 // A machine-readable description of why this operation is in the
575 // "Failure" status. If this value is empty there
576 // is no information available. A Reason clarifies an HTTP status
577 // code but does not override it.
578 // +optional
579 Reason StatusReason `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason,casttype=StatusReason"`
580 // Extended data associated with the reason. Each reason may define its
581 // own extended details. This field is optional and the data returned
582 // is not guaranteed to conform to any schema except that defined by
583 // the reason type.
584 // +optional
585 Details *StatusDetails `json:"details,omitempty" protobuf:"bytes,5,opt,name=details"`
586 // Suggested HTTP return code for this status, 0 if not set.
587 // +optional
588 Code int32 `json:"code,omitempty" protobuf:"varint,6,opt,name=code"`
589}
590
591// StatusDetails is a set of additional properties that MAY be set by the
592// server to provide additional information about a response. The Reason
593// field of a Status object defines what attributes will be set. Clients
594// must ignore fields that do not match the defined type of each attribute,
595// and should assume that any attribute may be empty, invalid, or under
596// defined.
597type StatusDetails struct {
598 // The name attribute of the resource associated with the status StatusReason
599 // (when there is a single name which can be described).
600 // +optional
601 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
602 // The group attribute of the resource associated with the status StatusReason.
603 // +optional
604 Group string `json:"group,omitempty" protobuf:"bytes,2,opt,name=group"`
605 // The kind attribute of the resource associated with the status StatusReason.
606 // On some operations may differ from the requested resource Kind.
607 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
608 // +optional
609 Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
610 // UID of the resource.
611 // (when there is a single resource which can be described).
612 // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
613 // +optional
614 UID types.UID `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
615 // The Causes array includes more details associated with the StatusReason
616 // failure. Not all StatusReasons may provide detailed causes.
617 // +optional
618 Causes []StatusCause `json:"causes,omitempty" protobuf:"bytes,4,rep,name=causes"`
619 // If specified, the time in seconds before the operation should be retried. Some errors may indicate
620 // the client must take an alternate action - for those errors this field may indicate how long to wait
621 // before taking the alternate action.
622 // +optional
623 RetryAfterSeconds int32 `json:"retryAfterSeconds,omitempty" protobuf:"varint,5,opt,name=retryAfterSeconds"`
624}
625
626// Values of Status.Status
627const (
628 StatusSuccess = "Success"
629 StatusFailure = "Failure"
630)
631
632// StatusReason is an enumeration of possible failure causes. Each StatusReason
633// must map to a single HTTP status code, but multiple reasons may map
634// to the same HTTP status code.
635// TODO: move to apiserver
636type StatusReason string
637
638const (
639 // StatusReasonUnknown means the server has declined to indicate a specific reason.
640 // The details field may contain other information about this error.
641 // Status code 500.
642 StatusReasonUnknown StatusReason = ""
643
644 // StatusReasonUnauthorized means the server can be reached and understood the request, but requires
645 // the user to present appropriate authorization credentials (identified by the WWW-Authenticate header)
646 // in order for the action to be completed. If the user has specified credentials on the request, the
647 // server considers them insufficient.
648 // Status code 401
649 StatusReasonUnauthorized StatusReason = "Unauthorized"
650
651 // StatusReasonForbidden means the server can be reached and understood the request, but refuses
652 // to take any further action. It is the result of the server being configured to deny access for some reason
653 // to the requested resource by the client.
654 // Details (optional):
655 // "kind" string - the kind attribute of the forbidden resource
656 // on some operations may differ from the requested
657 // resource.
658 // "id" string - the identifier of the forbidden resource
659 // Status code 403
660 StatusReasonForbidden StatusReason = "Forbidden"
661
662 // StatusReasonNotFound means one or more resources required for this operation
663 // could not be found.
664 // Details (optional):
665 // "kind" string - the kind attribute of the missing resource
666 // on some operations may differ from the requested
667 // resource.
668 // "id" string - the identifier of the missing resource
669 // Status code 404
670 StatusReasonNotFound StatusReason = "NotFound"
671
672 // StatusReasonAlreadyExists means the resource you are creating already exists.
673 // Details (optional):
674 // "kind" string - the kind attribute of the conflicting resource
675 // "id" string - the identifier of the conflicting resource
676 // Status code 409
677 StatusReasonAlreadyExists StatusReason = "AlreadyExists"
678
679 // StatusReasonConflict means the requested operation cannot be completed
680 // due to a conflict in the operation. The client may need to alter the
681 // request. Each resource may define custom details that indicate the
682 // nature of the conflict.
683 // Status code 409
684 StatusReasonConflict StatusReason = "Conflict"
685
686 // StatusReasonGone means the item is no longer available at the server and no
687 // forwarding address is known.
688 // Status code 410
689 StatusReasonGone StatusReason = "Gone"
690
691 // StatusReasonInvalid means the requested create or update operation cannot be
692 // completed due to invalid data provided as part of the request. The client may
693 // need to alter the request. When set, the client may use the StatusDetails
694 // message field as a summary of the issues encountered.
695 // Details (optional):
696 // "kind" string - the kind attribute of the invalid resource
697 // "id" string - the identifier of the invalid resource
698 // "causes" - one or more StatusCause entries indicating the data in the
699 // provided resource that was invalid. The code, message, and
700 // field attributes will be set.
701 // Status code 422
702 StatusReasonInvalid StatusReason = "Invalid"
703
704 // StatusReasonServerTimeout means the server can be reached and understood the request,
705 // but cannot complete the action in a reasonable time. The client should retry the request.
706 // This is may be due to temporary server load or a transient communication issue with
707 // another server. Status code 500 is used because the HTTP spec provides no suitable
708 // server-requested client retry and the 5xx class represents actionable errors.
709 // Details (optional):
710 // "kind" string - the kind attribute of the resource being acted on.
711 // "id" string - the operation that is being attempted.
712 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
713 // Status code 500
714 StatusReasonServerTimeout StatusReason = "ServerTimeout"
715
716 // StatusReasonTimeout means that the request could not be completed within the given time.
717 // Clients can get this response only when they specified a timeout param in the request,
718 // or if the server cannot complete the operation within a reasonable amount of time.
719 // The request might succeed with an increased value of timeout param. The client *should*
720 // wait at least the number of seconds specified by the retryAfterSeconds field.
721 // Details (optional):
722 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
723 // Status code 504
724 StatusReasonTimeout StatusReason = "Timeout"
725
726 // StatusReasonTooManyRequests means the server experienced too many requests within a
727 // given window and that the client must wait to perform the action again. A client may
728 // always retry the request that led to this error, although the client should wait at least
729 // the number of seconds specified by the retryAfterSeconds field.
730 // Details (optional):
731 // "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
732 // Status code 429
733 StatusReasonTooManyRequests StatusReason = "TooManyRequests"
734
735 // StatusReasonBadRequest means that the request itself was invalid, because the request
736 // doesn't make any sense, for example deleting a read-only object. This is different than
737 // StatusReasonInvalid above which indicates that the API call could possibly succeed, but the
738 // data was invalid. API calls that return BadRequest can never succeed.
739 StatusReasonBadRequest StatusReason = "BadRequest"
740
741 // StatusReasonMethodNotAllowed means that the action the client attempted to perform on the
742 // resource was not supported by the code - for instance, attempting to delete a resource that
743 // can only be created. API calls that return MethodNotAllowed can never succeed.
744 StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
745
746 // StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable
747 // to the server - for instance, attempting to receive protobuf for a resource that supports only json and yaml.
748 // API calls that return NotAcceptable can never succeed.
749 // Status code 406
750 StatusReasonNotAcceptable StatusReason = "NotAcceptable"
751
Stephane Barbarie260a5632019-02-26 16:12:49 -0500752 // StatusReasonRequestEntityTooLarge means that the request entity is too large.
753 // Status code 413
754 StatusReasonRequestEntityTooLarge StatusReason = "RequestEntityTooLarge"
755
sslobodrd046be82019-01-16 10:02:22 -0500756 // StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
757 // to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
758 // API calls that return UnsupportedMediaType can never succeed.
759 // Status code 415
760 StatusReasonUnsupportedMediaType StatusReason = "UnsupportedMediaType"
761
762 // StatusReasonInternalError indicates that an internal error occurred, it is unexpected
763 // and the outcome of the call is unknown.
764 // Details (optional):
765 // "causes" - The original error
766 // Status code 500
767 StatusReasonInternalError StatusReason = "InternalError"
768
769 // StatusReasonExpired indicates that the request is invalid because the content you are requesting
770 // has expired and is no longer available. It is typically associated with watches that can't be
771 // serviced.
772 // Status code 410 (gone)
773 StatusReasonExpired StatusReason = "Expired"
774
775 // StatusReasonServiceUnavailable means that the request itself was valid,
776 // but the requested service is unavailable at this time.
777 // Retrying the request after some time might succeed.
778 // Status code 503
779 StatusReasonServiceUnavailable StatusReason = "ServiceUnavailable"
780)
781
782// StatusCause provides more information about an api.Status failure, including
783// cases when multiple errors are encountered.
784type StatusCause struct {
785 // A machine-readable description of the cause of the error. If this value is
786 // empty there is no information available.
787 // +optional
788 Type CauseType `json:"reason,omitempty" protobuf:"bytes,1,opt,name=reason,casttype=CauseType"`
789 // A human-readable description of the cause of the error. This field may be
790 // presented as-is to a reader.
791 // +optional
792 Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
793 // The field of the resource that has caused this error, as named by its JSON
794 // serialization. May include dot and postfix notation for nested attributes.
795 // Arrays are zero-indexed. Fields may appear more than once in an array of
796 // causes due to fields having multiple errors.
797 // Optional.
798 //
799 // Examples:
800 // "name" - the field "name" on the current resource
801 // "items[0].name" - the field "name" on the first array entry in "items"
802 // +optional
803 Field string `json:"field,omitempty" protobuf:"bytes,3,opt,name=field"`
804}
805
806// CauseType is a machine readable value providing more detail about what
807// occurred in a status response. An operation may have multiple causes for a
808// status (whether Failure or Success).
809type CauseType string
810
811const (
812 // CauseTypeFieldValueNotFound is used to report failure to find a requested value
813 // (e.g. looking up an ID).
814 CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound"
815 // CauseTypeFieldValueRequired is used to report required values that are not
816 // provided (e.g. empty strings, null values, or empty arrays).
817 CauseTypeFieldValueRequired CauseType = "FieldValueRequired"
818 // CauseTypeFieldValueDuplicate is used to report collisions of values that must be
819 // unique (e.g. unique IDs).
820 CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate"
821 // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex
822 // match).
823 CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid"
824 // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
825 // values that can not be handled (e.g. an enumerated string).
826 CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
827 // CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
828 // without the expected return type. The presence of this cause indicates the error may be
829 // due to an intervening proxy or the server software malfunctioning.
830 CauseTypeUnexpectedServerResponse CauseType = "UnexpectedServerResponse"
Stephane Barbarie260a5632019-02-26 16:12:49 -0500831 // FieldManagerConflict is used to report when another client claims to manage this field,
832 // It should only be returned for a request using server-side apply.
833 CauseTypeFieldManagerConflict CauseType = "FieldManagerConflict"
sslobodrd046be82019-01-16 10:02:22 -0500834)
835
836// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
837
838// List holds a list of objects, which may not be known by the server.
839type List struct {
840 TypeMeta `json:",inline"`
841 // Standard list metadata.
842 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
843 // +optional
844 ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
845
846 // List of objects
847 Items []runtime.RawExtension `json:"items" protobuf:"bytes,2,rep,name=items"`
848}
849
850// APIVersions lists the versions that are available, to allow clients to
851// discover the API at /api, which is the root path of the legacy v1 API.
852//
853// +protobuf.options.(gogoproto.goproto_stringer)=false
854// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
855type APIVersions struct {
856 TypeMeta `json:",inline"`
857 // versions are the api versions that are available.
858 Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"`
859 // a map of client CIDR to server address that is serving this group.
860 // This is to help clients reach servers in the most network-efficient way possible.
861 // Clients can use the appropriate server address as per the CIDR that they match.
862 // In case of multiple matches, clients should use the longest matching CIDR.
863 // The server returns only those CIDRs that it thinks that the client can match.
864 // For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
865 // Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
866 ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" protobuf:"bytes,2,rep,name=serverAddressByClientCIDRs"`
867}
868
869// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
870
871// APIGroupList is a list of APIGroup, to allow clients to discover the API at
872// /apis.
873type APIGroupList struct {
874 TypeMeta `json:",inline"`
875 // groups is a list of APIGroup.
876 Groups []APIGroup `json:"groups" protobuf:"bytes,1,rep,name=groups"`
877}
878
879// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
880
881// APIGroup contains the name, the supported versions, and the preferred version
882// of a group.
883type APIGroup struct {
884 TypeMeta `json:",inline"`
885 // name is the name of the group.
886 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
887 // versions are the versions supported in this group.
888 Versions []GroupVersionForDiscovery `json:"versions" protobuf:"bytes,2,rep,name=versions"`
889 // preferredVersion is the version preferred by the API server, which
890 // probably is the storage version.
891 // +optional
892 PreferredVersion GroupVersionForDiscovery `json:"preferredVersion,omitempty" protobuf:"bytes,3,opt,name=preferredVersion"`
893 // a map of client CIDR to server address that is serving this group.
894 // This is to help clients reach servers in the most network-efficient way possible.
895 // Clients can use the appropriate server address as per the CIDR that they match.
896 // In case of multiple matches, clients should use the longest matching CIDR.
897 // The server returns only those CIDRs that it thinks that the client can match.
898 // For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
899 // Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
900 // +optional
901 ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs,omitempty" protobuf:"bytes,4,rep,name=serverAddressByClientCIDRs"`
902}
903
904// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
905type ServerAddressByClientCIDR struct {
906 // The CIDR with which clients can match their IP to figure out the server address that they should use.
907 ClientCIDR string `json:"clientCIDR" protobuf:"bytes,1,opt,name=clientCIDR"`
908 // Address of this server, suitable for a client that matches the above CIDR.
909 // This can be a hostname, hostname:port, IP or IP:port.
910 ServerAddress string `json:"serverAddress" protobuf:"bytes,2,opt,name=serverAddress"`
911}
912
913// GroupVersion contains the "group/version" and "version" string of a version.
914// It is made a struct to keep extensibility.
915type GroupVersionForDiscovery struct {
916 // groupVersion specifies the API group and version in the form "group/version"
917 GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
918 // version specifies the version in the form of "version". This is to save
919 // the clients the trouble of splitting the GroupVersion.
920 Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
921}
922
923// APIResource specifies the name of a resource and whether it is namespaced.
924type APIResource struct {
925 // name is the plural name of the resource.
926 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
927 // singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely.
928 // The singularName is more correct for reporting status on a single item and both singular and plural are allowed
929 // from the kubectl CLI interface.
930 SingularName string `json:"singularName" protobuf:"bytes,6,opt,name=singularName"`
931 // namespaced indicates if a resource is namespaced or not.
932 Namespaced bool `json:"namespaced" protobuf:"varint,2,opt,name=namespaced"`
933 // group is the preferred group of the resource. Empty implies the group of the containing resource list.
934 // For subresources, this may have a different value, for example: Scale".
935 Group string `json:"group,omitempty" protobuf:"bytes,8,opt,name=group"`
936 // version is the preferred version of the resource. Empty implies the version of the containing resource list
937 // For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)".
938 Version string `json:"version,omitempty" protobuf:"bytes,9,opt,name=version"`
939 // kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')
940 Kind string `json:"kind" protobuf:"bytes,3,opt,name=kind"`
941 // verbs is a list of supported kube verbs (this includes get, list, watch, create,
942 // update, patch, delete, deletecollection, and proxy)
943 Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
944 // shortNames is a list of suggested short names of the resource.
945 ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"`
946 // categories is a list of the grouped resources this resource belongs to (e.g. 'all')
947 Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"`
Stephane Barbarie260a5632019-02-26 16:12:49 -0500948 // The hash value of the storage version, the version this resource is
949 // converted to when written to the data store. Value must be treated
950 // as opaque by clients. Only equality comparison on the value is valid.
951 // This is an alpha feature and may change or be removed in the future.
952 // The field is populated by the apiserver only if the
953 // StorageVersionHash feature gate is enabled.
954 // This field will remain optional even if it graduates.
955 // +optional
956 StorageVersionHash string `json:"storageVersionHash,omitempty" protobuf:"bytes,10,opt,name=storageVersionHash"`
sslobodrd046be82019-01-16 10:02:22 -0500957}
958
959// Verbs masks the value so protobuf can generate
960//
961// +protobuf.nullable=true
962// +protobuf.options.(gogoproto.goproto_stringer)=false
963type Verbs []string
964
965func (vs Verbs) String() string {
966 return fmt.Sprintf("%v", []string(vs))
967}
968
969// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
970
971// APIResourceList is a list of APIResource, it is used to expose the name of the
972// resources supported in a specific group and version, and if the resource
973// is namespaced.
974type APIResourceList struct {
975 TypeMeta `json:",inline"`
976 // groupVersion is the group and version this APIResourceList is for.
977 GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
978 // resources contains the name of the resources and if they are namespaced.
979 APIResources []APIResource `json:"resources" protobuf:"bytes,2,rep,name=resources"`
980}
981
982// RootPaths lists the paths available at root.
983// For example: "/healthz", "/apis".
984type RootPaths struct {
985 // paths are the paths available at root.
986 Paths []string `json:"paths" protobuf:"bytes,1,rep,name=paths"`
987}
988
989// TODO: remove me when watch is refactored
990func LabelSelectorQueryParam(version string) string {
991 return "labelSelector"
992}
993
994// TODO: remove me when watch is refactored
995func FieldSelectorQueryParam(version string) string {
996 return "fieldSelector"
997}
998
999// String returns available api versions as a human-friendly version string.
1000func (apiVersions APIVersions) String() string {
1001 return strings.Join(apiVersions.Versions, ",")
1002}
1003
1004func (apiVersions APIVersions) GoString() string {
1005 return apiVersions.String()
1006}
1007
1008// Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
1009type Patch struct{}
1010
1011// Note:
1012// There are two different styles of label selectors used in versioned types:
1013// an older style which is represented as just a string in versioned types, and a
1014// newer style that is structured. LabelSelector is an internal representation for the
1015// latter style.
1016
1017// A label selector is a label query over a set of resources. The result of matchLabels and
1018// matchExpressions are ANDed. An empty label selector matches all objects. A null
1019// label selector matches no objects.
1020type LabelSelector struct {
1021 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1022 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1023 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1024 // +optional
1025 MatchLabels map[string]string `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"`
1026 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1027 // +optional
1028 MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"`
1029}
1030
1031// A label selector requirement is a selector that contains values, a key, and an operator that
1032// relates the key and values.
1033type LabelSelectorRequirement struct {
1034 // key is the label key that the selector applies to.
1035 // +patchMergeKey=key
1036 // +patchStrategy=merge
1037 Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
1038 // operator represents a key's relationship to a set of values.
1039 // Valid operators are In, NotIn, Exists and DoesNotExist.
1040 Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"`
1041 // values is an array of string values. If the operator is In or NotIn,
1042 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1043 // the values array must be empty. This array is replaced during a strategic
1044 // merge patch.
1045 // +optional
1046 Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
1047}
1048
1049// A label selector operator is the set of operators that can be used in a selector requirement.
1050type LabelSelectorOperator string
1051
1052const (
1053 LabelSelectorOpIn LabelSelectorOperator = "In"
1054 LabelSelectorOpNotIn LabelSelectorOperator = "NotIn"
1055 LabelSelectorOpExists LabelSelectorOperator = "Exists"
1056 LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist"
1057)
Stephane Barbarie260a5632019-02-26 16:12:49 -05001058
1059// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
1060// that the fieldset applies to.
1061type ManagedFieldsEntry struct {
1062 // Manager is an identifier of the workflow managing these fields.
1063 Manager string `json:"manager,omitempty" protobuf:"bytes,1,opt,name=manager"`
1064 // Operation is the type of operation which lead to this ManagedFieldsEntry being created.
1065 // The only valid values for this field are 'Apply' and 'Update'.
1066 Operation ManagedFieldsOperationType `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation,casttype=ManagedFieldsOperationType"`
1067 // APIVersion defines the version of this resource that this field set
1068 // applies to. The format is "group/version" just like the top-level
1069 // APIVersion field. It is necessary to track the version of a field
1070 // set because it cannot be automatically converted.
1071 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"`
1072 // Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'
1073 // +optional
1074 Time *Time `json:"time,omitempty" protobuf:"bytes,4,opt,name=time"`
1075 // Fields identifies a set of fields.
1076 // +optional
1077 Fields *Fields `json:"fields,omitempty" protobuf:"bytes,5,opt,name=fields,casttype=Fields"`
1078}
1079
1080// ManagedFieldsOperationType is the type of operation which lead to a ManagedFieldsEntry being created.
1081type ManagedFieldsOperationType string
1082
1083const (
1084 ManagedFieldsOperationApply ManagedFieldsOperationType = "Apply"
1085 ManagedFieldsOperationUpdate ManagedFieldsOperationType = "Update"
1086)
1087
1088// Fields stores a set of fields in a data structure like a Trie.
1089// To understand how this is used, see: https://github.com/kubernetes-sigs/structured-merge-diff
1090type Fields struct {
1091 // Map stores a set of fields in a data structure like a Trie.
1092 //
1093 // Each key is either a '.' representing the field itself, and will always map to an empty set,
1094 // or a string representing a sub-field or item. The string will follow one of these four formats:
1095 // 'f:<name>', where <name> is the name of a field in a struct, or key in a map
1096 // 'v:<value>', where <value> is the exact json formatted value of a list item
1097 // 'i:<index>', where <index> is position of a item in a list
1098 // 'k:<keys>', where <keys> is a map of a list item's key fields to their unique values
1099 // If a key maps to an empty Fields value, the field that key represents is part of the set.
1100 //
1101 // The exact format is defined in k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal
1102 Map map[string]Fields `json:",inline" protobuf:"bytes,1,rep,name=map"`
1103}