MCPcopy
hub / github.com/redspread/spread / deploy

Method deploy

pkg/deploy/cluster.go:120–140  ·  view source on GitHub ↗

deploy creates the object on the connected Kubernetes instance. Errors if object exists and not updating.

(obj KubeObject, update bool)

Source from the content-addressed store, hash-verified

118
119// deploy creates the object on the connected Kubernetes instance. Errors if object exists and not updating.
120func (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.
143func (c *KubeCluster) update(obj KubeObject, create bool, mapping *meta.RESTMapping) (KubeObject, error) {

Callers 1

DeployMethod · 0.95

Calls 3

updateMethod · 0.95
createMethod · 0.95
mappingFunction · 0.85

Tested by

no test coverage detected