-
Notifications
You must be signed in to change notification settings - Fork 39k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSI Cluster Registry and Node Info CRDs #67803
Changes from 1 commit
5ceb26d
bed2c39
c3a2752
c8ff210
7d673cb
fdeb895
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"doc.go", | ||
"register.go", | ||
"types.go", | ||
], | ||
importmap = "k8s.io/kubernetes/vendor/k8s.io/csi-api/pkg/apis/csi/v1alpha1", | ||
importpath = "k8s.io/csi-api/pkg/apis/csi/v1alpha1", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", | ||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +k8s:deepcopy-gen=package,register | ||
// +groupName=csi.storage.k8s.io | ||
// +k8s:openapi-gen=true | ||
package v1alpha1 // import "k8s.io/csi-api/pkg/apis/csi/v1alpha1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// GroupName is the group name use in this package | ||
const GroupName = "csi.storage.k8s.io" | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to the given scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&CSIDriver{}, | ||
&CSIDriverList{}, | ||
) | ||
|
||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// CSIDriver captures information about a Container Storage Interface (CSI) | ||
// volume driver deployed on the cluster. | ||
// CSIDriver objects are non-namespaced. | ||
type CSIDriver struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// 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. | ||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Specification of the CSI Driver. | ||
Spec CSIDriverSpec `json:"spec"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// CSIDriverList is a collection of CSIDriver objects. | ||
type CSIDriverList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// Standard list metadata | ||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata | ||
// +optional | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
// Items is the list of CSIDriver | ||
Items []CSIDriver `json:"items"` | ||
} | ||
|
||
// CSIDriverSpec is the specification of a CSIDriver. | ||
type CSIDriverSpec struct { | ||
// Indicates this CSI volume driver requires an attach operation (because it | ||
// implements the CSI ControllerPublishVolume() method), and that Kubernetes | ||
// should call attach and wait for any attach operation to complete before | ||
// proceeding to mounting. | ||
// If value is not specified, default is false -- meaning attach will not be | ||
// called. | ||
// +optional | ||
AttachRequired *bool `json:"attachRequired"` | ||
|
||
// Indicates this CSI volume driver requires additional pod information | ||
// (like podName, podUID, etc.) during mount operations. | ||
// If this is set to true, Kubelet will pass pod information as | ||
// VolumeAttributes in the CSI NodePublishVolume() calls. | ||
// If value is not specified, default is false -- meaning pod information | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would we not pass this always? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Backwards compatibility" and "ability to detect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My question was why this is an option at all - under what circumstances would you not want that info? I mean, some might not need it, but why not pass it anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently all plugins are supposed to validate every volume attribute and error on attributes they don't recognize. This could break plugins when we upgrade Kubernetes independently of the plugin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to @msau42. These parameters are not part of the CSI spec. Most plugins won't use them. The plugins that need them must opt-in to this behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blech, can we fix CSI to be less brittle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds like this should be a version counter that controls the format of the data passed, not a true/false field? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We looked in to adding workload info into CSI. The challange is that CSI is agnostic to the CO (has to work with Kubernetes, Mesos, and others). So Kubernetes specific pod information can't be encoded in to the spec. But we'd still like to be able to have CSI drivers that want this Kube specific info to be able to receive it. And this is a relatively clean way to do so (leaves CSI spec agnostic, and allows individual drivers to choose not to be). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's a good idea. Changed this from a boolean to a version counter: |
||
// will not be passed on mount. | ||
// +optional | ||
PodInfoRequiredOnMount *bool `json:"podInfoRequiredOnMount"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank line to prevent this from being a godoc package comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.