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

Commit

Permalink
Develop (#103)
Browse files Browse the repository at this point in the history
* Stash to GitHub (#92)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41682: Improve the argus code for the CI failure in GitHub

* Dev-40217 support to set log levels and improve (#94)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-41682: Improve the argus code for the CI failure in GitHub

* Dev-40217 support to set log levels and improve

Dev-40217 support to set log levels and improve

* bump version

* Remove beta tag (#97)

* Develop (#95)

* Stash to GitHub (#92)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41682: Improve the argus code for the CI failure in GitHub

* Dev-40217 support to set log levels and improve (#94)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-41682: Improve the argus code for the CI failure in GitHub

* Dev-40217 support to set log levels and improve

Dev-40217 support to set log levels and improve

* bump version

* remove beta tag

* Dev 42060  improve the initSync and the branch of the lm sdk (#98)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-41682: Improve the argus code for the CI failure in GitHub

* DEV-41947: Improve the initsync logic to prevent lost data after k8s device is updated

* DEV-41947: Improve the initsync logic to prevent lost data after k8s device is updated

* DEV-42060: Don't create collector device for Kubernetes Clusters

* Update pkg/device/device.go

Co-Authored-By: JeremyTangCD <[email protected]>

* Update pkg/device/device.go

Co-Authored-By: JeremyTangCD <[email protected]>

* Update device.go

* Dev 49046 fix the internal ip cannot found (#102)

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-39965: Allow the user to specify a parent group during installation

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40434: The alert status of Pods and Services are disabled

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40505: Sync the k8s resource to santaba when argus launches

* DEV-40779: Enable the alert on service group when it is created by argus

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-41459: Add a new device type for k8s devices

* DEV-41432: Use IP as hostname for argus related devices

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-40217: Support to set log levels and improve logs in argus related projects

* DEV-41682: Improve the argus code for the CI failure in GitHub

* Dev-40217 support to set log levels and improve

Dev-40217 support to set log levels and improve

* DEV-41947: Improve the initsync logic to prevent lost data after k8s device is updated

* DEV-41947: Improve the initsync logic to prevent lost data after k8s device is updated

* DEV-42060: Don't create collector device for Kubernetes Clusters

* DEV-47062 Add distinguishing property to host network pods

* DEV-49046 Fix the internal IP cannot found bug in argus

* DEV-49046 Fix the internal IP cannot found bug in argus

* Update node_test.go
  • Loading branch information
woz5999 authored Feb 21, 2019
1 parent eed8970 commit e642f6f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
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

0 comments on commit e642f6f

Please sign in to comment.