AddDeployment inserts the contents of one Deployment into another.
(deployment Deployment)
| 69 | |
| 70 | // AddDeployment inserts the contents of one Deployment into another. |
| 71 | func (d *Deployment) AddDeployment(deployment Deployment) (err error) { |
| 72 | // this is inefficient-it results in two deep copies being made, ones that's thrown out |
| 73 | // if this becomes frequently used it should be reimplemented |
| 74 | |
| 75 | // TODO: perform check for collisions before mutation to prevent incomplete additions |
| 76 | for _, obj := range deployment.Objects() { |
| 77 | err = d.Add(obj) |
| 78 | if err != nil { |
| 79 | return fmt.Errorf("could not add `%s`: %v", obj.GetObjectMeta().GetName(), err) |
| 80 | } |
| 81 | } |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | // Get returns the object with the given path from the Deployment. Error is returned if object does not exist. |
| 86 | func (d *Deployment) Get(name string) (KubeObject, error) { |