Skip to content

Commit

Permalink
feat: custom property support (#184)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan authored Jun 21, 2023
1 parent 3cd3fde commit 8e98a8f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (c *cluster) CreateClusterBom(ctx context.Context) (*bom.Result, error) {
"openshift-etcd": "etcd",
}
}
components, err := c.collectComponents(ctx, labels, "ControlPlaneComponents")
components, err := c.collectComponents(ctx, labels, "ControlPlane")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -391,10 +391,11 @@ func (c *cluster) collectComponents(ctx context.Context, labels map[string]strin
containers = append(containers, c)
}
props := make(map[string]string)
if componentValue, ok := pod.GetLabels()[labelSelector]; ok {
props["Name"] = componentValue
}
if len(propertyKey) > 0 {
if componentValue, ok := pod.GetLabels()[labelSelector]; ok {
props[propertyKey[0]] = componentValue
}
props["Type"] = propertyKey[0]
}
components = append(components, bom.Component{
Namespace: pod.Namespace,
Expand Down

0 comments on commit 8e98a8f

Please sign in to comment.