...
1
2
3
4
19
20
21
22 package v1alpha1
23
24 import (
25 v1alpha1 "k8s.io/api/storage/v1alpha1"
26 runtime "k8s.io/apimachinery/pkg/runtime"
27 v1 "k8s.io/kubernetes/pkg/apis/core/v1"
28 )
29
30
31
32
33 func RegisterDefaults(scheme *runtime.Scheme) error {
34 scheme.AddTypeDefaultingFunc(&v1alpha1.VolumeAttachment{}, func(obj interface{}) { SetObjectDefaults_VolumeAttachment(obj.(*v1alpha1.VolumeAttachment)) })
35 scheme.AddTypeDefaultingFunc(&v1alpha1.VolumeAttachmentList{}, func(obj interface{}) { SetObjectDefaults_VolumeAttachmentList(obj.(*v1alpha1.VolumeAttachmentList)) })
36 return nil
37 }
38
39 func SetObjectDefaults_VolumeAttachment(in *v1alpha1.VolumeAttachment) {
40 if in.Spec.Source.InlineVolumeSpec != nil {
41 v1.SetDefaults_ResourceList(&in.Spec.Source.InlineVolumeSpec.Capacity)
42 if in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.HostPath != nil {
43 v1.SetDefaults_HostPathVolumeSource(in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.HostPath)
44 }
45 if in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.RBD != nil {
46 v1.SetDefaults_RBDPersistentVolumeSource(in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.RBD)
47 }
48 if in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.ISCSI != nil {
49 v1.SetDefaults_ISCSIPersistentVolumeSource(in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.ISCSI)
50 }
51 if in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.AzureDisk != nil {
52 v1.SetDefaults_AzureDiskVolumeSource(in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.AzureDisk)
53 }
54 if in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.ScaleIO != nil {
55 v1.SetDefaults_ScaleIOPersistentVolumeSource(in.Spec.Source.InlineVolumeSpec.PersistentVolumeSource.ScaleIO)
56 }
57 }
58 }
59
60 func SetObjectDefaults_VolumeAttachmentList(in *v1alpha1.VolumeAttachmentList) {
61 for i := range in.Items {
62 a := &in.Items[i]
63 SetObjectDefaults_VolumeAttachment(a)
64 }
65 }
66
View as plain text