Refactor Pod to use a Config struct

This allows us to JSON it and stuff it in the DB - previously,
all pod fields were private, so JSON couldn't encode them. This
allows us to keep all pod fields private by having a substruct
with public fields.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
This commit is contained in:
Matthew Heon
2018-02-09 17:13:07 -05:00
committed by Atomic Bot
parent aa85ae212e
commit 4f225b47c9
8 changed files with 80 additions and 113 deletions

View File

@ -764,7 +764,7 @@ func (s *SQLState) AddPod(pod *Pod) (err error) {
return ErrPodRemoved
}
labelsJSON, err := json.Marshal(pod.labels)
labelsJSON, err := json.Marshal(pod.config.Labels)
if err != nil {
return errors.Wrapf(err, "error marshaling pod %s labels to JSON", pod.ID())
}