Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Commit a4ddaf2

Browse files
author
Andrew Rynhard
committed
fix(device): set system.ips to satisfy heartbeat requirement
1 parent 29ae9ca commit a4ddaf2

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

pkg/device/builder/builder.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,13 @@ func (b *Builder) Auto(name, value string) types.DeviceOption {
5050
})
5151
}
5252
}
53+
54+
// System implements types.DeviceBuilder.
55+
func (b *Builder) System(name, value string) types.DeviceOption {
56+
return func(device *lm.RestDevice) {
57+
device.CustomProperties = append(device.CustomProperties, lm.NameAndValue{
58+
Name: "system." + name,
59+
Value: value,
60+
})
61+
}
62+
}

pkg/types/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,6 @@ type DeviceBuilder interface {
7474
SystemCategories(string) DeviceOption
7575
// Auto adds an auto property to the device.
7676
Auto(string, string) DeviceOption
77+
// System adds a system property to the device.
78+
System(string, string) DeviceOption
7779
}

pkg/watch/pod/pod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ func (w *Watcher) args(pod *v1.Pod, category string) []types.DeviceOption {
128128
w.Auto("nodename", pod.Spec.NodeName),
129129
w.Auto("selflink", pod.SelfLink),
130130
w.Auto("uid", string(pod.UID)),
131-
w.Auto("ip", pod.Status.PodIP),
131+
w.System("ips", pod.Status.PodIP),
132132
}
133133
}

0 commit comments

Comments
 (0)