Skip to content

Commit

Permalink
Merge pull request #17 from kartverket/invalid-cidr
Browse files Browse the repository at this point in the history
Fixed invalid CIDR
  • Loading branch information
hagen93 authored Jul 21, 2022
2 parents 41cac4d + 3dcea50 commit 94cc1e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (r *NetworkPolicyReconciler) Reconcile(ctx context.Context, req reconcile.R
port := intstr.FromInt(application.Spec.Port)
ingress.Ports[0].Port = &port
}

if external {
networkPolicy.Spec.Ingress = append(networkPolicy.Spec.Ingress, networkingv1.NetworkPolicyIngressRule{})
ingress := &networkPolicy.Spec.Ingress[len(networkPolicy.Spec.Ingress)-1]
Expand Down Expand Up @@ -159,7 +160,7 @@ func (r *NetworkPolicyReconciler) Reconcile(ctx context.Context, req reconcile.R

networkPolicy.Spec.Egress[0].To[0].IPBlock = &networkingv1.IPBlock{}
networkPolicy.Spec.Egress[0].To[0].IPBlock.CIDR = "0.0.0.0/0"
networkPolicy.Spec.Egress[0].To[0].IPBlock.Except = []string{"10.0.0.0/8", "172.16.0.0/12 ", "192.168.0.0/16"}
networkPolicy.Spec.Egress[0].To[0].IPBlock.Except = []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}

// Egress rule for DNS
networkPolicy.Spec.Egress[1].To = make([]networkingv1.NetworkPolicyPeer, 1)
Expand Down

0 comments on commit 94cc1e1

Please sign in to comment.