Skip to content

Commit

Permalink
Add netpol template for traefik
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Aug 2, 2024
1 parent ded686e commit 392d2fa
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions pkg/rke2/np.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var defaultKubeSystemPolicies = []policyTemplate{
},
},
{
// allows for all http and https traffic into the kube-system namespace to the ingress controller pods
// allows for all http and https traffic into the kube-system namespace to the ingress-nginx controller pods
name: "default-network-ingress-policy",
annotationKey: "np.rke2.io/ingress",
podSelector: metav1.LabelSelector{MatchLabels: labels.Set{"app.kubernetes.io/name": "rke2-ingress-nginx"}},
Expand All @@ -111,7 +111,7 @@ var defaultKubeSystemPolicies = []policyTemplate{
},
},
{
// allows for https traffic into the to the ingress controller webhook
// allows for https traffic into the to the ingress-nginx controller webhook
name: "default-network-ingress-webhook-policy",
annotationKey: "np.rke2.io/ingress-webhook",
podSelector: metav1.LabelSelector{MatchLabels: labels.Set{"app.kubernetes.io/name": "rke2-ingress-nginx"}},
Expand All @@ -129,6 +129,32 @@ var defaultKubeSystemPolicies = []policyTemplate{
},
},
},
{
// allows for all http and https traffic into the kube-system namespace to the traefik ingress controller pods
name: "default-network-traefik-policy",
annotationKey: "np.rke2.io/ingress",
podSelector: metav1.LabelSelector{MatchLabels: labels.Set{"app.kubernetes.io/name": "rke2-traefik"}},
ingress: []v1.NetworkPolicyIngressRule{
{
Ports: []v1.NetworkPolicyPort{
{
Protocol: &tcp,
Port: &intstr.IntOrString{
Type: intstr.String,
StrVal: "http",
},
},
{
Protocol: &tcp,
Port: &intstr.IntOrString{
Type: intstr.String,
StrVal: "https",
},
},
},
},
},
},
{
// allows for https traffic into the CSI snapshot validation webhook
name: "default-network-snapshot-validation-webhook-policy",
Expand Down

0 comments on commit 392d2fa

Please sign in to comment.