-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from kubescape/fix/handling-istion-gateways
Supporting gateways from different namespaces
- Loading branch information
Showing
10 changed files
with
559 additions
and
13 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
193 changes: 193 additions & 0 deletions
193
rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/expected.json
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,193 @@ | ||
[ | ||
{ | ||
"alertMessage": "workload 'nginx' is exposed through virtualservice 'int-0721'", | ||
"failedPaths": [], | ||
"reviewPaths": null, | ||
"deletePaths": null, | ||
"fixPaths": [], | ||
"ruleStatus": "", | ||
"packagename": "armo_builtins", | ||
"alertScore": 7, | ||
"alertObject": { | ||
"k8sApiObjects": [ | ||
{ | ||
"apiVersion": "apps/v1", | ||
"kind": "Deployment", | ||
"metadata": { | ||
"labels": { | ||
"app": "int-0721", | ||
"context": "default", | ||
"name": "int-0721", | ||
"role": "app" | ||
}, | ||
"name": "nginx" | ||
} | ||
} | ||
] | ||
}, | ||
"relatedObjects": [ | ||
{ | ||
"object": { | ||
"apiVersion": "networking.istio.io/v1beta1", | ||
"kind": "VirtualService", | ||
"metadata": { | ||
"creationTimestamp": "2024-04-15T08:56:16Z", | ||
"generation": 2, | ||
"labels": { | ||
"app": "int-0721", | ||
"context": "default", | ||
"name": "int-0721", | ||
"owner": "int-0721", | ||
"owner-namespace": "kt-itinternal", | ||
"role": "app" | ||
}, | ||
"name": "int-0721", | ||
"namespace": "kt-itinternal" | ||
}, | ||
"spec": { | ||
"gateways": [ | ||
"kt-connections/prod-lan-gateway", | ||
"kt-connections/sdfsdfs-gateway", | ||
"kt-connections/api-public", | ||
"kt-connections/aaaaa-public", | ||
"kt-connections/mydddd-public" | ||
], | ||
"hosts": [ | ||
"api.stg.prod.lan" | ||
], | ||
"http": [ | ||
{ | ||
"corsPolicy": { | ||
"allowHeaders": [ | ||
"authorization", | ||
"Origin", | ||
"Content-Type", | ||
"Accept" | ||
], | ||
"allowMethods": [ | ||
"POST", | ||
"GET", | ||
"OPTIONS", | ||
"PUT", | ||
"PATCH", | ||
"DELETE" | ||
], | ||
"allowOrigins": [ | ||
{ | ||
"regex": ".*" | ||
} | ||
] | ||
}, | ||
"match": [ | ||
{ | ||
"authority": { | ||
"exact": "api.stg.prod.lan" | ||
}, | ||
"uri": { | ||
"prefix": "/int/0698/" | ||
} | ||
} | ||
], | ||
"name": "api-http-stgprodlan", | ||
"rewrite": { | ||
"uri": "/" | ||
}, | ||
"route": [ | ||
{ | ||
"destination": { | ||
"host": "int-0721.kt-itinternal.svc.cluster.local", | ||
"port": { | ||
"number": 8080 | ||
} | ||
}, | ||
"headers": { | ||
"request": { | ||
"set": { | ||
"X-Forwarded-Prefix": "/int/0698", | ||
"X-Forwarded-Proto": "https" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"failedPaths": [ | ||
"spec.http[0].routes[0].destination.host" | ||
], | ||
"reviewPaths": [ | ||
"spec.http[0].routes[0].destination.host" | ||
], | ||
"deletePaths": null, | ||
"fixPaths": null | ||
}, | ||
{ | ||
"object": { | ||
"apiVersion": "v1", | ||
"kind": "Service", | ||
"metadata": { | ||
"creationTimestamp": "2024-04-15T09:00:11Z", | ||
"labels": { | ||
"app": "int-0721", | ||
"context": "default", | ||
"name": "int-0721", | ||
"owner": "int-0721", | ||
"owner-namespace": "kt-itinternal", | ||
"role": "app" | ||
}, | ||
"name": "int-0721", | ||
"namespace": "kt-itinternal", | ||
"ownerReferences": [ | ||
{ | ||
"apiVersion": "msss/v1alpha1", | ||
"blockOwnerDeletion": true, | ||
"controller": true, | ||
"kind": "Microservice", | ||
"name": "int-0721", | ||
"uid": "14a69d5b-249c-487d-9500-645bda6a4c56" | ||
} | ||
], | ||
"resourceVersion": "3779885629", | ||
"uid": "0428cb70-5d8f-4345-8ef2-5b0a249e0793" | ||
}, | ||
"spec": { | ||
"clusterIP": "10.81.208.49", | ||
"clusterIPs": [ | ||
"10.81.208.49" | ||
], | ||
"internalTrafficPolicy": "Cluster", | ||
"ipFamilies": [ | ||
"IPv4" | ||
], | ||
"ipFamilyPolicy": "SingleStack", | ||
"ports": [ | ||
{ | ||
"name": "http", | ||
"port": 8080, | ||
"protocol": "TCP", | ||
"targetPort": 8080 | ||
} | ||
], | ||
"selector": { | ||
"app": "int-0721", | ||
"context": "default", | ||
"name": "int-0721", | ||
"role": "app" | ||
}, | ||
"sessionAffinity": "None", | ||
"type": "ClusterIP" | ||
}, | ||
"status": { | ||
"loadBalancer": {} | ||
} | ||
}, | ||
"failedPaths": null, | ||
"reviewPaths": null, | ||
"deletePaths": null, | ||
"fixPaths": null | ||
} | ||
] | ||
} | ||
] |
24 changes: 24 additions & 0 deletions
24
rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/gateway.yaml
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,24 @@ | ||
apiVersion: networking.istio.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
annotations: | ||
meta.helm.sh/release-name: legacy-compatibility | ||
meta.helm.sh/release-namespace: kt-itinternal | ||
creationTimestamp: "2023-03-16T10:18:13Z" | ||
generation: 1 | ||
labels: | ||
app.kubernetes.io/managed-by: Helm | ||
name: prod-lan-gateway | ||
namespace: kt-itinternal | ||
resourceVersion: "713118464" | ||
uid: 46cb8274-3569-4b4a-952a-52037a352715 | ||
spec: | ||
selector: | ||
istio: ingressgateway | ||
servers: | ||
- hosts: | ||
- legacy.stg.prod.lan | ||
port: | ||
name: http | ||
number: 80 | ||
protocol: HTTP |
58 changes: 58 additions & 0 deletions
58
rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/input/deployment.yaml
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,58 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: int-0721 | ||
context: default | ||
name: int-0721 | ||
role: app | ||
name: nginx | ||
namespace: kt-itinternal | ||
spec: | ||
progressDeadlineSeconds: 600 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- image: nginx | ||
imagePullPolicy: Always | ||
name: nginx | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
status: | ||
availableReplicas: 1 | ||
conditions: | ||
- lastTransitionTime: "2024-11-19T19:33:45Z" | ||
lastUpdateTime: "2024-11-19T19:33:45Z" | ||
message: Deployment has minimum availability. | ||
reason: MinimumReplicasAvailable | ||
status: "True" | ||
type: Available | ||
- lastTransitionTime: "2024-11-19T19:33:37Z" | ||
lastUpdateTime: "2024-11-19T19:33:45Z" | ||
message: ReplicaSet "nginx-7854ff8877" has successfully progressed. | ||
reason: NewReplicaSetAvailable | ||
status: "True" | ||
type: Progressing | ||
observedGeneration: 1 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
updatedReplicas: 1 |
15 changes: 15 additions & 0 deletions
15
rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/input/gateway.yaml
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,15 @@ | ||
apiVersion: networking.istio.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
name: prod-lan-gateway | ||
namespace: kt-connections | ||
spec: | ||
selector: | ||
istio: ingressgateway | ||
servers: | ||
- hosts: | ||
- legacy.stg.prod.lan | ||
port: | ||
name: http | ||
number: 80 | ||
protocol: HTTP |
Oops, something went wrong.