Documentation
¶
Index ¶
- Constants
- Variables
- func AddFinalizer(objectMeta *metav1.ObjectMeta, finalizer string) []string
- func BoolToCondition(val bool) metav1.ConditionStatus
- func CreateDrive(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, ...) error
- func DefaultIfZeroString(left, right string) string
- func DeleteDrive(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, ...) error
- func DirectCSIDriveTypeMeta() metav1.TypeMeta
- func DirectCSIVolumeTypeMeta() metav1.TypeMeta
- func Eventf(object runtime.Object, eventType, reason, messageFmt string, ...)
- func ExcludeFinalizer(finalizers []string, finalizer string) (result []string, found bool)
- func FakeInit()
- func FmapString(str string, f func(rune) rune) string
- func FmapStringSlice(vs []string, f func(string) string) []string
- func GetAPIExtensionsClient() apiextensions.ApiextensionsV1Interface
- func GetCRDClient() apiextensions.CustomResourceDefinitionInterface
- func GetClientForNonCoreGroupKindVersions(group, kind string, versions ...string) (rest.Interface, *schema.GroupVersionKind, error)
- func GetDirectCSIClient() directcsi.DirectV1beta3Interface
- func GetDirectClientset() direct.Interface
- func GetDiscoveryClient() discovery.DiscoveryInterface
- func GetDriveList(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, ...) ([]directcsi.DirectCSIDrive, error)
- func GetDrivePath(drive *directcsi.DirectCSIDrive) string
- func GetGroupKindVersions(group, kind string, versions ...string) (*schema.GroupVersionKind, error)
- func GetKubeClient() kubernetes.Interface
- func GetKubeConfig() (*rest.Config, error)
- func GetLabelV(obj metav1.Object, key string) string
- func GetMetadataClient() metadata.Interface
- func GetVolumeList(ctx context.Context, volumeInterface clientset.DirectCSIVolumeInterface, ...) ([]directcsi.DirectCSIVolume, error)
- func Init()
- func IsCondition(statusConditions []metav1.Condition, condType string, ...) bool
- func IsConditionStatus(statusConditions []metav1.Condition, condType string, ...) bool
- func ListDrives(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, ...) (<-chan ListDriveResult, error)
- func ListVolumes(ctx context.Context, volumeInterface clientset.DirectCSIVolumeInterface, ...) (<-chan ListVolumeResult, error)
- func LogYAML(obj interface{}) error
- func MustJSON(obj interface{}) string
- func MustYAML(obj interface{}) string
- func NewDirectCSIDrive(name string, status directcsi.DirectCSIDriveStatus) *directcsi.DirectCSIDrive
- func NewDirectCSIDriveStatus(device *sys.Device, nodeID string, topology map[string]string) directcsi.DirectCSIDriveStatus
- func NewDirectCSILabel(key string) string
- func NewIdentityTopologySelector(identity string) corev1.TopologySelectorTerm
- func NewObjectMeta(name string, namespace string, labels map[string]string, ...) metav1.ObjectMeta
- func NewTypeMeta(groupVersion, resource string) metav1.TypeMeta
- func ParseSingleKubeNativeFromBytes(data []byte) (runtime.Object, error)
- func RemoveFinalizer(objectMeta *metav1.ObjectMeta, finalizer string) []string
- func SanitizeDrivePath(in string) string
- func SanitizeKubeResourceName(name string) string
- func SanitizeLabelK(key string) string
- func SanitizeLabelV(value string) string
- func SetAccessTierLabel(obj metav1.Object, accessTier directcsi.AccessTier)
- func SetDirectCSIClient(fakeClient *directcsifake.FakeDirectV1beta3)
- func SetLabelKV(obj metav1.Object, key, value string)
- func ToJSON(obj interface{}) (string, error)
- func ToYAML(obj interface{}) (string, error)
- func UpdateCondition(statusConditions []metav1.Condition, condType string, ...)
- func UpdateLabels(obj metav1.Object, labelKVs ...string)
- func WriteObject(writer io.Writer, obj interface{}) error
- type LabelValue
- type ListDriveResult
- type ListVolumeResult
- type SafeFile
Constants ¶
const ( TopologyDriverIdentity = "direct.csi.min.io/identity" TopologyDriverNode = "direct.csi.min.io/node" TopologyDriverRack = "direct.csi.min.io/rack" TopologyDriverZone = "direct.csi.min.io/zone" TopologyDriverRegion = "direct.csi.min.io/region" )
Topology keys.
const ( // DEL character i.e. 127 or \u007f. DEL rune = 127 )
const MaxThreadCount = 200
MaxThreadCount is maximum thread count.
Variables ¶
var ( Bold = color.New(color.Bold).SprintFunc() Red = color.New(color.FgRed).SprintFunc() )
Color print functions.
var ( PodNameLabel = NewDirectCSILabel("pod.name") PodNamespaceLabel = NewDirectCSILabel("pod.namespace") NodeLabel = NewDirectCSILabel("node") DriveLabel = NewDirectCSILabel("drive") DrivePathLabel = NewDirectCSILabel("path") AccessTierLabel = NewDirectCSILabel("access-tier") VersionLabel = NewDirectCSILabel("version") CreatedByLabel = NewDirectCSILabel("created-by") ReservedDrivePathLabel = NewDirectCSILabel("drive-path") DirectCSIGroupVersion = SanitizeLabelK(directcsi.Group + "/" + directcsi.Version) )
Various direct-csi labels.
var AddToScheme = localSchemeBuilder.AddToScheme
AddToScheme adds all types of this clientset into the given scheme. This allows composition of clientsets, like in:
import ( "k8s.io/client-go/kubernetes" clientsetscheme "k8s.io/client-go/kubernetes/scheme" aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" ) kclientset, _ := kubernetes.NewForConfig(c) _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
After this, RawExtensions in Kubernetes types will serialize kube-aggregator types correctly.
var Codecs = serializer.NewCodecFactory(Scheme)
Codecs is new codec of new runtime scheme.
var ParameterCodec = runtime.NewParameterCodec(Scheme)
ParameterCodec is new parameter codec of new runtime scheme.
var Scheme = runtime.NewScheme()
Scheme is new runtime scheme.
Functions ¶
func AddFinalizer ¶
func AddFinalizer(objectMeta *metav1.ObjectMeta, finalizer string) []string
AddFinalizer adds finalizer in object meta.
func BoolToCondition ¶
func BoolToCondition(val bool) metav1.ConditionStatus
BoolToCondition converts boolean value to condition status.
func CreateDrive ¶ added in v1.4.4
func CreateDrive(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, drive *directcsi.DirectCSIDrive) error
CreateDrive creates drive CRD.
func DefaultIfZeroString ¶ added in v1.4.0
DefaultIfZeroString returns string which is non empty of left or right.
func DeleteDrive ¶ added in v1.4.4
func DeleteDrive(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, drive *directcsi.DirectCSIDrive, force bool) error
DeleteDrive deletes drive CRD.
func DirectCSIDriveTypeMeta ¶ added in v1.3.0
DirectCSIDriveTypeMeta gets new direct-csi drive meta.
func DirectCSIVolumeTypeMeta ¶ added in v1.3.0
DirectCSIVolumeTypeMeta gets new direct-csi volume meta.
func ExcludeFinalizer ¶ added in v1.4.2
ExcludeFinalizer returns finalizers excluding given finalizer.
func FmapString ¶ added in v1.4.0
FmapString applies function on each rune in string.
func FmapStringSlice ¶ added in v1.4.0
FmapStringSlice applies function on each value in slice.
func GetAPIExtensionsClient ¶ added in v1.1.0
func GetAPIExtensionsClient() apiextensions.ApiextensionsV1Interface
GetAPIExtensionsClient gets API extension client.
func GetCRDClient ¶
func GetCRDClient() apiextensions.CustomResourceDefinitionInterface
GetCRDClient gets CRD client.
func GetClientForNonCoreGroupKindVersions ¶
func GetClientForNonCoreGroupKindVersions(group, kind string, versions ...string) (rest.Interface, *schema.GroupVersionKind, error)
GetClientForNonCoreGroupKindVersions gets client for group/kind of given versions.
func GetDirectCSIClient ¶
func GetDirectCSIClient() directcsi.DirectV1beta3Interface
GetDirectCSIClient gets direct-csi client.
func GetDirectClientset ¶
GetDirectClientset gets direct-csi clientset.
func GetDiscoveryClient ¶
func GetDiscoveryClient() discovery.DiscoveryInterface
GetDiscoveryClient gets discovery client.
func GetDriveList ¶ added in v1.4.2
func GetDriveList(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, nodes, drives, accessTiers []LabelValue) ([]directcsi.DirectCSIDrive, error)
GetDriveList gets list of drives.
func GetDrivePath ¶ added in v1.4.4
func GetDrivePath(drive *directcsi.DirectCSIDrive) string
GetDrivePath gets sanitized drive path.
func GetGroupKindVersions ¶
func GetGroupKindVersions(group, kind string, versions ...string) (*schema.GroupVersionKind, error)
GetGroupKindVersions gets group/version/kind of given versions.
func GetKubeConfig ¶
GetKubeConfig gets kubernetes configuration.
func GetMetadataClient ¶
GetMetadataClient gets metadata client.
func GetVolumeList ¶ added in v1.4.2
func GetVolumeList(ctx context.Context, volumeInterface clientset.DirectCSIVolumeInterface, nodes, drives, podNames, podNss []LabelValue) ([]directcsi.DirectCSIVolume, error)
GetVolumeList gets list of volumes.
func IsCondition ¶ added in v1.2.8
func IsCondition(statusConditions []metav1.Condition, condType string, condStatus metav1.ConditionStatus, reason, msg string) bool
IsCondition checks type/status/reason/message in conditions.
func IsConditionStatus ¶ added in v1.2.8
func IsConditionStatus(statusConditions []metav1.Condition, condType string, condStatus metav1.ConditionStatus) bool
IsConditionStatus checks type/status in conditions.
func ListDrives ¶ added in v1.4.2
func ListDrives(ctx context.Context, driveInterface clientset.DirectCSIDriveInterface, nodes, drives, accessTiers []LabelValue, maxObjects int64) (<-chan ListDriveResult, error)
ListDrives lists direct-csi drives.
func ListVolumes ¶ added in v1.4.2
func ListVolumes(ctx context.Context, volumeInterface clientset.DirectCSIVolumeInterface, nodes, drives, podNames, podNss []LabelValue, maxObjects int64) (<-chan ListVolumeResult, error)
ListVolumes lists direct-csi volumes.
func LogYAML ¶ added in v1.2.1
func LogYAML(obj interface{}) error
LogYAML prints value as YAML string to standard output.
func MustJSON ¶ added in v1.4.0
func MustJSON(obj interface{}) string
MustJSON converts given value to JSON string.
func MustYAML ¶ added in v1.4.0
func MustYAML(obj interface{}) string
MustYAML converts value to YAML string.
func NewDirectCSIDrive ¶ added in v1.4.4
func NewDirectCSIDrive(name string, status directcsi.DirectCSIDriveStatus) *directcsi.DirectCSIDrive
NewDirectCSIDrive creates new direct-csi drive.
func NewDirectCSIDriveStatus ¶ added in v1.4.4
func NewDirectCSIDriveStatus(device *sys.Device, nodeID string, topology map[string]string) directcsi.DirectCSIDriveStatus
NewDirectCSIDriveStatus creates direct CSI drive status.
func NewDirectCSILabel ¶ added in v1.4.0
NewDirectCSILabel creates direct-csi label of a key.
func NewIdentityTopologySelector ¶ added in v1.4.0
func NewIdentityTopologySelector(identity string) corev1.TopologySelectorTerm
NewIdentityTopologySelector creates identity topology selector.
func NewObjectMeta ¶ added in v1.4.0
func NewObjectMeta( name string, namespace string, labels map[string]string, annotations map[string]string, finalizers []string, ownerRefs []metav1.OwnerReference, ) metav1.ObjectMeta
NewObjectMeta - creates a new ObjectMeta with sanitized fields
func NewTypeMeta ¶ added in v1.4.0
NewTypeMeta - creates a new TypeMeta upcoming:
- verify API group/version/kind
- verify that kubernetes backend support group/version/kind (use discovery client)
func ParseSingleKubeNativeFromBytes ¶ added in v1.1.0
ParseSingleKubeNativeFromBytes parses YAML byte data to runtime object.
func RemoveFinalizer ¶
func RemoveFinalizer(objectMeta *metav1.ObjectMeta, finalizer string) []string
RemoveFinalizer removes finalizer in object meta.
func SanitizeDrivePath ¶ added in v1.4.0
SanitizeDrivePath sanitizes drive path.
func SanitizeKubeResourceName ¶ added in v1.4.0
SanitizeKubeResourceName - Sanitize given name to a valid kubernetes name format. RegEx for a kubernetes name is
([a-z0-9][-a-z0-9]*)?[a-z0-9]
with a max length of 253
WARNING: This function will truncate to 253 bytes if the input is longer
func SanitizeLabelK ¶ added in v1.4.0
SanitizeLabelK - Sanitize given label key to valid kubernetes label format. RegEx for label key is
([A-Za-z0-9][-A-Za-z0-9_.]*[/]?[-A-Za-z0-9_.]*)?[A-Za-z0-9]
with a max length of 63
WARNING: This function will truncate to 63 bytes if the input is longer
func SanitizeLabelV ¶ added in v1.4.0
SanitizeLabelV - Sanitize given label value to valid kubernetes label format. RegEx for label value is
([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]
with a max length of 63
WARNING: This function will truncate to 63 bytes if the input is longer
func SetAccessTierLabel ¶ added in v1.4.0
func SetAccessTierLabel(obj metav1.Object, accessTier directcsi.AccessTier)
SetAccessTierLabel sets access tier label in object.
func SetDirectCSIClient ¶ added in v1.4.1
func SetDirectCSIClient(fakeClient *directcsifake.FakeDirectV1beta3)
SetDirectCSIClient sets fake direct-csi client.
func SetLabelKV ¶ added in v1.4.0
SetLabelKV sets label key/value in given object.
func UpdateCondition ¶ added in v1.2.8
func UpdateCondition(statusConditions []metav1.Condition, condType string, condStatus metav1.ConditionStatus, reason, msg string)
UpdateCondition updates conditions of type/status/reason/message.
func UpdateLabels ¶ added in v1.4.0
UpdateLabels updates labels in object.
func WriteObject ¶ added in v1.4.4
Types ¶
type LabelValue ¶ added in v1.4.4
type LabelValue string
func AccessTiersToLabelValues ¶ added in v1.4.4
func AccessTiersToLabelValues(accessTiers []directcsi.AccessTier) (labelValues []LabelValue)
func NewLabelValue ¶ added in v1.4.4
func NewLabelValue(value string) (LabelValue, error)
func ToLabelValues ¶ added in v1.4.4
func ToLabelValues(vs []string) (labelValues []LabelValue, err error)
type ListDriveResult ¶ added in v1.4.2
type ListDriveResult struct {
Drive directcsi.DirectCSIDrive
Err error
}
ListDriveResult denotes list of drive result.
type ListVolumeResult ¶ added in v1.4.2
type ListVolumeResult struct {
Volume directcsi.DirectCSIVolume
Err error
}
ListVolumeResult denotes list of volume result.
type SafeFile ¶ added in v1.4.4
type SafeFile struct {
// contains filtered or unexported fields
}