mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Updated CSIDriver references
This commit is contained in:
parent
726af6bd7f
commit
c6fd25d100
893
api/openapi-spec/swagger.json
generated
893
api/openapi-spec/swagger.json
generated
@ -14290,6 +14290,96 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.storage.v1.CSIDriver": {
|
||||
"description": "CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced.",
|
||||
"properties": {
|
||||
"apiVersion": {
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
||||
"description": "Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriverSpec",
|
||||
"description": "Specification of the CSI Driver."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"spec"
|
||||
],
|
||||
"type": "object",
|
||||
"x-kubernetes-group-version-kind": [
|
||||
{
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"io.k8s.api.storage.v1.CSIDriverList": {
|
||||
"description": "CSIDriverList is a collection of CSIDriver objects.",
|
||||
"properties": {
|
||||
"apiVersion": {
|
||||
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
"type": "string"
|
||||
},
|
||||
"items": {
|
||||
"description": "items is the list of CSIDriver",
|
||||
"items": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
},
|
||||
"type": "array",
|
||||
"x-kubernetes-list-type": "set"
|
||||
},
|
||||
"kind": {
|
||||
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta",
|
||||
"description": "Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"type": "object",
|
||||
"x-kubernetes-group-version-kind": [
|
||||
{
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriverList",
|
||||
"version": "v1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"io.k8s.api.storage.v1.CSIDriverSpec": {
|
||||
"description": "CSIDriverSpec is the specification of a CSIDriver.",
|
||||
"properties": {
|
||||
"attachRequired": {
|
||||
"description": "attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"podInfoOnMount": {
|
||||
"description": "If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeConext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" iff the volume is an ephemeral inline volume\n defined by a CSIVolumeSource, otherwise \"false\"\n\n\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"volumeLifecycleModes": {
|
||||
"description": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"x-kubernetes-list-type": "set"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"io.k8s.api.storage.v1.CSINode": {
|
||||
"description": "CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.",
|
||||
"properties": {
|
||||
@ -91556,6 +91646,593 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/csidrivers": {
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "delete collection of CSIDriver",
|
||||
"operationId": "deleteStorageV1CollectionCSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.",
|
||||
"in": "query",
|
||||
"name": "allowWatchBookmarks",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"in": "query",
|
||||
"name": "continue",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
|
||||
"in": "query",
|
||||
"name": "dryRun",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "fieldSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.",
|
||||
"in": "query",
|
||||
"name": "gracePeriodSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "labelSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.",
|
||||
"in": "query",
|
||||
"name": "orphanDependents",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.",
|
||||
"in": "query",
|
||||
"name": "propagationPolicy",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"in": "query",
|
||||
"name": "resourceVersion",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"in": "query",
|
||||
"name": "timeoutSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"in": "query",
|
||||
"name": "watch",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "deletecollection",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"get": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "list or watch objects of kind CSIDriver",
|
||||
"operationId": "listStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.",
|
||||
"in": "query",
|
||||
"name": "allowWatchBookmarks",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"in": "query",
|
||||
"name": "continue",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "fieldSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "labelSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"in": "query",
|
||||
"name": "resourceVersion",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"in": "query",
|
||||
"name": "timeoutSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"in": "query",
|
||||
"name": "watch",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf",
|
||||
"application/json;stream=watch",
|
||||
"application/vnd.kubernetes.protobuf;stream=watch"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriverList"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "list",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"in": "query",
|
||||
"name": "pretty",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"post": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "create a CSIDriver",
|
||||
"operationId": "createStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
|
||||
"in": "query",
|
||||
"name": "dryRun",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
|
||||
"in": "query",
|
||||
"name": "fieldManager",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"202": {
|
||||
"description": "Accepted",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "post",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/csidrivers/{name}": {
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "delete a CSIDriver",
|
||||
"operationId": "deleteStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
|
||||
"in": "query",
|
||||
"name": "dryRun",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.",
|
||||
"in": "query",
|
||||
"name": "gracePeriodSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.",
|
||||
"in": "query",
|
||||
"name": "orphanDependents",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.",
|
||||
"in": "query",
|
||||
"name": "propagationPolicy",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"202": {
|
||||
"description": "Accepted",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "delete",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"get": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "read the specified CSIDriver",
|
||||
"operationId": "readStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.",
|
||||
"in": "query",
|
||||
"name": "exact",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.",
|
||||
"in": "query",
|
||||
"name": "export",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "get",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"description": "name of the CSIDriver",
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"in": "query",
|
||||
"name": "pretty",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json",
|
||||
"application/apply-patch+yaml"
|
||||
],
|
||||
"description": "partially update the specified CSIDriver",
|
||||
"operationId": "patchStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
|
||||
"in": "query",
|
||||
"name": "dryRun",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).",
|
||||
"in": "query",
|
||||
"name": "fieldManager",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.",
|
||||
"in": "query",
|
||||
"name": "force",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "patch",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "replace the specified CSIDriver",
|
||||
"operationId": "replaceStorageV1CSIDriver",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
|
||||
"in": "query",
|
||||
"name": "dryRun",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
|
||||
"in": "query",
|
||||
"name": "fieldManager",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.storage.v1.CSIDriver"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "put",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/csinodes": {
|
||||
"delete": {
|
||||
"consumes": [
|
||||
@ -93505,6 +94182,222 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/watch/csidrivers": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "watch individual changes to a list of CSIDriver. deprecated: use the 'watch' parameter with a list operation instead.",
|
||||
"operationId": "watchStorageV1CSIDriverList",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf",
|
||||
"application/json;stream=watch",
|
||||
"application/vnd.kubernetes.protobuf;stream=watch"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "watchlist",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.",
|
||||
"in": "query",
|
||||
"name": "allowWatchBookmarks",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"in": "query",
|
||||
"name": "continue",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "fieldSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "labelSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"in": "query",
|
||||
"name": "pretty",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"in": "query",
|
||||
"name": "resourceVersion",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"in": "query",
|
||||
"name": "timeoutSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"in": "query",
|
||||
"name": "watch",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/watch/csidrivers/{name}": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"description": "watch changes to an object of kind CSIDriver. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.",
|
||||
"operationId": "watchStorageV1CSIDriver",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf",
|
||||
"application/json;stream=watch",
|
||||
"application/vnd.kubernetes.protobuf;stream=watch"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"storage_v1"
|
||||
],
|
||||
"x-kubernetes-action": "watch",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "storage.k8s.io",
|
||||
"kind": "CSIDriver",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.",
|
||||
"in": "query",
|
||||
"name": "allowWatchBookmarks",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
|
||||
"in": "query",
|
||||
"name": "continue",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "fieldSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
|
||||
"in": "query",
|
||||
"name": "labelSelector",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "name of the CSIDriver",
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"in": "query",
|
||||
"name": "pretty",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
|
||||
"in": "query",
|
||||
"name": "resourceVersion",
|
||||
"type": "string",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
|
||||
"in": "query",
|
||||
"name": "timeoutSeconds",
|
||||
"type": "integer",
|
||||
"uniqueItems": true
|
||||
},
|
||||
{
|
||||
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
|
||||
"in": "query",
|
||||
"name": "watch",
|
||||
"type": "boolean",
|
||||
"uniqueItems": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/storage.k8s.io/v1/watch/csinodes": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
|
@ -127,7 +127,6 @@ go_library(
|
||||
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/metadata:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/metadata/metadatainformer:go_default_library",
|
||||
|
@ -30,12 +30,11 @@ import (
|
||||
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
cacheddiscovery "k8s.io/client-go/discovery/cached/memory"
|
||||
storagev1informer "k8s.io/client-go/informers/storage/v1"
|
||||
storagev1beta1informer "k8s.io/client-go/informers/storage/v1beta1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/metadata"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
@ -313,15 +312,12 @@ func startAttachDetachController(ctx ControllerContext) (http.Handler, bool, err
|
||||
}
|
||||
|
||||
var (
|
||||
csiNodeInformer storagev1informer.CSINodeInformer
|
||||
csiDriverInformer storagev1beta1informer.CSIDriverInformer
|
||||
csiNodeInformer storagev1informer.CSINodeInformer
|
||||
)
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSINodeInfo) {
|
||||
csiNodeInformer = ctx.InformerFactory.Storage().V1().CSINodes()
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
csiDriverInformer = ctx.InformerFactory.Storage().V1beta1().CSIDrivers()
|
||||
}
|
||||
csiDriverInformer := ctx.InformerFactory.Storage().V1().CSIDrivers()
|
||||
|
||||
plugins, err := ProbeAttachableVolumePlugins()
|
||||
if err != nil {
|
||||
|
@ -163,6 +163,8 @@ func TestDefaulting(t *testing.T) {
|
||||
{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClassList"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1", Kind: "VolumeAttachment"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1", Kind: "VolumeAttachmentList"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1", Kind: "CSIDriver"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1", Kind: "CSIDriverList"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1beta1", Kind: "VolumeAttachment"}: {},
|
||||
{Group: "storage.k8s.io", Version: "v1beta1", Kind: "VolumeAttachmentList"}: {},
|
||||
{Group: "authentication.k8s.io", Version: "v1", Kind: "TokenRequest"}: {},
|
||||
|
@ -34,13 +34,11 @@ go_library(
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/workqueue:go_default_library",
|
||||
|
@ -37,13 +37,11 @@ import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
storageinformersv1 "k8s.io/client-go/informers/storage/v1"
|
||||
storageinformers "k8s.io/client-go/informers/storage/v1beta1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
storagelistersv1 "k8s.io/client-go/listers/storage/v1"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1beta1"
|
||||
kcache "k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
@ -111,7 +109,7 @@ func NewAttachDetachController(
|
||||
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
||||
pvInformer coreinformers.PersistentVolumeInformer,
|
||||
csiNodeInformer storageinformersv1.CSINodeInformer,
|
||||
csiDriverInformer storageinformers.CSIDriverInformer,
|
||||
csiDriverInformer storageinformersv1.CSIDriverInformer,
|
||||
cloud cloudprovider.Interface,
|
||||
plugins []volume.VolumePlugin,
|
||||
prober volume.DynamicPluginProber,
|
||||
@ -140,10 +138,8 @@ func NewAttachDetachController(
|
||||
adc.csiNodeSynced = csiNodeInformer.Informer().HasSynced
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
adc.csiDriverLister = csiDriverInformer.Lister()
|
||||
adc.csiDriversSynced = csiDriverInformer.Informer().HasSynced
|
||||
}
|
||||
adc.csiDriverLister = csiDriverInformer.Lister()
|
||||
adc.csiDriversSynced = csiDriverInformer.Informer().HasSynced
|
||||
|
||||
if err := adc.volumePluginMgr.InitPlugins(plugins, prober, adc); err != nil {
|
||||
return nil, fmt.Errorf("Could not initialize volume plugins for Attach/Detach Controller: %+v", err)
|
||||
@ -281,7 +277,7 @@ type attachDetachController struct {
|
||||
// csiDriverLister is the shared CSIDriver lister used to fetch and store
|
||||
// CSIDriver objects from the API server. It is shared with other controllers
|
||||
// and therefore the CSIDriver objects in its store should be treated as immutable.
|
||||
csiDriverLister storagelisters.CSIDriverLister
|
||||
csiDriverLister storagelistersv1.CSIDriverLister
|
||||
csiDriversSynced kcache.InformerSynced
|
||||
|
||||
// cloud provider used by volume host
|
||||
@ -693,7 +689,7 @@ func (adc *attachDetachController) CSINodeLister() storagelistersv1.CSINodeListe
|
||||
return adc.csiNodeLister
|
||||
}
|
||||
|
||||
func (adc *attachDetachController) CSIDriverLister() storagelisters.CSIDriverLister {
|
||||
func (adc *attachDetachController) CSIDriverLister() storagelistersv1.CSIDriverLister {
|
||||
return adc.csiDriverLister
|
||||
}
|
||||
|
||||
@ -822,6 +818,6 @@ func (adc *attachDetachController) GetSubpather() subpath.Interface {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (adc *attachDetachController) GetCSIDriverLister() storagelisters.CSIDriverLister {
|
||||
func (adc *attachDetachController) GetCSIDriverLister() storagelistersv1.CSIDriverLister {
|
||||
return adc.csiDriverLister
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
|
||||
informerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
informerFactory.Core().V1().PersistentVolumes(),
|
||||
informerFactory.Storage().V1().CSINodes(),
|
||||
informerFactory.Storage().V1beta1().CSIDrivers(),
|
||||
informerFactory.Storage().V1().CSIDrivers(),
|
||||
nil, /* cloud */
|
||||
nil, /* plugins */
|
||||
nil, /* prober */
|
||||
@ -248,7 +248,7 @@ func attachDetachRecoveryTestCase(t *testing.T, extraPods1 []*v1.Pod, extraPods2
|
||||
informerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
informerFactory.Core().V1().PersistentVolumes(),
|
||||
informerFactory.Storage().V1().CSINodes(),
|
||||
informerFactory.Storage().V1beta1().CSIDrivers(),
|
||||
informerFactory.Storage().V1().CSIDrivers(),
|
||||
nil, /* cloud */
|
||||
plugins,
|
||||
prober,
|
||||
|
@ -608,7 +608,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
||||
TopologyManager: {Default: true, PreRelease: featuregate.Beta},
|
||||
ServiceNodeExclusion: {Default: false, PreRelease: featuregate.Alpha},
|
||||
NodeDisruptionExclusion: {Default: false, PreRelease: featuregate.Alpha},
|
||||
CSIDriverRegistry: {Default: true, PreRelease: featuregate.GA},
|
||||
CSIDriverRegistry: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20
|
||||
CSINodeInfo: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.19
|
||||
BlockVolume: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20
|
||||
StorageObjectInUseProtection: {Default: true, PreRelease: featuregate.GA},
|
||||
|
@ -132,7 +132,7 @@ go_library(
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/certificate:go_default_library",
|
||||
|
@ -29,14 +29,12 @@ import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1beta1"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/kubelet/configmap"
|
||||
"k8s.io/kubernetes/pkg/kubelet/secret"
|
||||
"k8s.io/kubernetes/pkg/kubelet/token"
|
||||
@ -65,17 +63,15 @@ func NewInitializedVolumePluginMgr(
|
||||
var csiDriverLister storagelisters.CSIDriverLister
|
||||
var csiDriversSynced cache.InformerSynced
|
||||
const resyncPeriod = 0
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
// Don't initialize if kubeClient is nil
|
||||
if kubelet.kubeClient != nil {
|
||||
informerFactory = informers.NewSharedInformerFactory(kubelet.kubeClient, resyncPeriod)
|
||||
csiDriverInformer := informerFactory.Storage().V1beta1().CSIDrivers()
|
||||
csiDriverLister = csiDriverInformer.Lister()
|
||||
csiDriversSynced = csiDriverInformer.Informer().HasSynced
|
||||
// Don't initialize if kubeClient is nil
|
||||
if kubelet.kubeClient != nil {
|
||||
informerFactory = informers.NewSharedInformerFactory(kubelet.kubeClient, resyncPeriod)
|
||||
csiDriverInformer := informerFactory.Storage().V1().CSIDrivers()
|
||||
csiDriverLister = csiDriverInformer.Lister()
|
||||
csiDriversSynced = csiDriverInformer.Informer().HasSynced
|
||||
|
||||
} else {
|
||||
klog.Warning("kubeClient is nil. Skip initialization of CSIDriverLister")
|
||||
}
|
||||
} else {
|
||||
klog.Warning("kubeClient is nil. Skip initialization of CSIDriverLister")
|
||||
}
|
||||
|
||||
kvh := &kubeletVolumeHost{
|
||||
|
@ -83,6 +83,7 @@ var GVRToStorageVersionHash = map[string]string{
|
||||
"rbac.authorization.k8s.io/v1beta1/roles": "7FuwZcIIItM=",
|
||||
"scheduling.k8s.io/v1beta1/priorityclasses": "1QwjyaZjj3Y=",
|
||||
"scheduling.k8s.io/v1/priorityclasses": "1QwjyaZjj3Y=",
|
||||
"storage.k8s.io/v1/csidrivers": "hL6j/rwBV5w=",
|
||||
"storage.k8s.io/v1/csinodes": "Pe62DkZtjuo=",
|
||||
"storage.k8s.io/v1/storageclasses": "K+m6uJwbjGY=",
|
||||
"storage.k8s.io/v1/volumeattachments": "vQAqD28V4AY=",
|
||||
|
@ -96,7 +96,6 @@ go_library(
|
||||
"//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
@ -39,7 +39,6 @@ import (
|
||||
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
|
||||
schedulingv1 "k8s.io/api/scheduling/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -508,9 +507,9 @@ func AddHandlers(h printers.PrintHandler) {
|
||||
|
||||
csiDriverColumnDefinitions := []metav1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
||||
{Name: "AttachRequired", Type: "boolean", Description: storagev1beta1.CSIDriverSpec{}.SwaggerDoc()["attachRequired"]},
|
||||
{Name: "PodInfoOnMount", Type: "boolean", Description: storagev1beta1.CSIDriverSpec{}.SwaggerDoc()["podInfoOnMount"]},
|
||||
{Name: "Modes", Type: "string", Description: storagev1beta1.CSIDriverSpec{}.SwaggerDoc()["volumeLifecycleModes"]},
|
||||
{Name: "AttachRequired", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["attachRequired"]},
|
||||
{Name: "PodInfoOnMount", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["podInfoOnMount"]},
|
||||
{Name: "Modes", Type: "string", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["volumeLifecycleModes"]},
|
||||
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
|
||||
}
|
||||
h.TableHandler(csiDriverColumnDefinitions, printCSIDriver)
|
||||
|
@ -46,7 +46,7 @@ func getValidCSIDriver(name string) *storage.CSIDriver {
|
||||
func TestCSIDriverStrategy(t *testing.T) {
|
||||
ctx := genericapirequest.WithRequestInfo(genericapirequest.NewContext(), &genericapirequest.RequestInfo{
|
||||
APIGroup: "storage.k8s.io",
|
||||
APIVersion: "v1beta1",
|
||||
APIVersion: "v1",
|
||||
Resource: "csidrivers",
|
||||
})
|
||||
if Strategy.NamespaceScoped() {
|
||||
@ -81,7 +81,7 @@ func TestCSIDriverStrategy(t *testing.T) {
|
||||
func TestCSIDriverPrepareForCreate(t *testing.T) {
|
||||
ctx := genericapirequest.WithRequestInfo(genericapirequest.NewContext(), &genericapirequest.RequestInfo{
|
||||
APIGroup: "storage.k8s.io",
|
||||
APIVersion: "v1beta1",
|
||||
APIVersion: "v1",
|
||||
Resource: "csidrivers",
|
||||
})
|
||||
|
||||
@ -139,7 +139,7 @@ func TestCSIDriverPrepareForCreate(t *testing.T) {
|
||||
func TestCSIDriverPrepareForUpdate(t *testing.T) {
|
||||
ctx := genericapirequest.WithRequestInfo(genericapirequest.NewContext(), &genericapirequest.RequestInfo{
|
||||
APIGroup: "storage.k8s.io",
|
||||
APIVersion: "v1beta1",
|
||||
APIVersion: "v1",
|
||||
Resource: "csidrivers",
|
||||
})
|
||||
|
||||
@ -369,18 +369,18 @@ func TestCSIDriverValidation(t *testing.T) {
|
||||
testValidation := func(csiDriver *storage.CSIDriver, apiVersion string) field.ErrorList {
|
||||
ctx := genericapirequest.WithRequestInfo(genericapirequest.NewContext(), &genericapirequest.RequestInfo{
|
||||
APIGroup: "storage.k8s.io",
|
||||
APIVersion: "v1beta1",
|
||||
APIVersion: "v1",
|
||||
Resource: "csidrivers",
|
||||
})
|
||||
return Strategy.Validate(ctx, csiDriver)
|
||||
}
|
||||
|
||||
betaErr := testValidation(test.csiDriver, "v1beta1")
|
||||
if len(betaErr) > 0 && !test.expectError {
|
||||
t.Errorf("Validation of v1beta1 object failed: %+v", betaErr)
|
||||
err := testValidation(test.csiDriver, "v1")
|
||||
if len(err) > 0 && !test.expectError {
|
||||
t.Errorf("Validation of v1 object failed: %+v", err)
|
||||
}
|
||||
if len(betaErr) == 0 && test.expectError {
|
||||
t.Errorf("Validation of v1beta1 object unexpectedly succeeded")
|
||||
if len(err) == 0 && test.expectError {
|
||||
t.Errorf("Validation of v1 object unexpectedly succeeded")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -104,14 +104,12 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorag
|
||||
storage["csinodes"] = csiNodeStorage.CSINode
|
||||
}
|
||||
|
||||
// register csidrivers if CSIDriverRegistry feature gate is enabled
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
csiDriverStorage, err := csidriverstore.NewStorage(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage["csidrivers"] = csiDriverStorage.CSIDriver
|
||||
// register csidrivers
|
||||
csiDriverStorage, err := csidriverstore.NewStorage(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage["csidrivers"] = csiDriverStorage.CSIDriver
|
||||
|
||||
return storage, nil
|
||||
}
|
||||
@ -144,6 +142,13 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
||||
storage["csinodes"] = csiNodeStorage.CSINode
|
||||
}
|
||||
|
||||
// register csidrivers
|
||||
csiDriverStorage, err := csidriverstore.NewStorage(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage["csidrivers"] = csiDriverStorage.CSIDriver
|
||||
|
||||
return storage, nil
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/pkg/volume",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/volume/util/fs:go_default_library",
|
||||
"//pkg/volume/util/hostutil:go_default_library",
|
||||
"//pkg/volume/util/recyclerclient:go_default_library",
|
||||
@ -30,11 +29,9 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//staging/src/k8s.io/cloud-provider:go_default_library",
|
||||
|
@ -24,7 +24,6 @@ go_library(
|
||||
"//pkg/volume/util/types:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
@ -35,7 +34,7 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/csi-translation-lib/plugins:go_default_library",
|
||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||
"//vendor/google.golang.org/grpc:go_default_library",
|
||||
@ -71,7 +70,6 @@ go_test(
|
||||
"//pkg/volume/util/types:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
|
@ -315,8 +315,6 @@ func TestAttacherAttachWithInline(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAttacherWithCSIDriver(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, true)()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
driver string
|
||||
@ -400,8 +398,6 @@ func TestAttacherWithCSIDriver(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAttacherWaitForVolumeAttachmentWithCSIDriver(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, true)()
|
||||
|
||||
// In order to detect if the volume plugin would skip WaitForAttach for non-attachable drivers,
|
||||
// we do not instantiate any VolumeAttachment. So if the plugin does not skip attach, WaitForVolumeAttachment
|
||||
// will return an error that volume attachment was not found.
|
||||
@ -1553,7 +1549,7 @@ func newTestWatchPlugin(t *testing.T, fakeClient *fakeclient.Clientset) (*csiPlu
|
||||
|
||||
// Start informer for CSIDrivers.
|
||||
factory := informers.NewSharedInformerFactory(fakeClient, CsiResyncPeriod)
|
||||
csiDriverInformer := factory.Storage().V1beta1().CSIDrivers()
|
||||
csiDriverInformer := factory.Storage().V1().CSIDrivers()
|
||||
csiDriverLister := csiDriverInformer.Lister()
|
||||
factory.Start(wait.NeverStop)
|
||||
|
||||
@ -1576,12 +1572,10 @@ func newTestWatchPlugin(t *testing.T, fakeClient *fakeclient.Clientset) (*csiPlu
|
||||
t.Fatalf("cannot assert plugin to be type csiPlugin")
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(TestInformerSyncPeriod, TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
}
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(TestInformerSyncPeriod, TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
|
||||
return csiPlug, fakeWatcher, tmpDir, fakeClient
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/api/storage/v1beta1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@ -382,19 +382,18 @@ func TestBlockMapperMapPodDevice(t *testing.T) {
|
||||
|
||||
func TestBlockMapperMapPodDeviceNotSupportAttach(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIBlockVolume, true)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, true)()
|
||||
|
||||
fakeClient := fakeclient.NewSimpleClientset()
|
||||
attachRequired := false
|
||||
fakeDriver := &v1beta1.CSIDriver{
|
||||
fakeDriver := &storagev1.CSIDriver{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: testDriver,
|
||||
},
|
||||
Spec: v1beta1.CSIDriverSpec{
|
||||
Spec: storagev1.CSIDriverSpec{
|
||||
AttachRequired: &attachRequired,
|
||||
},
|
||||
}
|
||||
_, err := fakeClient.StorageV1beta1().CSIDrivers().Create(context.TODO(), fakeDriver, metav1.CreateOptions{})
|
||||
_, err := fakeClient.StorageV1().CSIDrivers().Create(context.TODO(), fakeDriver, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create a fakeDriver: %v", err)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1beta1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@ -296,10 +296,6 @@ func (c *csiMountMgr) SetUpAt(dir string, mounterArgs volume.MounterArgs) error
|
||||
}
|
||||
|
||||
func (c *csiMountMgr) podAttributes() (map[string]string, error) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
kletHost, ok := c.plugin.host.(volume.KubeletVolumeHost)
|
||||
if ok {
|
||||
kletHost.WaitForCacheSync()
|
||||
|
@ -32,7 +32,6 @@ import (
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -99,8 +98,7 @@ func TestMounterGetPath(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, podInfoEnabled)()
|
||||
func TestMounterSetUp(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
driver string
|
||||
@ -158,10 +156,10 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
// Modes must be set if (and only if) CSIInlineVolume is enabled.
|
||||
var modes []storagev1beta1.VolumeLifecycleMode
|
||||
var modes []storage.VolumeLifecycleMode
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, test.csiInlineVolume)()
|
||||
if test.csiInlineVolume {
|
||||
modes = append(modes, storagev1beta1.VolumeLifecyclePersistent)
|
||||
modes = append(modes, storage.VolumeLifecyclePersistent)
|
||||
}
|
||||
fakeClient := fakeclient.NewSimpleClientset(
|
||||
getTestCSIDriver("no-info", &noPodMountInfo, nil, modes),
|
||||
@ -256,29 +254,13 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||
if !reflect.DeepEqual(vol.MountFlags, pv.Spec.MountOptions) {
|
||||
t.Errorf("csi server expected mount options %v, got %v", pv.Spec.MountOptions, vol.MountFlags)
|
||||
}
|
||||
if podInfoEnabled {
|
||||
if !reflect.DeepEqual(vol.VolumeContext, test.expectedVolumeContext) {
|
||||
t.Errorf("csi server expected volumeContext %+v, got %+v", test.expectedVolumeContext, vol.VolumeContext)
|
||||
}
|
||||
} else {
|
||||
// CSIPodInfo feature is disabled, we expect no modifications to volumeContext.
|
||||
if !reflect.DeepEqual(vol.VolumeContext, test.volumeContext) {
|
||||
t.Errorf("csi server expected volumeContext %+v, got %+v", test.volumeContext, vol.VolumeContext)
|
||||
}
|
||||
if !reflect.DeepEqual(vol.VolumeContext, test.expectedVolumeContext) {
|
||||
t.Errorf("csi server expected volumeContext %+v, got %+v", test.expectedVolumeContext, vol.VolumeContext)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMounterSetUp(t *testing.T) {
|
||||
t.Run("WithCSIPodInfo", func(t *testing.T) {
|
||||
MounterSetUpTests(t, true)
|
||||
})
|
||||
t.Run("WithoutCSIPodInfo", func(t *testing.T) {
|
||||
MounterSetUpTests(t, false)
|
||||
})
|
||||
}
|
||||
|
||||
func TestMounterSetUpSimple(t *testing.T) {
|
||||
fakeClient := fakeclient.NewSimpleClientset()
|
||||
plug, tmpDir := newTestPlugin(t, fakeClient)
|
||||
@ -287,7 +269,7 @@ func TestMounterSetUpSimple(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
podUID types.UID
|
||||
mode storagev1beta1.VolumeLifecycleMode
|
||||
mode storage.VolumeLifecycleMode
|
||||
fsType string
|
||||
options []string
|
||||
spec func(string, []string) *volume.Spec
|
||||
@ -296,7 +278,7 @@ func TestMounterSetUpSimple(t *testing.T) {
|
||||
{
|
||||
name: "setup with ephemeral source",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecycleEphemeral,
|
||||
mode: storage.VolumeLifecycleEphemeral,
|
||||
fsType: "ext4",
|
||||
shouldFail: true,
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
@ -308,7 +290,7 @@ func TestMounterSetUpSimple(t *testing.T) {
|
||||
{
|
||||
name: "setup with persistent source",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
mode: storage.VolumeLifecyclePersistent,
|
||||
fsType: "zfs",
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
pvSrc := makeTestPV("pv1", 20, testDriver, "vol1")
|
||||
@ -320,7 +302,7 @@ func TestMounterSetUpSimple(t *testing.T) {
|
||||
{
|
||||
name: "setup with persistent source without unspecified fstype and options",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
mode: storage.VolumeLifecyclePersistent,
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
return volume.NewSpecFromPersistentVolume(makeTestPV("pv1", 20, testDriver, "vol2"), false)
|
||||
},
|
||||
@ -354,7 +336,7 @@ func TestMounterSetUpSimple(t *testing.T) {
|
||||
csiMounter := mounter.(*csiMountMgr)
|
||||
csiMounter.csiClient = setupClient(t, true)
|
||||
|
||||
if csiMounter.volumeLifecycleMode != storagev1beta1.VolumeLifecyclePersistent {
|
||||
if csiMounter.volumeLifecycleMode != storage.VolumeLifecyclePersistent {
|
||||
t.Fatal("unexpected volume mode: ", csiMounter.volumeLifecycleMode)
|
||||
}
|
||||
|
||||
@ -481,7 +463,7 @@ func TestMounterSetupWithStatusTracking(t *testing.T) {
|
||||
csiMounter := mounter.(*csiMountMgr)
|
||||
csiMounter.csiClient = setupClient(t, true)
|
||||
|
||||
if csiMounter.volumeLifecycleMode != storagev1beta1.VolumeLifecyclePersistent {
|
||||
if csiMounter.volumeLifecycleMode != storage.VolumeLifecyclePersistent {
|
||||
t.Fatal("unexpected volume mode: ", csiMounter.volumeLifecycleMode)
|
||||
}
|
||||
|
||||
@ -516,7 +498,7 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
podUID types.UID
|
||||
mode storagev1beta1.VolumeLifecycleMode
|
||||
mode storage.VolumeLifecycleMode
|
||||
fsType string
|
||||
options []string
|
||||
spec func(string, []string) *volume.Spec
|
||||
@ -525,7 +507,7 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
{
|
||||
name: "setup with vol source",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecycleEphemeral,
|
||||
mode: storage.VolumeLifecycleEphemeral,
|
||||
fsType: "ext4",
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
volSrc := makeTestVol("pv1", testDriver)
|
||||
@ -536,7 +518,7 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
{
|
||||
name: "setup with persistent source",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
mode: storage.VolumeLifecyclePersistent,
|
||||
fsType: "zfs",
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
pvSrc := makeTestPV("pv1", 20, testDriver, "vol1")
|
||||
@ -548,7 +530,7 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
{
|
||||
name: "setup with persistent source without unspecified fstype and options",
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
mode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
mode: storage.VolumeLifecyclePersistent,
|
||||
spec: func(fsType string, options []string) *volume.Spec {
|
||||
return volume.NewSpecFromPersistentVolume(makeTestPV("pv1", 20, testDriver, "vol2"), false)
|
||||
},
|
||||
@ -562,9 +544,9 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
// The fake driver currently supports all modes.
|
||||
volumeLifecycleModes := []storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecycleEphemeral,
|
||||
storagev1beta1.VolumeLifecyclePersistent,
|
||||
volumeLifecycleModes := []storage.VolumeLifecycleMode{
|
||||
storage.VolumeLifecycleEphemeral,
|
||||
storage.VolumeLifecyclePersistent,
|
||||
}
|
||||
driver := getTestCSIDriver(testDriver, nil, nil, volumeLifecycleModes)
|
||||
fakeClient := fakeclient.NewSimpleClientset(driver)
|
||||
@ -595,11 +577,11 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
t.Fatal("unexpected volume mode: ", csiMounter.volumeLifecycleMode)
|
||||
}
|
||||
|
||||
if csiMounter.volumeLifecycleMode == storagev1beta1.VolumeLifecycleEphemeral && csiMounter.volumeID != makeVolumeHandle(string(tc.podUID), csiMounter.specVolumeID) {
|
||||
if csiMounter.volumeLifecycleMode == storage.VolumeLifecycleEphemeral && csiMounter.volumeID != makeVolumeHandle(string(tc.podUID), csiMounter.specVolumeID) {
|
||||
t.Fatal("unexpected generated volumeHandle:", csiMounter.volumeID)
|
||||
}
|
||||
|
||||
if csiMounter.volumeLifecycleMode == storagev1beta1.VolumeLifecyclePersistent {
|
||||
if csiMounter.volumeLifecycleMode == storage.VolumeLifecyclePersistent {
|
||||
attachID := getAttachmentName(csiMounter.volumeID, string(csiMounter.driverName), string(plug.host.GetNodeName()))
|
||||
attachment := makeTestAttachment(attachID, "test-node", csiMounter.spec.Name())
|
||||
_, err = csiMounter.k8s.StorageV1().VolumeAttachments().Create(context.TODO(), attachment, metav1.CreateOptions{})
|
||||
@ -624,10 +606,10 @@ func TestMounterSetUpWithInline(t *testing.T) {
|
||||
}
|
||||
|
||||
// validate stagingTargetPath
|
||||
if tc.mode == storagev1beta1.VolumeLifecycleEphemeral && vol.DeviceMountPath != "" {
|
||||
if tc.mode == storage.VolumeLifecycleEphemeral && vol.DeviceMountPath != "" {
|
||||
t.Errorf("unexpected devicePathTarget sent to driver: %s", vol.DeviceMountPath)
|
||||
}
|
||||
if tc.mode == storagev1beta1.VolumeLifecyclePersistent {
|
||||
if tc.mode == storage.VolumeLifecyclePersistent {
|
||||
devicePath, err := makeDeviceMountPath(plug, csiMounter.spec)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"k8s.io/klog"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1beta1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -38,7 +38,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1beta1"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1"
|
||||
csitranslationplugins "k8s.io/csi-translation-lib/plugins"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
@ -183,25 +183,23 @@ func (h *RegistrationHandler) DeRegisterPlugin(pluginName string) {
|
||||
func (p *csiPlugin) Init(host volume.VolumeHost) error {
|
||||
p.host = host
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
csiClient := host.GetKubeClient()
|
||||
if csiClient == nil {
|
||||
klog.Warning(log("kubeclient not set, assuming standalone kubelet"))
|
||||
} else {
|
||||
// set CSIDriverLister
|
||||
adcHost, ok := host.(volume.AttachDetachVolumeHost)
|
||||
if ok {
|
||||
p.csiDriverLister = adcHost.CSIDriverLister()
|
||||
if p.csiDriverLister == nil {
|
||||
klog.Error(log("CSIDriverLister not found on AttachDetachVolumeHost"))
|
||||
}
|
||||
csiClient := host.GetKubeClient()
|
||||
if csiClient == nil {
|
||||
klog.Warning(log("kubeclient not set, assuming standalone kubelet"))
|
||||
} else {
|
||||
// set CSIDriverLister
|
||||
adcHost, ok := host.(volume.AttachDetachVolumeHost)
|
||||
if ok {
|
||||
p.csiDriverLister = adcHost.CSIDriverLister()
|
||||
if p.csiDriverLister == nil {
|
||||
klog.Error(log("CSIDriverLister not found on AttachDetachVolumeHost"))
|
||||
}
|
||||
kletHost, ok := host.(volume.KubeletVolumeHost)
|
||||
if ok {
|
||||
p.csiDriverLister = kletHost.CSIDriverLister()
|
||||
if p.csiDriverLister == nil {
|
||||
klog.Error(log("CSIDriverLister not found on KubeletVolumeHost"))
|
||||
}
|
||||
}
|
||||
kletHost, ok := host.(volume.KubeletVolumeHost)
|
||||
if ok {
|
||||
p.csiDriverLister = kletHost.CSIDriverLister()
|
||||
if p.csiDriverLister == nil {
|
||||
klog.Error(log("CSIDriverLister not found on KubeletVolumeHost"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -732,10 +730,6 @@ func (p *csiPlugin) ConstructBlockVolumeSpec(podUID types.UID, specVolName, mapP
|
||||
// skipAttach looks up CSIDriver object associated with driver name
|
||||
// to determine if driver requires attachment volume operation
|
||||
func (p *csiPlugin) skipAttach(driver string) (bool, error) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
kletHost, ok := p.host.(volume.KubeletVolumeHost)
|
||||
if ok {
|
||||
if err := kletHost.WaitForCacheSync(); err != nil {
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -60,7 +60,7 @@ func newTestPlugin(t *testing.T, client *fakeclient.Clientset) (*csiPlugin, stri
|
||||
|
||||
// Start informer for CSIDrivers.
|
||||
factory := informers.NewSharedInformerFactory(client, CsiResyncPeriod)
|
||||
csiDriverInformer := factory.Storage().V1beta1().CSIDrivers()
|
||||
csiDriverInformer := factory.Storage().V1().CSIDrivers()
|
||||
csiDriverLister := csiDriverInformer.Lister()
|
||||
go factory.Start(wait.NeverStop)
|
||||
|
||||
@ -83,12 +83,10 @@ func newTestPlugin(t *testing.T, client *fakeclient.Clientset) (*csiPlugin, stri
|
||||
t.Fatalf("cannot assert plugin to be type csiPlugin")
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(TestInformerSyncPeriod, TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
}
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(TestInformerSyncPeriod, TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
|
||||
return csiPlug, tmpDir
|
||||
}
|
||||
@ -186,8 +184,8 @@ func TestPluginGetVolumeNameWithInline(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIBlockVolume, true)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
|
||||
|
||||
modes := []storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecyclePersistent,
|
||||
modes := []storagev1.VolumeLifecycleMode{
|
||||
storagev1.VolumeLifecyclePersistent,
|
||||
}
|
||||
driver := getTestCSIDriver(testDriver, nil, nil, modes)
|
||||
client := fakeclient.NewSimpleClientset(driver)
|
||||
@ -424,7 +422,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
volHandle string
|
||||
podUID types.UID
|
||||
shouldFail bool
|
||||
modes []storagev1beta1.VolumeLifecycleMode
|
||||
modes []storagev1.VolumeLifecycleMode
|
||||
}{
|
||||
{
|
||||
name: "construct spec1 from persistent spec",
|
||||
@ -432,7 +430,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
volHandle: "testvol-handle1",
|
||||
originSpec: volume.NewSpecFromPersistentVolume(makeTestPV("test.vol.id", 20, testDriver, "testvol-handle1"), true),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{storagev1beta1.VolumeLifecyclePersistent},
|
||||
modes: []storagev1.VolumeLifecycleMode{storagev1.VolumeLifecyclePersistent},
|
||||
},
|
||||
{
|
||||
name: "construct spec2 from persistent spec",
|
||||
@ -440,7 +438,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
volHandle: "handle2",
|
||||
originSpec: volume.NewSpecFromPersistentVolume(makeTestPV("spec2", 20, testDriver, "handle2"), true),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{storagev1beta1.VolumeLifecyclePersistent},
|
||||
modes: []storagev1.VolumeLifecycleMode{storagev1.VolumeLifecyclePersistent},
|
||||
},
|
||||
{
|
||||
name: "construct spec2 from persistent spec, missing mode",
|
||||
@ -448,7 +446,7 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
volHandle: "handle2",
|
||||
originSpec: volume.NewSpecFromPersistentVolume(makeTestPV("spec2", 20, testDriver, "handle2"), true),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{},
|
||||
modes: []storagev1.VolumeLifecycleMode{},
|
||||
shouldFail: true,
|
||||
},
|
||||
{
|
||||
@ -456,21 +454,21 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) {
|
||||
specVolID: "volspec",
|
||||
originSpec: volume.NewSpecFromVolume(makeTestVol("volspec", testDriver)),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{storagev1beta1.VolumeLifecycleEphemeral},
|
||||
modes: []storagev1.VolumeLifecycleMode{storagev1.VolumeLifecycleEphemeral},
|
||||
},
|
||||
{
|
||||
name: "construct spec from volume spec2",
|
||||
specVolID: "volspec2",
|
||||
originSpec: volume.NewSpecFromVolume(makeTestVol("volspec2", testDriver)),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{storagev1beta1.VolumeLifecycleEphemeral},
|
||||
modes: []storagev1.VolumeLifecycleMode{storagev1.VolumeLifecycleEphemeral},
|
||||
},
|
||||
{
|
||||
name: "construct spec from volume spec2, missing mode",
|
||||
specVolID: "volspec2",
|
||||
originSpec: volume.NewSpecFromVolume(makeTestVol("volspec2", testDriver)),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
modes: []storagev1beta1.VolumeLifecycleMode{},
|
||||
modes: []storagev1.VolumeLifecycleMode{},
|
||||
shouldFail: true,
|
||||
},
|
||||
{
|
||||
@ -562,7 +560,7 @@ func TestPluginNewMounter(t *testing.T) {
|
||||
spec *volume.Spec
|
||||
podUID types.UID
|
||||
namespace string
|
||||
volumeLifecycleMode storagev1beta1.VolumeLifecycleMode
|
||||
volumeLifecycleMode storagev1.VolumeLifecycleMode
|
||||
shouldFail bool
|
||||
}{
|
||||
{
|
||||
@ -570,14 +568,14 @@ func TestPluginNewMounter(t *testing.T) {
|
||||
spec: volume.NewSpecFromPersistentVolume(makeTestPV("test-pv1", 20, testDriver, testVol), true),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
namespace: "test-ns1",
|
||||
volumeLifecycleMode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
volumeLifecycleMode: storagev1.VolumeLifecyclePersistent,
|
||||
},
|
||||
{
|
||||
name: "mounter from volume source",
|
||||
spec: volume.NewSpecFromVolume(makeTestVol("test-vol1", testDriver)),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
namespace: "test-ns2",
|
||||
volumeLifecycleMode: storagev1beta1.VolumeLifecycleEphemeral,
|
||||
volumeLifecycleMode: storagev1.VolumeLifecycleEphemeral,
|
||||
shouldFail: true, // csi inline not enabled
|
||||
},
|
||||
{
|
||||
@ -670,22 +668,22 @@ func TestPluginNewMounter(t *testing.T) {
|
||||
func TestPluginNewMounterWithInline(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIBlockVolume, true)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
|
||||
bothModes := []storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecycleEphemeral,
|
||||
storagev1beta1.VolumeLifecyclePersistent,
|
||||
bothModes := []storagev1.VolumeLifecycleMode{
|
||||
storagev1.VolumeLifecycleEphemeral,
|
||||
storagev1.VolumeLifecyclePersistent,
|
||||
}
|
||||
persistentMode := []storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecyclePersistent,
|
||||
persistentMode := []storagev1.VolumeLifecycleMode{
|
||||
storagev1.VolumeLifecyclePersistent,
|
||||
}
|
||||
ephemeralMode := []storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecycleEphemeral,
|
||||
ephemeralMode := []storagev1.VolumeLifecycleMode{
|
||||
storagev1.VolumeLifecycleEphemeral,
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
spec *volume.Spec
|
||||
podUID types.UID
|
||||
namespace string
|
||||
volumeLifecycleMode storagev1beta1.VolumeLifecycleMode
|
||||
volumeLifecycleMode storagev1.VolumeLifecycleMode
|
||||
shouldFail bool
|
||||
}{
|
||||
{
|
||||
@ -706,18 +704,18 @@ func TestPluginNewMounterWithInline(t *testing.T) {
|
||||
spec: volume.NewSpecFromPersistentVolume(makeTestPV("test-pv1", 20, testDriver, testVol), true),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
namespace: "test-ns1",
|
||||
volumeLifecycleMode: storagev1beta1.VolumeLifecyclePersistent,
|
||||
volumeLifecycleMode: storagev1.VolumeLifecyclePersistent,
|
||||
},
|
||||
{
|
||||
name: "mounter with volume source",
|
||||
spec: volume.NewSpecFromVolume(makeTestVol("test-vol1", testDriver)),
|
||||
podUID: types.UID(fmt.Sprintf("%08X", rand.Uint64())),
|
||||
namespace: "test-ns2",
|
||||
volumeLifecycleMode: storagev1beta1.VolumeLifecycleEphemeral,
|
||||
volumeLifecycleMode: storagev1.VolumeLifecycleEphemeral,
|
||||
},
|
||||
}
|
||||
|
||||
runAll := func(t *testing.T, supported []storagev1beta1.VolumeLifecycleMode) {
|
||||
runAll := func(t *testing.T, supported []storagev1.VolumeLifecycleMode) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
driver := getTestCSIDriver(testDriver, nil, nil, supported)
|
||||
@ -907,7 +905,6 @@ func TestPluginNewDetacher(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginCanAttach(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, true)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
|
||||
tests := []struct {
|
||||
name string
|
||||
@ -1020,7 +1017,7 @@ func TestPluginFindAttachablePlugin(t *testing.T) {
|
||||
client,
|
||||
ProbeVolumePlugins(),
|
||||
"fakeNode",
|
||||
factory.Storage().V1beta1().CSIDrivers().Lister(),
|
||||
factory.Storage().V1().CSIDrivers().Lister(),
|
||||
)
|
||||
|
||||
plugMgr := host.GetPluginMgr()
|
||||
|
@ -27,7 +27,6 @@ import (
|
||||
api "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
storagebeta1 "k8s.io/api/storage/v1beta1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -58,7 +57,7 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
podFunc func() *api.Pod
|
||||
isInline bool
|
||||
shouldFail bool
|
||||
driverSpec *storagebeta1.CSIDriverSpec
|
||||
driverSpec *storage.CSIDriverSpec
|
||||
}{
|
||||
{
|
||||
name: "PersistentVolume",
|
||||
@ -85,9 +84,9 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
podUID := types.UID(fmt.Sprintf("%08X", rand.Uint64()))
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// Required for the driver to be accepted for the persistent volume.
|
||||
VolumeLifecycleModes: []storagebeta1.VolumeLifecycleMode{storagebeta1.VolumeLifecyclePersistent},
|
||||
VolumeLifecycleModes: []storage.VolumeLifecycleMode{storage.VolumeLifecyclePersistent},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -102,9 +101,9 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
podUID := types.UID(fmt.Sprintf("%08X", rand.Uint64()))
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// This will cause the volume to be rejected.
|
||||
VolumeLifecycleModes: []storagebeta1.VolumeLifecycleMode{storagebeta1.VolumeLifecycleEphemeral},
|
||||
VolumeLifecycleModes: []storage.VolumeLifecycleMode{storage.VolumeLifecycleEphemeral},
|
||||
},
|
||||
shouldFail: true,
|
||||
},
|
||||
@ -120,9 +119,9 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
isInline: true,
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// Required for the driver to be accepted for the inline volume.
|
||||
VolumeLifecycleModes: []storagebeta1.VolumeLifecycleMode{storagebeta1.VolumeLifecycleEphemeral},
|
||||
VolumeLifecycleModes: []storage.VolumeLifecycleMode{storage.VolumeLifecycleEphemeral},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -137,9 +136,9 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
isInline: true,
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// Required for the driver to be accepted for the inline volume.
|
||||
VolumeLifecycleModes: []storagebeta1.VolumeLifecycleMode{storagebeta1.VolumeLifecyclePersistent, storagebeta1.VolumeLifecycleEphemeral},
|
||||
VolumeLifecycleModes: []storage.VolumeLifecycleMode{storage.VolumeLifecyclePersistent, storage.VolumeLifecycleEphemeral},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -167,7 +166,7 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
isInline: true,
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// This means the driver *cannot* handle the inline volume because
|
||||
// the default is "persistent".
|
||||
VolumeLifecycleModes: nil,
|
||||
@ -185,9 +184,9 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
return &api.Pod{ObjectMeta: meta.ObjectMeta{UID: podUID, Namespace: testns}}
|
||||
},
|
||||
isInline: true,
|
||||
driverSpec: &storagebeta1.CSIDriverSpec{
|
||||
driverSpec: &storage.CSIDriverSpec{
|
||||
// This means the driver *cannot* handle the inline volume.
|
||||
VolumeLifecycleModes: []storagebeta1.VolumeLifecycleMode{storagebeta1.VolumeLifecyclePersistent},
|
||||
VolumeLifecycleModes: []storage.VolumeLifecycleMode{storage.VolumeLifecyclePersistent},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -228,10 +227,10 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
var driverInfo *storagebeta1.CSIDriver
|
||||
var driverInfo *storage.CSIDriver
|
||||
objs := []runtime.Object{}
|
||||
if test.driverSpec != nil {
|
||||
driverInfo = &storagebeta1.CSIDriver{
|
||||
driverInfo = &storage.CSIDriver{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: test.driver,
|
||||
},
|
||||
@ -250,7 +249,7 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
fakeWatcher := watch.NewRaceFreeFake()
|
||||
|
||||
factory := informers.NewSharedInformerFactory(client, time.Hour /* disable resync */)
|
||||
csiDriverInformer := factory.Storage().V1beta1().CSIDrivers()
|
||||
csiDriverInformer := factory.Storage().V1().CSIDrivers()
|
||||
if driverInfo != nil {
|
||||
csiDriverInformer.Informer().GetStore().Add(driverInfo)
|
||||
}
|
||||
@ -383,7 +382,7 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
}
|
||||
|
||||
mounter, err := volPlug.NewMounter(volSpec, pod, volume.VolumeOptions{})
|
||||
if test.isInline && (test.driverSpec == nil || !containsVolumeMode(test.driverSpec.VolumeLifecycleModes, storagebeta1.VolumeLifecycleEphemeral)) {
|
||||
if test.isInline && (test.driverSpec == nil || !containsVolumeMode(test.driverSpec.VolumeLifecycleModes, storage.VolumeLifecycleEphemeral)) {
|
||||
// This *must* fail because a CSIDriver.Spec.VolumeLifecycleModes entry "ephemeral"
|
||||
// is required.
|
||||
if err == nil || mounter != nil {
|
||||
@ -391,7 +390,7 @@ func TestCSI_VolumeAll(t *testing.T) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if !test.isInline && test.driverSpec != nil && !containsVolumeMode(test.driverSpec.VolumeLifecycleModes, storagebeta1.VolumeLifecyclePersistent) {
|
||||
if !test.isInline && test.driverSpec != nil && !containsVolumeMode(test.driverSpec.VolumeLifecycleModes, storage.VolumeLifecyclePersistent) {
|
||||
// This *must* fail because a CSIDriver.Spec.VolumeLifecycleModes entry "persistent"
|
||||
// is required when a driver object is available.
|
||||
if err == nil || mounter != nil {
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"testing"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog"
|
||||
@ -84,12 +84,12 @@ func makeTestVol(name string, driverName string) *api.Volume {
|
||||
}
|
||||
}
|
||||
|
||||
func getTestCSIDriver(name string, podInfoMount *bool, attachable *bool, volumeLifecycleModes []storagev1beta1.VolumeLifecycleMode) *storagev1beta1.CSIDriver {
|
||||
return &storagev1beta1.CSIDriver{
|
||||
func getTestCSIDriver(name string, podInfoMount *bool, attachable *bool, volumeLifecycleModes []storagev1.VolumeLifecycleMode) *storagev1.CSIDriver {
|
||||
return &storagev1.CSIDriver{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: storagev1beta1.CSIDriverSpec{
|
||||
Spec: storagev1.CSIDriverSpec{
|
||||
PodInfoOnMount: podInfoMount,
|
||||
AttachRequired: attachable,
|
||||
VolumeLifecycleModes: volumeLifecycleModes,
|
||||
|
@ -6,14 +6,12 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/pkg/volume/csi/testing",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/features:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//pkg/volume/csi:go_default_library",
|
||||
"//pkg/volume/testing:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||
|
@ -22,11 +22,9 @@ import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
fakeclient "k8s.io/client-go/kubernetes/fake"
|
||||
utiltesting "k8s.io/client-go/util/testing"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/csi"
|
||||
volumetest "k8s.io/kubernetes/pkg/volume/testing"
|
||||
@ -52,7 +50,7 @@ func NewTestPlugin(t *testing.T, client *fakeclient.Clientset) (*volume.VolumePl
|
||||
|
||||
// Start informer for CSIDrivers.
|
||||
factory := informers.NewSharedInformerFactory(client, csi.CsiResyncPeriod)
|
||||
csiDriverInformer := factory.Storage().V1beta1().CSIDrivers()
|
||||
csiDriverInformer := factory.Storage().V1().CSIDrivers()
|
||||
csiDriverLister := csiDriverInformer.Lister()
|
||||
go factory.Start(wait.NeverStop)
|
||||
|
||||
@ -70,12 +68,10 @@ func NewTestPlugin(t *testing.T, client *fakeclient.Clientset) (*volume.VolumePl
|
||||
t.Fatalf("can't find plugin %v", csi.CSIPluginName)
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(csi.TestInformerSyncPeriod, csi.TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
}
|
||||
// Wait until the informer in CSI volume plugin has all CSIDrivers.
|
||||
wait.PollImmediate(csi.TestInformerSyncPeriod, csi.TestInformerSyncTimeout, func() (bool, error) {
|
||||
return csiDriverInformer.Informer().HasSynced(), nil
|
||||
})
|
||||
|
||||
return plugMgr, &plug, tmpDir
|
||||
}
|
||||
|
@ -33,15 +33,12 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
storagelistersv1 "k8s.io/client-go/listers/storage/v1"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1beta1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/volume/util/hostutil"
|
||||
"k8s.io/kubernetes/pkg/volume/util/recyclerclient"
|
||||
"k8s.io/kubernetes/pkg/volume/util/subpath"
|
||||
@ -336,7 +333,7 @@ type KubeletVolumeHost interface {
|
||||
// GetInformerFactory returns the informer factory for CSIDriverLister
|
||||
GetInformerFactory() informers.SharedInformerFactory
|
||||
// CSIDriverLister returns the informer lister for the CSIDriver API Object
|
||||
CSIDriverLister() storagelisters.CSIDriverLister
|
||||
CSIDriverLister() storagelistersv1.CSIDriverLister
|
||||
// CSIDriverSynced returns the informer synced for the CSIDriver API Object
|
||||
CSIDriversSynced() cache.InformerSynced
|
||||
// WaitForCacheSync is a helper function that waits for cache sync for CSIDriverLister
|
||||
@ -352,7 +349,7 @@ type AttachDetachVolumeHost interface {
|
||||
CSINodeLister() storagelistersv1.CSINodeLister
|
||||
|
||||
// CSIDriverLister returns the informer lister for the CSIDriver API Object
|
||||
CSIDriverLister() storagelisters.CSIDriverLister
|
||||
CSIDriverLister() storagelistersv1.CSIDriverLister
|
||||
|
||||
// IsAttachDetachController is an interface marker to strictly tie AttachDetachVolumeHost
|
||||
// to the attachDetachController
|
||||
@ -1019,10 +1016,8 @@ func (pm *VolumePluginMgr) Run(stopCh <-chan struct{}) {
|
||||
kletHost, ok := pm.Host.(KubeletVolumeHost)
|
||||
if ok {
|
||||
// start informer for CSIDriver
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
informerFactory := kletHost.GetInformerFactory()
|
||||
informerFactory.Start(stopCh)
|
||||
}
|
||||
informerFactory := kletHost.GetInformerFactory()
|
||||
informerFactory.Start(stopCh)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ go_library(
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||
|
@ -42,7 +42,6 @@ import (
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
storagelistersv1 "k8s.io/client-go/listers/storage/v1"
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1beta1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
utiltesting "k8s.io/client-go/util/testing"
|
||||
@ -111,7 +110,7 @@ type fakeVolumeHost struct {
|
||||
nodeLabels map[string]string
|
||||
nodeName string
|
||||
subpather subpath.Interface
|
||||
csiDriverLister storagelisters.CSIDriverLister
|
||||
csiDriverLister storagelistersv1.CSIDriverLister
|
||||
informerFactory informers.SharedInformerFactory
|
||||
kubeletErr error
|
||||
mux sync.Mutex
|
||||
@ -134,7 +133,7 @@ func NewFakeVolumeHostWithNodeLabels(t *testing.T, rootDir string, kubeClient cl
|
||||
return volHost
|
||||
}
|
||||
|
||||
func NewFakeVolumeHostWithCSINodeName(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string, driverLister storagelisters.CSIDriverLister) *fakeVolumeHost {
|
||||
func NewFakeVolumeHostWithCSINodeName(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string, driverLister storagelistersv1.CSIDriverLister) *fakeVolumeHost {
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, nodeName, driverLister)
|
||||
}
|
||||
|
||||
@ -142,7 +141,7 @@ func NewFakeVolumeHostWithMounterFSType(t *testing.T, rootDir string, kubeClient
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, pathToTypeMap, "", nil)
|
||||
}
|
||||
|
||||
func newFakeVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelisters.CSIDriverLister) *fakeVolumeHost {
|
||||
func newFakeVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister) *fakeVolumeHost {
|
||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: cloud, nodeName: nodeName, csiDriverLister: driverLister}
|
||||
host.mounter = mount.NewFakeMounter(nil)
|
||||
host.hostUtil = hostutil.NewFakeHostUtil(pathToTypeMap)
|
||||
@ -1837,7 +1836,7 @@ func ContainsAccessMode(modes []v1.PersistentVolumeAccessMode, mode v1.Persisten
|
||||
return false
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) CSIDriverLister() storagelisters.CSIDriverLister {
|
||||
func (f *fakeVolumeHost) CSIDriverLister() storagelistersv1.CSIDriverLister {
|
||||
return f.csiDriverLister
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,7 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
|
||||
},
|
||||
}
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
role.Rules = append(role.Rules, rbacv1helpers.NewRule("get", "watch", "list").Groups("storage.k8s.io").Resources("csidrivers").RuleOrDie())
|
||||
}
|
||||
role.Rules = append(role.Rules, rbacv1helpers.NewRule("get", "watch", "list").Groups("storage.k8s.io").Resources("csidrivers").RuleOrDie())
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSINodeInfo) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) {
|
||||
role.Rules = append(role.Rules, rbacv1helpers.NewRule("get", "watch", "list").Groups("storage.k8s.io").Resources("csinodes").RuleOrDie())
|
||||
}
|
||||
|
@ -169,10 +169,8 @@ func NodeRules() []rbacv1.PolicyRule {
|
||||
}
|
||||
|
||||
// CSI
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
csiDriverRule := rbacv1helpers.NewRule("get", "watch", "list").Groups("storage.k8s.io").Resources("csidrivers").RuleOrDie()
|
||||
nodePolicyRules = append(nodePolicyRules, csiDriverRule)
|
||||
}
|
||||
csiDriverRule := rbacv1helpers.NewRule("get", "watch", "list").Groups("storage.k8s.io").Resources("csidrivers").RuleOrDie()
|
||||
nodePolicyRules = append(nodePolicyRules, csiDriverRule)
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSINodeInfo) {
|
||||
csiNodeInfoRule := rbacv1helpers.NewRule("get", "create", "update", "patch", "delete").Groups("storage.k8s.io").Resources("csinodes").RuleOrDie()
|
||||
nodePolicyRules = append(nodePolicyRules, csiNodeInfoRule)
|
||||
|
@ -114,6 +114,7 @@ message CSIDriverSpec {
|
||||
// https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html
|
||||
// A driver can support one or more of these modes and
|
||||
// more modes may be added in the future.
|
||||
// This field is beta.
|
||||
// +optional
|
||||
// +listType=set
|
||||
repeated string volumeLifecycleModes = 3;
|
||||
|
@ -312,6 +312,7 @@ type CSIDriverSpec struct {
|
||||
// https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html
|
||||
// A driver can support one or more of these modes and
|
||||
// more modes may be added in the future.
|
||||
// This field is beta.
|
||||
// +optional
|
||||
// +listType=set
|
||||
VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"`
|
||||
|
@ -51,7 +51,7 @@ var map_CSIDriverSpec = map[string]string{
|
||||
"": "CSIDriverSpec is the specification of a CSIDriver.",
|
||||
"attachRequired": "attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.",
|
||||
"podInfoOnMount": "If set to true, podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeConext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" iff the volume is an ephemeral inline volume\n defined by a CSIVolumeSource, otherwise \"false\"\n\n\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver.",
|
||||
"volumeLifecycleModes": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.",
|
||||
"volumeLifecycleModes": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta.",
|
||||
}
|
||||
|
||||
func (CSIDriverSpec) SwaggerDoc() map[string]string {
|
||||
|
@ -773,7 +773,7 @@ func waitForCSIDriver(cs clientset.Interface, driverName string) error {
|
||||
|
||||
framework.Logf("waiting up to %v for CSIDriver %q", timeout, driverName)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(framework.Poll) {
|
||||
_, err := cs.StorageV1beta1().CSIDrivers().Get(context.TODO(), driverName, metav1.GetOptions{})
|
||||
_, err := cs.StorageV1().CSIDrivers().Get(context.TODO(), driverName, metav1.GetOptions{})
|
||||
if !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
@ -782,12 +782,12 @@ func waitForCSIDriver(cs clientset.Interface, driverName string) error {
|
||||
}
|
||||
|
||||
func destroyCSIDriver(cs clientset.Interface, driverName string) {
|
||||
driverGet, err := cs.StorageV1beta1().CSIDrivers().Get(context.TODO(), driverName, metav1.GetOptions{})
|
||||
driverGet, err := cs.StorageV1().CSIDrivers().Get(context.TODO(), driverName, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
framework.Logf("deleting %s.%s: %s", driverGet.TypeMeta.APIVersion, driverGet.TypeMeta.Kind, driverGet.ObjectMeta.Name)
|
||||
// Uncomment the following line to get full dump of CSIDriver object
|
||||
// framework.Logf("%s", framework.PrettyPrint(driverGet))
|
||||
cs.StorageV1beta1().CSIDrivers().Delete(context.TODO(), driverName, metav1.DeleteOptions{})
|
||||
cs.StorageV1().CSIDrivers().Delete(context.TODO(), driverName, metav1.DeleteOptions{})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ go_library(
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
|
||||
|
@ -44,7 +44,6 @@ import (
|
||||
"github.com/onsi/ginkgo"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@ -328,9 +327,9 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
|
||||
NodeName: node.Name,
|
||||
PodInfo: m.podInfo,
|
||||
CanAttach: &m.attachable,
|
||||
VolumeLifecycleModes: &[]storagev1beta1.VolumeLifecycleMode{
|
||||
storagev1beta1.VolumeLifecyclePersistent,
|
||||
storagev1beta1.VolumeLifecycleEphemeral,
|
||||
VolumeLifecycleModes: &[]storagev1.VolumeLifecycleMode{
|
||||
storagev1.VolumeLifecyclePersistent,
|
||||
storagev1.VolumeLifecycleEphemeral,
|
||||
},
|
||||
}
|
||||
cleanup, err := utils.CreateFromManifests(f, func(item interface{}) error {
|
||||
|
@ -18,7 +18,6 @@ go_library(
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@ -29,7 +30,6 @@ import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -331,7 +331,7 @@ func patchItemRecursively(f *framework.Framework, item interface{}) error {
|
||||
PatchName(f, &item.Name)
|
||||
case *storagev1.StorageClass:
|
||||
PatchName(f, &item.Name)
|
||||
case *storagev1beta1.CSIDriver:
|
||||
case *storagev1.CSIDriver:
|
||||
PatchName(f, &item.Name)
|
||||
case *v1.ServiceAccount:
|
||||
PatchNamespace(f, &item.ObjectMeta.Namespace)
|
||||
@ -578,16 +578,16 @@ func (*storageClassFactory) Create(f *framework.Framework, i interface{}) (func(
|
||||
type csiDriverFactory struct{}
|
||||
|
||||
func (f *csiDriverFactory) New() runtime.Object {
|
||||
return &storagev1beta1.CSIDriver{}
|
||||
return &storagev1.CSIDriver{}
|
||||
}
|
||||
|
||||
func (*csiDriverFactory) Create(f *framework.Framework, i interface{}) (func() error, error) {
|
||||
item, ok := i.(*storagev1beta1.CSIDriver)
|
||||
item, ok := i.(*storagev1.CSIDriver)
|
||||
if !ok {
|
||||
return nil, errorItemNotSupported
|
||||
}
|
||||
|
||||
client := f.ClientSet.StorageV1beta1().CSIDrivers()
|
||||
client := f.ClientSet.StorageV1().CSIDrivers()
|
||||
if _, err := client.Create(context.TODO(), item, metav1.CreateOptions{}); err != nil {
|
||||
return nil, errors.Wrap(err, "create CSIDriver")
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import (
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
storagev1beta1 "k8s.io/api/storage/v1beta1"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
)
|
||||
@ -118,7 +117,7 @@ func PatchCSIDeployment(f *framework.Framework, o PatchCSIOptions, object interf
|
||||
// as the provisioner name here.
|
||||
object.Provisioner = o.NewDriverName
|
||||
}
|
||||
case *storagev1beta1.CSIDriver:
|
||||
case *storagev1.CSIDriver:
|
||||
if o.NewDriverName != "" {
|
||||
object.Name = o.NewDriverName
|
||||
}
|
||||
@ -173,5 +172,5 @@ type PatchCSIOptions struct {
|
||||
// If not nil, the value to use for the CSIDriver.Spec.VolumeLifecycleModes
|
||||
// field *if* the driver deploys a CSIDriver object. Ignored
|
||||
// otherwise.
|
||||
VolumeLifecycleModes *[]storagev1beta1.VolumeLifecycleMode
|
||||
VolumeLifecycleModes *[]storagev1.VolumeLifecycleMode
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: storage.k8s.io/v1beta1
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: CSIDriver
|
||||
metadata:
|
||||
name: hostpath.csi.k8s.io
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: storage.k8s.io/v1beta1
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: CSIDriver
|
||||
metadata:
|
||||
name: mock.storage.k8s.io
|
||||
|
@ -507,13 +507,18 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
|
||||
}
|
||||
}
|
||||
|
||||
// add csidrivers
|
||||
// k8s.io/kubernetes/pkg/apis/storage/v1beta1
|
||||
// add csidrivers if CSIDriverRegistry feature gate is enabled
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
etcdStorageData[gvr("storage.k8s.io", "v1beta1", "csidrivers")] = StorageData{
|
||||
Stub: `{"metadata": {"name": "csid1"}, "spec": {"attachRequired": true, "podInfoOnMount": true}}`,
|
||||
ExpectedEtcdPath: "/registry/csidrivers/csid1",
|
||||
}
|
||||
etcdStorageData[gvr("storage.k8s.io", "v1beta1", "csidrivers")] = StorageData{
|
||||
Stub: `{"metadata": {"name": "csid1"}, "spec": {"attachRequired": true, "podInfoOnMount": true}}`,
|
||||
ExpectedEtcdPath: "/registry/csidrivers/csid1",
|
||||
}
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/storage/v1
|
||||
// TODO: Remove ExpectedGVK in next release
|
||||
etcdStorageData[gvr("storage.k8s.io", "v1", "csidrivers")] = StorageData{
|
||||
Stub: `{"metadata": {"name": "csid2"}, "spec": {"attachRequired": true, "podInfoOnMount": true}}`,
|
||||
ExpectedEtcdPath: "/registry/csidrivers/csid2",
|
||||
}
|
||||
|
||||
return etcdStorageData
|
||||
|
@ -214,9 +214,7 @@ func initCSIObjects(stopCh chan struct{}, informers clientgoinformers.SharedInfo
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.CSINodeInfo) {
|
||||
go informers.Storage().V1().CSINodes().Informer().Run(stopCh)
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
|
||||
go informers.Storage().V1beta1().CSIDrivers().Informer().Run(stopCh)
|
||||
}
|
||||
go informers.Storage().V1().CSIDrivers().Informer().Run(stopCh)
|
||||
}
|
||||
|
||||
func TestPodUpdateWithWithADC(t *testing.T) {
|
||||
@ -430,7 +428,7 @@ func createAdClients(ns *v1.Namespace, t *testing.T, server *httptest.Server, sy
|
||||
informers.Core().V1().PersistentVolumeClaims(),
|
||||
informers.Core().V1().PersistentVolumes(),
|
||||
informers.Storage().V1().CSINodes(),
|
||||
informers.Storage().V1beta1().CSIDrivers(),
|
||||
informers.Storage().V1().CSIDrivers(),
|
||||
cloud,
|
||||
plugins,
|
||||
nil, /* prober */
|
||||
|
Loading…
Reference in New Issue
Block a user