Skip to content

Commit d6905dc

Browse files
authored
capture node pool and node instance type (#45)
1 parent e109e1c commit d6905dc

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

bootstrap_fields.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
- label: "Node Creation Timestamp"
3232
type: DateTime
3333
componentType: [ "Node" ]
34+
- label: "Node Instance Type"
35+
type: Text
36+
componentType: [ "Node" ]
3437
- label: "Node Kernel Version"
3538
type: Text
3639
componentType: [ "Node" ]
@@ -46,6 +49,9 @@
4649
- label: "Node OS"
4750
type: Text
4851
componentType: [ "Node" ]
52+
- label: "Node Pool"
53+
type: Text
54+
componentType: [ "Node" ]
4955
- label: "Node Provider"
5056
type: Text
5157
componentType: [ "Node" ]

controllers/ardoqcontroller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func GenericUpsert(resourceType string, genericResource interface{}) string {
7777
component.Fields = map[string]interface{}{
7878
"node_architecture": node.Architecture,
7979
"node_container_runtime": node.ContainerRuntime,
80+
"node_instance_type": node.InstanceType,
8081
"node_kernel_version": node.KernelVersion,
8182
"node_kubelet_version": node.KubeletVersion,
8283
"node_kube_proxy_version": node.KubeProxyVersion,
@@ -90,6 +91,7 @@ func GenericUpsert(resourceType string, genericResource interface{}) string {
9091
"node_allocatable_memory": node.Allocatable.Memory,
9192
"node_allocatable_storage": node.Allocatable.Storage,
9293
"node_allocatable_pods": node.Allocatable.Pods,
94+
"node_pool": node.Pool,
9395
"node_provider": node.Provider,
9496
"node_creation_timestamp": node.CreationTimestamp,
9597
"node_zone": node.Zone,

controllers/bridgecontroller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ func (b *BridgeController) OnNodeEvent(event watch.Event, res *v12.Node) {
118118
Pods: res.Status.Allocatable.Pods().Value(),
119119
},
120120
ContainerRuntime: res.Status.NodeInfo.ContainerRuntimeVersion,
121+
InstanceType: res.Labels["node.kubernetes.io/instance-type"],
121122
KernelVersion: res.Status.NodeInfo.KernelVersion,
122123
KubeletVersion: res.Status.NodeInfo.KubeletVersion,
123124
KubeProxyVersion: res.Status.NodeInfo.KubeProxyVersion,
124125
OperatingSystem: res.Status.NodeInfo.OperatingSystem,
125126
OSImage: res.Status.NodeInfo.OSImage,
126127
Provider: res.Spec.ProviderID,
128+
Pool: GetNodePool(res.Labels),
127129
CreationTimestamp: res.CreationTimestamp.Format(time.RFC3339),
128130
Region: res.Labels["failure-domain.beta.kubernetes.io/region"],
129131
Zone: res.Labels["failure-domain.beta.kubernetes.io/zone"],

controllers/helper.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,11 @@ func PersistToCache(name string, value interface{}) {
126126
Cache.Set(name, value, goCache.NoExpiration)
127127
metrics.CachePersists.Inc()
128128
}
129+
func GetNodePool(nodeLabels map[string]string) string {
130+
if nodeLabels["kubernetes.azure.com/agentpool"] != "" {
131+
return nodeLabels["kubernetes.azure.com/agentpool"]
132+
} else if nodeLabels["eks.amazonaws.com/nodegroup"] != "" {
133+
return nodeLabels["eks.amazonaws.com/nodegroup"]
134+
}
135+
return ""
136+
}

controllers/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ type Node struct {
2525
Capacity NodeResources
2626
Allocatable NodeResources
2727
ContainerRuntime string
28+
InstanceType string
2829
KernelVersion string
2930
KubeletVersion string
3031
KubeProxyVersion string
3132
OperatingSystem string
3233
OSImage string
34+
Pool string
3335
Provider string
3436
CreationTimestamp string
3537
Region string

tests/integrations/k8s/bootstrap_fields.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
- label: "Node Creation Timestamp"
3232
type: DateTime
3333
componentType: [ "Node" ]
34+
- label: "Node Instance Type"
35+
type: Text
36+
componentType: [ "Node" ]
3437
- label: "Node Kernel Version"
3538
type: Text
3639
componentType: [ "Node" ]
@@ -46,6 +49,9 @@
4649
- label: "Node OS"
4750
type: Text
4851
componentType: [ "Node" ]
52+
- label: "Node Pool"
53+
type: Text
54+
componentType: [ "Node" ]
4955
- label: "Node Provider"
5056
type: Text
5157
componentType: [ "Node" ]

0 commit comments

Comments
 (0)