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

Allow generating commatrix from csv and fix samples #21

Merged
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Direction,Protocol,Port,Namespace,Service,Pod,Container,NodeRole,Optional
Direction,Protocol,Port,Namespace,Service,Pod,Container,Node Role,Optional
ingress,TCP,9050,example-namespace,example-service,example-pod,example-container,master,false
ingress,UDP,9051,example-namespace2,example-service2,example-pod2,example-container2,woker,false
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"direction": "ingress",
"protocol": "TCP",
"port": "9050",
"port": 9050,
"namespace": "example-namespace",
"service": "example-service",
"pod": "example-pod",
Expand All @@ -13,7 +13,7 @@
{
"direction": "ingress",
"protocol": "UDP",
"port": "9051",
"port": 9051,
"namespace": "example-namespace2",
"service": "example-service2",
"pod": "example-pod2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
nodeRole: master
optional: false
pod: example-pod
port: "9050"
port: 9050
protocol: TCP
service: example-service
- container: example-container2
Expand All @@ -13,6 +13,6 @@
nodeRole: worker
optional: false
pod: example-pod2
port: "9051"
port: 9051
protocol: UDP
service: example-service2
18 changes: 9 additions & 9 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ type ComMatrix struct {
}

type ComDetails struct {
Direction string `json:"direction" yaml:"direction"`
Protocol string `json:"protocol" yaml:"protocol"`
Port int `json:"port" yaml:"port"`
Namespace string `json:"namespace" yaml:"namespace"`
Service string `json:"service" yaml:"service"`
Pod string `json:"pod" yaml:"pod"`
Container string `json:"container" yaml:"container"`
NodeRole string `json:"nodeRole" yaml:"nodeRole"`
Optional bool `json:"optional" yaml:"optional"`
Direction string `json:"direction" yaml:"direction" csv:"Direction"`
Protocol string `json:"protocol" yaml:"protocol" csv:"Protocol"`
Port int `json:"port" yaml:"port" csv:"Port"`
Namespace string `json:"namespace" yaml:"namespace" csv:"Namespace"`
Service string `json:"service" yaml:"service" csv:"Service"`
Pod string `json:"pod" yaml:"pod" csv:"Pod"`
Container string `json:"container" yaml:"container" csv:"Container"`
NodeRole string `json:"nodeRole" yaml:"nodeRole" csv:"Node Role"`
Optional bool `json:"optional" yaml:"optional" csv:"Optional"`
}

func ToCSV(m ComMatrix) ([]byte, error) {
shirmoran marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading