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

Method Attach

pkg/entity/replicationcontroller.go:91–122  ·  view source on GitHub ↗

Attach allows Pods, Containers, and Images to be attached.

(e Entity)

Source from the content-addressed store, hash-verified

89
90// Attach allows Pods, Containers, and Images to be attached.
91func (c *ReplicationController) Attach(e Entity) error {
92 if err := c.validAttach(e); err != nil {
93 return err
94 }
95
96 switch e := e.(type) {
97 case *Pod:
98 if c.pod != nil {
99 return ErrorMaxAttached
100 }
101
102 c.pod = e
103 return nil
104 default:
105 if c.pod != nil {
106 return c.pod.Attach(e)
107 }
108
109 meta := kube.ObjectMeta{Name: e.name()}
110 pod, err := NewDefaultPod(meta, e.Source())
111 if err != nil {
112 return err
113 }
114
115 err = pod.Attach(e)
116 if err != nil {
117 return err
118 }
119
120 return c.Attach(pod)
121 }
122}
123
124func (c *ReplicationController) name() string {
125 return c.rc.ObjectMeta.Name

Callers

nothing calls this directly

Calls 5

NewDefaultPodFunction · 0.85
validAttachMethod · 0.80
AttachMethod · 0.65
nameMethod · 0.65
SourceMethod · 0.65

Tested by

no test coverage detected