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