ericchiang / k8s

A simple Kubernetes Go client
Apache License 2.0
599 stars 108 forks source link

Why type ObjectMeta is different? #106

Closed williamlin-suse closed 5 years ago

williamlin-suse commented 5 years ago

This is actually a question. In ericchiang\k8s\apis\meta\v1\generated.pb.go, it has // ObjectMeta is metadata that all persisted resources must have, which includes all objects // users must create. type ObjectMeta struct { Name string CreationTimestamp Time ....... }

But I downloaded Kubertenes code from https://github.com/kubernetes/kubernetes In k8s.io\apimachinery\pkg\apis\meta\v1\types.go, it has // ObjectMeta is metadata that all persisted resources must have, which includes all objects // users must create. type ObjectMeta struct { Name string CreationTimestamp Time ........ }

Are these 2 ObjectMeta types for the same purpose? If yes, I wonder why there is the value fields vs pointer fields difference between them? Thanks

ericchiang commented 5 years ago

The ones in this client are generated from protobuf definitions, hence the pointers.

They're the same. The reason this client doesn't use the types in github.com/kubernetes/* is to avoid importing Kubernetes code, and grabbing all the dependencies from it.

Closing, since there's no issue here :)