fix: configure network policies outside kyverno if possible (and stuff)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- allow-atlantis-external-services.yaml
|
||||||
|
- allow-atlantis-services.yaml
|
||||||
@@ -3,4 +3,4 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- pubsub-rabbitmq.yaml
|
- pubsub-rabbitmq.yaml
|
||||||
- state-redis.yaml
|
- state-redis.yaml
|
||||||
- dapr-tracing.yaml
|
- ../base/
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- pubsub-rabbitmq.yaml
|
- pubsub-rabbitmq.yaml
|
||||||
- state-redis.yaml
|
- state-redis.yaml
|
||||||
- dapr-tracing.yaml
|
- ../base/
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
apiVersion: "cilium.io/v2"
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: "allow-namespace-traffic"
|
|
||||||
specs:
|
|
||||||
- endpointSelector:
|
|
||||||
matchLabels: {}
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
"k8s:io.kubernetes.pod.namespace": argocd
|
|
||||||
ingress:
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
"k8s:io.kubernetes.pod.namespace": argocd
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
apiVersion: kyverno.io/v1
|
||||||
|
kind: ClusterPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-namespace-traffic
|
||||||
|
annotations:
|
||||||
|
policies.kyverno.io/title: Generate NetworkPolicy to Existing Namespaces
|
||||||
|
policies.kyverno.io/subject: Namespace, NetworkPolicy
|
||||||
|
kyverno.io/kyverno-version: 1.7.0
|
||||||
|
policies.kyverno.io/minversion: 1.7.0
|
||||||
|
kyverno.io/kubernetes-version: "1.23"
|
||||||
|
policies.kyverno.io/description: >-
|
||||||
|
Allow all ingress/egress traffic within a namespace.
|
||||||
|
Allow egress to any pods in the cluster
|
||||||
|
Allow DNS with layer 7 inspection
|
||||||
|
spec:
|
||||||
|
generateExistingOnPolicyUpdate: true
|
||||||
|
rules:
|
||||||
|
- name: allow-namespace-traffic
|
||||||
|
match:
|
||||||
|
any:
|
||||||
|
- resources:
|
||||||
|
kinds:
|
||||||
|
- Namespace
|
||||||
|
generate:
|
||||||
|
synchronize: true
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
name: allow-namespace-traffic
|
||||||
|
namespace: "{{request.object.metadata.name}}"
|
||||||
|
data:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
created-by: kyverno
|
||||||
|
spec:
|
||||||
|
endpointSelector: {}
|
||||||
|
description: "Allow all traffic within a namespace, allow dns, allow egress to all entities in cluster"
|
||||||
|
ingress:
|
||||||
|
- fromEndpoints:
|
||||||
|
- {}
|
||||||
|
- fromEndpoints:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: io.kubernetes.pod.namespace
|
||||||
|
operator: Exists
|
||||||
|
egress:
|
||||||
|
- toEndpoints:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: io.kubernetes.pod.namespace
|
||||||
|
operator: Exists
|
||||||
|
#authentication:
|
||||||
|
# mode: "required"
|
||||||
|
- toEndpoints:
|
||||||
|
- matchLabels:
|
||||||
|
io.kubernetes.pod.namespace: kube-system
|
||||||
|
k8s-app: kube-dns
|
||||||
|
toPorts:
|
||||||
|
- ports:
|
||||||
|
- port: "53"
|
||||||
|
protocol: UDP
|
||||||
|
rules:
|
||||||
|
dns:
|
||||||
|
- matchPattern: "*"
|
||||||
|
#authentication:
|
||||||
|
# mode: "required"
|
||||||
+14
-6
@@ -14,6 +14,7 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
admission: true
|
admission: true
|
||||||
background: true
|
background: true
|
||||||
|
generateExisting: true
|
||||||
rules:
|
rules:
|
||||||
- generate:
|
- generate:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -26,11 +27,18 @@ spec:
|
|||||||
name: gitlab-pull-secret
|
name: gitlab-pull-secret
|
||||||
namespace: '{{request.object.metadata.name}}'
|
namespace: '{{request.object.metadata.name}}'
|
||||||
synchronize: true
|
synchronize: true
|
||||||
|
exclude:
|
||||||
|
any:
|
||||||
|
- resources:
|
||||||
|
kinds:
|
||||||
|
- Namespace
|
||||||
|
names:
|
||||||
|
- "vcluster-*"
|
||||||
match:
|
match:
|
||||||
resources:
|
any:
|
||||||
kinds:
|
- resources:
|
||||||
- Namespace
|
kinds:
|
||||||
name: sync-image-pull-secret
|
- Namespace
|
||||||
# skipBackgroundRequests: true
|
name: sync-oceanbox-regcred
|
||||||
# validationFailureAction: audit
|
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: vcluster-create-cilium-networkpolicies
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- cilium.io
|
||||||
|
resources:
|
||||||
|
- ciliumnetworkpolicies
|
||||||
|
verbs:
|
||||||
|
- '*'
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: vcluster-jaegers
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- jaegertracing.io
|
||||||
|
resources:
|
||||||
|
- jaegers
|
||||||
|
verbs:
|
||||||
|
- '*'
|
||||||
Reference in New Issue
Block a user