-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add types Signed-off-by: Daniel Grunberger <[email protected]> * add registry Signed-off-by: Daniel Grunberger <[email protected]> * add merge strategy Signed-off-by: Daniel Grunberger <[email protected]> * fix types Signed-off-by: Daniel Grunberger <[email protected]> * pr fixes Signed-off-by: Daniel Grunberger <[email protected]> * fix example Signed-off-by: Daniel Grunberger <[email protected]> * feedback comments Signed-off-by: Daniel Grunberger <[email protected]> * change to pointer Signed-off-by: Daniel Grunberger <[email protected]> * regenerate Signed-off-by: Daniel Grunberger <[email protected]> * use pointer pkg Signed-off-by: Daniel Grunberger <[email protected]> * fix file name Signed-off-by: Daniel Grunberger <[email protected]> * feat: add and expose the NetworkNeighbors custom resource * add types Signed-off-by: Daniel Grunberger <[email protected]> * add registry Signed-off-by: Daniel Grunberger <[email protected]> * add merge strategy Signed-off-by: Daniel Grunberger <[email protected]> * fix types Signed-off-by: Daniel Grunberger <[email protected]> * fix: shorten stored file names to sidestep FS limitation Signed-off-by: Vlad Klokun <[email protected]> * style: remove redundant types from slice definitions Signed-off-by: Vlad Klokun <[email protected]> * fix: typo in the vulnerability summary storage source file names Signed-off-by: Vlad Klokun <[email protected]> * pr fixes Signed-off-by: Daniel Grunberger <[email protected]> * fix example Signed-off-by: Daniel Grunberger <[email protected]> * feedback comments Signed-off-by: Daniel Grunberger <[email protected]> * change to pointer Signed-off-by: Daniel Grunberger <[email protected]> * regenerate Signed-off-by: Daniel Grunberger <[email protected]> * use pointer pkg Signed-off-by: Daniel Grunberger <[email protected]> * fix file name Signed-off-by: Daniel Grunberger <[email protected]> --------- Signed-off-by: Daniel Grunberger <[email protected]> Signed-off-by: Vlad Klokun <[email protected]> Co-authored-by: Daniel Grunberger <[email protected]> Co-authored-by: Vlad Klokun <[email protected]> Co-authored-by: rcohencyberarmor <[email protected]> * network neighborses for plural Signed-off-by: Daniel Grunberger <[email protected]> * add types Signed-off-by: Daniel Grunberger <[email protected]> * use local obj Signed-off-by: Daniel Grunberger <[email protected]> * fix types Signed-off-by: Daniel Grunberger <[email protected]> * add example Signed-off-by: Daniel Grunberger <[email protected]> * implement custom storage Signed-off-by: Daniel Grunberger <[email protected]> * pr cleaning Signed-off-by: Daniel Grunberger <[email protected]> * go mod Signed-off-by: Daniel Grunberger <[email protected]> * add creation time Signed-off-by: Daniel Grunberger <[email protected]> * rm creation time from np Signed-off-by: Daniel Grunberger <[email protected]> * pr fixes Signed-off-by: Daniel Grunberger <[email protected]> * go mod Signed-off-by: Daniel Grunberger <[email protected]> * Update pkg/registry/file/generatednetworkpolicy_test.go Co-authored-by: Vlad Klokun <[email protected]> Signed-off-by: Daniel Grunberger <[email protected]> --------- Signed-off-by: Daniel Grunberger <[email protected]> Signed-off-by: Vlad Klokun <[email protected]> Signed-off-by: Daniel Grunberger <[email protected]> Co-authored-by: Daniel Grunberger <[email protected]> Co-authored-by: Vlad Klokun <[email protected]> Co-authored-by: rcohencyberarmor <[email protected]> Co-authored-by: Vlad Klokun <[email protected]>
- Loading branch information
1 parent
ca59d2b
commit 09a68c2
Showing
38 changed files
with
9,856 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
kind: GeneratedNetworkPolicy | ||
metadata: | ||
labels: | ||
kubescape.io/workload-api-group: apps | ||
kubescape.io/workload-api-version: v1 | ||
kubescape.io/workload-kind: deployment | ||
kubescape.io/workload-name: nginx | ||
kubescape.io/workload-namespace: kubescape | ||
name: deployment-nginx | ||
namespace: default | ||
policyRef: | ||
- dns: stripe.com | ||
ipBlock: 123.5.2.3/32 | ||
name: stripe.com | ||
originalIP: 123.5.2.3 | ||
spec: | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
generated-by: kubescape | ||
name: deployment-nginx | ||
namespace: default | ||
spec: | ||
egress: | ||
- ports: | ||
- port: 5978 | ||
protocol: TCP | ||
to: | ||
- ipBlock: | ||
cidr: 123.5.2.3/32 | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: kubescape | ||
podSelector: | ||
matchLabels: | ||
app: kubescape-ui | ||
ports: | ||
- port: 6379 | ||
protocol: TCP | ||
podSelector: | ||
matchLabels: | ||
app: nginx | ||
policyTypes: | ||
- Ingress | ||
- Egress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: spdx.softwarecomposition.kubescape.io/v1beta1 | ||
kind: NetworkNeighbors | ||
metadata: | ||
name: deployment-nginx | ||
annotations: | ||
status: incomplete | ||
labels: | ||
"kubescape.io/workload-api-group": "apps" | ||
"kubescape.io/workload-api-version": "v1" | ||
"kubescape.io/workload-name": "nginx" | ||
"kubescape.io/workload-kind": "deployment" | ||
"kubescape.io/workload-namespace": "kubescape" | ||
|
||
spec: | ||
matchLabels: | ||
app: nginx | ||
|
||
ingress: | ||
- type: internal | ||
identifier: bla | ||
namespaceSelector: | ||
matchLabels: | ||
name: kubescape | ||
podSelector: | ||
matchLabels: | ||
app: kubescape-ui | ||
ports: | ||
- name: TCP-6379 | ||
protocol: TCP | ||
port: 6379 | ||
|
||
egress: | ||
- type: external | ||
identifier: bla | ||
ipAddress: 123.5.2.3 | ||
dns: stripe.com | ||
ports: | ||
- name: TCP-5978 | ||
protocol: TCP | ||
port: 5978 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package softwarecomposition | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type Protocol string | ||
type CommunicationType string | ||
|
||
const ( | ||
ProtocolTCP Protocol = "TCP" | ||
ProtocolUDP Protocol = "UDP" | ||
ProtocolSCTP Protocol = "SCTP" | ||
|
||
CommunicationTypeIngress CommunicationType = "internal" | ||
CommunicationTypeEgress CommunicationType = "external" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// NetworkNeighborsList is a list of NetworkNeighbors. | ||
type NetworkNeighborsList struct { | ||
metav1.TypeMeta | ||
metav1.ListMeta | ||
|
||
Items []NetworkNeighbors | ||
} | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// NetworkNeighbors represents a list of network communications for a specific workload. | ||
type NetworkNeighbors struct { | ||
metav1.TypeMeta | ||
metav1.ObjectMeta | ||
|
||
Spec NetworkNeighborsSpec | ||
} | ||
|
||
type NetworkNeighborsSpec struct { | ||
metav1.LabelSelector // The labels which are inside spec.selector in the parent workload. | ||
Ingress []NetworkNeighbor | ||
Egress []NetworkNeighbor | ||
} | ||
|
||
// NetworkNeighbor represents a single network communication made by this resource. | ||
type NetworkNeighbor struct { | ||
Identifier string | ||
Type CommunicationType | ||
DNS string | ||
Ports []NetworkPort | ||
PodSelector *metav1.LabelSelector | ||
NamespaceSelector *metav1.LabelSelector | ||
IPAddress string | ||
} | ||
|
||
type NetworkPort struct { | ||
// Name is an artificial identifier of the network port. We use it for merging keys with Strategic Merge Patch. | ||
// Format is `{protocol}-{port}`. | ||
// | ||
// Example: tcp-6881 | ||
Name string // protocol-port | ||
Protocol Protocol | ||
Port *int32 | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// GeneratedNetworkPolicyList is a list of GeneratedNetworkPolicies. | ||
type GeneratedNetworkPolicyList struct { | ||
metav1.TypeMeta | ||
metav1.ListMeta | ||
|
||
Items []GeneratedNetworkPolicy | ||
} | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// GeneratedNetworkPolicy represents a generated NetworkPolicy. | ||
type GeneratedNetworkPolicy struct { | ||
metav1.TypeMeta | ||
metav1.ObjectMeta | ||
|
||
Spec NetworkPolicy | ||
PoliciesRef []PolicyRef | ||
} | ||
|
||
type PolicyRef struct { | ||
IPBlock string | ||
OriginalIP string | ||
DNS string | ||
Name string | ||
} | ||
|
||
type KnownServers struct { | ||
IPBlock string | ||
DNS string | ||
Name string | ||
} |
Oops, something went wrong.