@@ -25,6 +25,9 @@ func ConvertTime(timestamp metav1.Time) Time {
2525}
2626
2727func ConvertTimePtr (timestamp * metav1.Time ) * Time {
28+ if timestamp == nil {
29+ return nil
30+ }
2831 return & Time {
2932 timestamp .Time ,
3033 }
@@ -40,6 +43,9 @@ func ConvertFieldsV1(raw metav1.FieldsV1) FieldsV1 {
4043 }
4144}
4245func ConvertFieldsV1Ptr (raw * metav1.FieldsV1 ) * FieldsV1 {
46+ if raw == nil {
47+ return nil
48+ }
4349 return & FieldsV1 {
4450 raw .Raw ,
4551 }
@@ -125,23 +131,23 @@ type ObjectMeta struct {
125131 ManagedFields []ManagedFieldsEntry
126132}
127133
128- func ConvertObjectMeta (obj metav1.ObjectMeta ) ObjectMeta {
134+ func ConvertObjectMeta (obj * metav1.ObjectMeta ) ObjectMeta {
129135 return ObjectMeta {
130- Name : obj .GetName () ,
131- GenerateName : obj .GetGenerateName () ,
132- Namespace : obj .GetNamespace () ,
136+ Name : obj .Name ,
137+ GenerateName : obj .GenerateName ,
138+ Namespace : obj .Namespace ,
133139 SelfLink : obj .GetSelfLink (),
134- UID : obj .GetUID () ,
135- ResourceVersion : obj .GetResourceVersion () ,
136- Generation : obj .GetGeneration () ,
137- CreationTimestamp : ConvertTime (obj .GetCreationTimestamp () ),
138- DeletionTimestamp : ConvertTimePtr (obj .GetDeletionTimestamp () ),
139- DeletionGracePeriodSeconds : obj .GetDeletionGracePeriodSeconds () ,
140- Labels : obj .GetLabels () ,
141- Annotations : obj .GetAnnotations () ,
142- OwnerReferences : ConvertOwnerReferences (obj .GetOwnerReferences () ),
143- Finalizers : obj .GetFinalizers () ,
144- ManagedFields : ConvertManagedFieldsEntries (obj .GetManagedFields () ),
140+ UID : obj .UID ,
141+ ResourceVersion : obj .ResourceVersion ,
142+ Generation : obj .Generation ,
143+ CreationTimestamp : ConvertTime (obj .CreationTimestamp ),
144+ DeletionTimestamp : ConvertTimePtr (obj .DeletionTimestamp ),
145+ DeletionGracePeriodSeconds : obj .DeletionGracePeriodSeconds ,
146+ Labels : obj .Labels ,
147+ Annotations : obj .Annotations ,
148+ OwnerReferences : ConvertOwnerReferences (obj .OwnerReferences ),
149+ Finalizers : obj .Finalizers ,
150+ ManagedFields : ConvertManagedFieldsEntries (obj .ManagedFields ),
145151 }
146152}
147153
0 commit comments