deploy creates the object on the connected Kubernetes instance. Errors if object exists and not updating.
(obj KubeObject, update bool)
| 118 | |
| 119 | // deploy creates the object on the connected Kubernetes instance. Errors if object exists and not updating. |
| 120 | func (c *KubeCluster) deploy(obj KubeObject, update bool) error { |
| 121 | if obj == nil { |
| 122 | return errors.New("tried to deploy nil object") |
| 123 | } |
| 124 | |
| 125 | mapping, err := mapping(obj) |
| 126 | if err != nil { |
| 127 | return err |
| 128 | } |
| 129 | |
| 130 | if update { |
| 131 | _, err := c.update(obj, true, mapping) |
| 132 | if err != nil { |
| 133 | return err |
| 134 | } |
| 135 | return nil |
| 136 | } |
| 137 | |
| 138 | _, err = c.create(obj, mapping) |
| 139 | return err |
| 140 | } |
| 141 | |
| 142 | // update replaces the currently deployed version with a new one. If the objects already match then nothing is done. |
| 143 | func (c *KubeCluster) update(obj KubeObject, create bool, mapping *meta.RESTMapping) (KubeObject, error) { |