Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bb2c1f5
DEV-39965: Allow the user to specify a parent group during installation
Oct 12, 2018
5735cb4
Merge pull request #1 in DEV/k8s-argus from DEV-39965-allow-the-user-…
Oct 15, 2018
2d53e26
DEV-39965: Allow the user to specify a parent group during installation
Oct 16, 2018
3c03f96
Merge pull request #2 in DEV/k8s-argus from DEV-39965-allow-the-user-…
Oct 16, 2018
5dfab5b
DEV-40505: Sync the k8s resource to santaba when argus launches
Nov 1, 2018
4058f07
DEV-40434: The alert status of Pods and Services are disabled
Nov 2, 2018
e43a6a7
DEV-40505: Sync the k8s resource to santaba when argus launches
Nov 2, 2018
58a9125
Merge pull request #3 in DEV/k8s-argus from DEV-40505-sync-the-k8s-re…
Nov 6, 2018
33c0a67
Merge pull request #4 in DEV/k8s-argus from bugfix/DEV-40434-the-aler…
Nov 6, 2018
b4ce488
DEV-40505: Sync the k8s resource to santaba when argus launches
Nov 9, 2018
a03490e
Merge pull request #6 in DEV/k8s-argus from DEV-40505-sync-the-k8s-re…
Nov 10, 2018
e7c90f1
DEV-40779: Enable the alert on service group when it is created by argus
Nov 14, 2018
d36f943
Merge pull request #7 in DEV/k8s-argus from DEV-40779-enable-the-aler…
Nov 15, 2018
cc8efda
DEV-41432: Use IP as hostname for argus related devices
Dec 11, 2018
eb4fffb
DEV-41432: Use IP as hostname for argus related devices
Dec 13, 2018
16000b5
DEV-41459: Add a new device type for k8s devices
Dec 13, 2018
821500c
Merge pull request #9 in DEV/k8s-argus from DEV-41459-add-a-new-devic…
Dec 14, 2018
d570b4f
Merge pull request #8 in DEV/k8s-argus from DEV-41432-use-ip-as-hostn…
Dec 14, 2018
e6152f8
DEV-41432: Use IP as hostname for argus related devices
Dec 17, 2018
4079f66
Merge pull request #10 in DEV/k8s-argus from DEV-41432-use-ip-as-host…
Dec 17, 2018
f35228a
DEV-40217: Support to set log levels and improve logs in argus relate…
Dec 18, 2018
968a0ad
DEV-40217: Support to set log levels and improve logs in argus relate…
Dec 19, 2018
a6f1cd1
Merge branch 'master' into develop
woz5999 Dec 20, 2018
e56e41e
DEV-41682: Improve the argus code for the CI failure in GitHub
Dec 21, 2018
66f8a96
Merge pull request #1 from JeremyTangCD/DEV-41682-improve-the-argus-c…
JeremyTangCD Dec 21, 2018
5a8c798
Merge pull request #12 in DEV/k8s-argus from DEV-41682-improve-the-ar…
Dec 26, 2018
f634986
Merge pull request #11 in DEV/k8s-argus from DEV-40217-support-to-set…
Dec 26, 2018
2d0e559
Merge pull request #3 from JeremyTangCD/DEV-40217-support-to-set-log-…
JeremyTangCD Jan 2, 2019
b27023b
Merge branch 'develop' into develop
JeremyTangCD Jan 2, 2019
3286dcd
Dev-40217 support to set log levels and improve
JeremyTangCD Jan 2, 2019
06bdd15
DEV-41947: Improve the initsync logic to prevent lost data after k8s …
Jan 9, 2019
c69d432
DEV-41947: Improve the initsync logic to prevent lost data after k8s …
Jan 10, 2019
fc8f4f7
Merge pull request #13 in DEV/k8s-argus from DEV-41947-improve-the-in…
Jan 11, 2019
f1a712e
DEV-42060: Don't create collector device for Kubernetes Clusters
Jan 14, 2019
1d790d0
Merge pull request #14 in DEV/k8s-argus from DEV-42060-don-t-create-c…
Jan 15, 2019
d65374e
DEV-47062 Add distinguishing property to host network pods
Jan 22, 2019
746c3d9
Merge pull request #15 in DEV/k8s-argus from DEV-47062-add-distinguis…
Jan 29, 2019
30932b0
DEV-49046 Fix the internal IP cannot found bug in argus
Feb 14, 2019
7ecbcf6
Merge pull request #4 from JeremyTangCD/DEV-49046-fix-the-internal-ip…
JeremyTangCD Feb 15, 2019
a0c3b2d
Merge branch 'develop' into develop
JeremyTangCD Feb 15, 2019
2cc8d13
DEV-49046 Fix the internal IP cannot found bug in argus
Feb 18, 2019
6293a0a
Merge pull request #5 from JeremyTangCD/DEV-49046-fix-the-internal-ip…
JeremyTangCD Feb 18, 2019
2333cd4
Update node_test.go
JeremyTangCD Feb 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/device/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func (b *Builder) System(name, value string) types.DeviceOption {
return setProperty("system."+name, value)
}

// Custom implements types.DeviceBuilder.
func (b *Builder) Custom(name, value string) types.DeviceOption {
return setProperty(name, value)
}

func setProperty(name, value string) types.DeviceOption {
return func(device *lm.RestDevice) {
if value != "" {
Expand Down
2 changes: 2 additions & 0 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ type DeviceBuilder interface {
Auto(string, string) DeviceOption
// System adds a system property to the device.
System(string, string) DeviceOption
// System adds a custom property to the device.
Custom(string, string) DeviceOption
}
14 changes: 11 additions & 3 deletions pkg/watch/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,17 @@ func (w *Watcher) args(node *v1.Node, category string) []types.DeviceOption {

// getInternalAddress finds the node's internal address.
func getInternalAddress(addresses []v1.NodeAddress) *v1.NodeAddress {
var hostname *v1.NodeAddress
for _, address := range addresses {
if address.Type == v1.NodeInternalIP {
return &address
}
if address.Type == v1.NodeHostName {
hostname = &address
}
}

return nil
//if there is no internal IP for this node, the host name will be used
return hostname
}

func (w *Watcher) createRoleDeviceGroup(labels map[string]string) {
Expand Down Expand Up @@ -201,7 +205,11 @@ func GetNodesMap(k8sClient *kubernetes.Clientset) (map[string]string, error) {
return nil, err
}
for _, nodeInfo := range nodeList.Items {
nodesMap[nodeInfo.Name] = getInternalAddress(nodeInfo.Status.Addresses).Address
address := getInternalAddress(nodeInfo.Status.Addresses)
if address == nil {
continue
}
nodesMap[nodeInfo.Name] = address.Address
}

return nodesMap, nil
Expand Down
34 changes: 34 additions & 0 deletions pkg/watch/node/node_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package node

import (
"testing"

"k8s.io/api/core/v1"
)

func TestGetInternalAddress(t *testing.T) {
var addresses []v1.NodeAddress
address := getInternalAddress(addresses)
if address != nil {
t.Errorf("invalid address: %v", address)
}
addresses = append(addresses, v1.NodeAddress{
Type: v1.NodeHostName,
Address: "test",
})

address = getInternalAddress(addresses)
if address == nil || address.Address != "test" {
t.Errorf("invalid address: %v", address)
}

addresses = append(addresses, v1.NodeAddress{
Type: v1.NodeInternalIP,
Address: "127.0.0.1",
})

address = getInternalAddress(addresses)
if address == nil || address.Address != "127.0.0.1" {
t.Errorf("invalid address: %v", address)
}
}
6 changes: 5 additions & 1 deletion pkg/watch/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (w *Watcher) move(pod *v1.Pod) {

func (w *Watcher) args(pod *v1.Pod, category string) []types.DeviceOption {
categories := utilities.BuildSystemCategoriesFromLabels(category, pod.Labels)
return []types.DeviceOption{
options := []types.DeviceOption{
w.Name(getPodDNSName(pod)),
w.ResourceLabels(pod.Labels),
w.DisplayName(pod.Name),
Expand All @@ -145,6 +145,10 @@ func (w *Watcher) args(pod *v1.Pod, category string) []types.DeviceOption {
w.Auto("uid", string(pod.UID)),
w.System("ips", pod.Status.PodIP),
}
if pod.Spec.HostNetwork {
options = append(options, w.Custom("kubernetes.pod.hostNetwork", "true"))
}
return options
}

func getPodDNSName(pod *v1.Pod) string {
Expand Down