common/api/v1alpha1/disk.go (16 lines of code) (raw):
// Copyright 2021 Google LLC
//
// 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 (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
//+kubebuilder:object:generate=true
// DiskSpec defines the desired state of a disk.
// (the structure is deliberately designed to be flexible, as a slice,
// so that if we change a disk layout for different hosting platforms,
// the model can be also adjusted to reflect that).
type DiskSpec struct {
// Name of a disk.
// +required
Name string `json:"name"`
// Disk size. If not specified, the defaults are: DataDisk:"100Gi", LogDisk:"150Gi",BackupDisk:"100Gi"
// +optional
Size resource.Quantity `json:"size,omitempty"`
// StorageClass points to a particular CSI driver and is used
// for disk provisioning.
// +optional
StorageClass string `json:"storageClass,omitempty"`
// A map of string keys and values to be stored in the annotations of the PVC.
// These can be read and write by external tools through Kubernetes.
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
// VolumeName is the binding reference to the PersistentVolume tied to this disk.
// +optional
VolumeName string `json:"volumeName,omitempty"`
// AccessModes contains the desired access modes the volume should have.
// +optional
AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
// A label query over volumes to consider for binding.
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}
// DiskType is a type that points to the disk type
type DiskType string