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