Skip to content

Commit

Permalink
feat: Support PodServiceAccount relationship
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Toh <tohjustin@hotmail.com>
  • Loading branch information
tohjustin committed Oct 16, 2021
1 parent c707036 commit 6f6e0ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/graph/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
RelationshipPodPriorityClass Relationship = "PodPriorityClass"
RelationshipPodRuntimeClass Relationship = "PodRuntimeClass"
RelationshipPodSecurityPolicy Relationship = "PodSecurityPolicy"
RelationshipPodServiceAccount Relationship = "PodServiceAccount"
RelationshipPodVolume Relationship = "PodVolume"
RelationshipPodVolumeCSIDriver Relationship = "PodVolumeCSIDriver"
RelationshipPodVolumeCSIDriverSecret Relationship = "PodVolumeCSIDriverSecret" //nolint:gosec
Expand Down Expand Up @@ -528,6 +529,12 @@ func getPodRelationships(n *Node) (*RelationshipMap, error) {
result.AddDependencyByKey(ref.Key(), RelationshipPodSecurityPolicy)
}

// RelationshipPodServiceAccount
if sa := pod.Spec.ServiceAccountName; len(sa) != 0 {
ref = ObjectReference{Kind: "ServiceAccount", Name: sa, Namespace: ns}
result.AddDependencyByKey(ref.Key(), RelationshipPodServiceAccount)
}

// RelationshipPodVolume
// RelationshipPodVolumeCSIDriver
// RelationshipPodVolumeCSIDriverSecret
Expand Down

0 comments on commit 6f6e0ab

Please sign in to comment.