Introduce new CSINodeInfo CRD API Object

This commit is contained in:
Jan Safranek 2018-08-22 12:24:53 +02:00 committed by saad-ali
parent bed2c39631
commit c3a275252f
3 changed files with 47 additions and 1 deletions

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1alpha1 provides alpha API for CSI API objects.
// +k8s:deepcopy-gen=package,register
// +groupName=csi.storage.k8s.io
// +k8s:openapi-gen=true

View File

@ -34,8 +34,10 @@ func Resource(resource string) schema.GroupResource {
}
var (
// SchemeBuilder collects schemas to build.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
// AddToScheme is used by generated client to add this scheme to the generated client.
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
@ -43,6 +45,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CSIDriver{},
&CSIDriverList{},
&CSINodeInfo{},
&CSINodeInfoList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

View File

@ -74,3 +74,44 @@ type CSIDriverSpec struct {
// +optional
PodInfoRequiredOnMount *bool `json:"podInfoRequiredOnMount"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CSINodeInfo holds information about all CSI drivers installed on a node.
type CSINodeInfo struct {
metav1.TypeMeta `json:",inline"`
// ObjectMeta.Name must be node name.
metav1.ObjectMeta `json:"metadata,omitempty"`
// List of CSI drivers running on the node and their properties.
CSIDrivers []CSIDriverInfo `json:"csiDrivers"`
}
// CSIDriverInfo contains information about one CSI driver installed on a node.
type CSIDriverInfo struct {
// Driver is the name of the CSI driver that this object refers to.
// This MUST be the same name returned by the CSI GetPluginName() call for
// that driver.
Driver string `json:"driver"`
// ID of the node from the driver point of view.
NodeID string `json:"nodeID"`
// Topology keys reported by the driver on the node.
TopologyKeys []string `json:"topologyKeys"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CSINodeInfoList is a collection of CSINodeInfo objects.
type CSINodeInfoList 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 CSINodeInfo
Items []CSINodeInfo `json:"items"`
}