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