// NewReplicationController creates a new ReplicationController func NewReplicationController(r *api.ReplicationController) ReplicationController { return &replicationController{ ReplicationController: r, Meta: meta{r.ObjectMeta}, parents: report.MakeSets(), } }
// NewReplicaSet creates a new ReplicaSet func NewReplicaSet(r *extensions.ReplicaSet) ReplicaSet { return &replicaSet{ ReplicaSet: r, Meta: meta{r.ObjectMeta}, parents: report.MakeSets(), } }
// NewPod creates a new Pod func NewPod(p *api.Pod) Pod { return &pod{ Pod: p, Meta: meta{p.ObjectMeta}, parents: report.MakeSets(), } }
// Report implements Reporter. func (w *Weave) Report() (report.Report, error) { w.mtx.RLock() defer w.mtx.RUnlock() r := report.MakeReport() r.Container = r.Container.WithMetadataTemplates(report.MetadataTemplates{ WeaveMACAddress: {ID: WeaveMACAddress, Label: "Weave MAC", From: report.FromLatest, Priority: 17}, WeaveDNSHostname: {ID: WeaveDNSHostname, Label: "Weave DNS Name", From: report.FromLatest, Priority: 18}, }) for _, peer := range w.statusCache.Router.Peers { r.Overlay.AddNode(report.MakeNodeWith(report.MakeOverlayNodeID(peer.Name), map[string]string{ WeavePeerName: peer.Name, WeavePeerNickName: peer.NickName, })) } if w.statusCache.IPAM.DefaultSubnet != "" { r.Overlay.AddNode( report.MakeNode(report.MakeOverlayNodeID(w.statusCache.Router.Name)).WithSets( report.MakeSets().Add(host.LocalNetworks, report.MakeStringSet(w.statusCache.IPAM.DefaultSubnet)), ), ) } return r, nil }