Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort commatrix by node role, protocol and port #5

Merged
merged 5 commits into from
May 29, 2024

Conversation

sabinaaledort
Copy link
Collaborator

@sabinaaledort sabinaaledort commented Apr 25, 2024

Sort commatrix by node role, protocol and port and fix ss filter causing missing UDP ports

types/types.go Outdated
Service string `json:"Service"`
Pod string `json:"Pod"`
Container string `json:"Container"`
NodeRole string `json:"Node Role"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the space here is wrong (in the json:), also is there a reason for the uppercase change in the rest?

types/types.go Outdated
@@ -78,14 +78,14 @@ func (m *ComMatrix) String() string {
}

func (cd ComDetails) String() string {
return fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%v", cd.Direction, cd.Protocol, cd.Port, cd.Namespace, cd.Service, cd.Pod, cd.Container, cd.NodeRole, cd.Optional)
return fmt.Sprintf("%s,%s,%d,%s,%s,%s,%s,%s,%v", cd.Direction, cd.Protocol, cd.Port, cd.Namespace, cd.Service, cd.Pod, cd.Container, cd.NodeRole, cd.Optional)
}

func RemoveDups(outPuts []ComDetails) []ComDetails {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it seems this and the CmpComDetails are called together, wdyt about just combining them into one function that remove dups and sorts?

cmd/main.go Outdated
}
}

func diff(mat types.ComMatrix, ssMat types.ComMatrix) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name can be changed to something clearer, also is ssMat still correct here? can this just be mat1,mat2?

Copy link
Member

@oribon oribon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sabinaaledort sabinaaledort merged commit d97ed0f into openshift-kni:main May 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants