Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions manifests/0000_50_olm_01-networkpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ spec:
- port: metrics
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Ingress
- Egress
Expand All @@ -68,18 +66,16 @@ spec:
- port: metrics
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
- ports:
- protocol: TCP
port: 50051
Expand All @@ -106,18 +102,16 @@ spec:
- protocol: TCP
port: 5443
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
- ports:
- protocol: TCP
port: 50051
Expand Down
14 changes: 6 additions & 8 deletions manifests/0000_50_olm_06-psm-operator.networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ spec:
- port: 8443
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Ingress
- Egress
14 changes: 6 additions & 8 deletions manifests/0000_50_olm_07-collect-profiles.networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ spec:
- podSelector:
matchLabels:
app: catalog-operator
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Egress
- Ingress
10 changes: 10 additions & 0 deletions manifests/0000_90_olm_00-service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ rules:
- get
- list
- watch
- apiGroups:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rashmigottipati I am not sure if it is needed for np.

- discovery.k8s.io
resources:
- endpointslices
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down Expand Up @@ -105,6 +113,7 @@ spec:
selector:
matchLabels:
app: olm-operator
serviceDiscoveryRole: EndpointSlice
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Expand Down Expand Up @@ -139,3 +148,4 @@ spec:
selector:
matchLabels:
app: catalog-operator
serviceDiscoveryRole: EndpointSlice
28 changes: 12 additions & 16 deletions microshift-manifests/0000_50_olm_01-networkpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,16 @@ spec:
- port: metrics
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Ingress
- Egress
Expand All @@ -69,18 +67,16 @@ spec:
- port: metrics
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
- ports:
- protocol: TCP
port: 50051
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ spec:
- port: 8443
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Ingress
- Egress
10 changes: 10 additions & 0 deletions microshift-manifests/0000_90_olm_00-service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ rules:
- get
- list
- watch
- apiGroups:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rashmigottipati same comment with above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- discovery.k8s.io
resources:
- endpointslices
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down Expand Up @@ -105,6 +113,7 @@ spec:
selector:
matchLabels:
app: olm-operator
serviceDiscoveryRole: EndpointSlice
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Expand Down Expand Up @@ -139,3 +148,4 @@ spec:
selector:
matchLabels:
app: catalog-operator
serviceDiscoveryRole: EndpointSlice
28 changes: 12 additions & 16 deletions scripts/generate_crds_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,16 @@ spec:
- port: 8443
protocol: TCP
egress:
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Ingress
- Egress
Expand Down Expand Up @@ -445,18 +443,16 @@ spec:
- podSelector:
matchLabels:
app: catalog-operator
- {}
- ports:
- port: 6443
- port: 53
protocol: TCP
- ports:
- port: dns-tcp
- port: 53
protocol: UDP
- port: 5353
protocol: TCP
- port: dns
- port: 5353
protocol: UDP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
policyTypes:
- Egress
- Ingress
Expand Down
7 changes: 4 additions & 3 deletions staging/operator-lifecycle-manager/deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ networkPolicy:
port: 53
- protocol: UDP
port: 53
kubeAPIServer:
ports:
- protocol: TCP
port: 6443
port: 5353
- protocol: UDP
port: 5353
kubeAPIServer: {}
metrics:
ports:
- protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,29 @@ func DesiredGRPCServerNetworkPolicy(catalogSource *v1alpha1.CatalogSource, match
},
}

// Allow egress to kube-apiserver from configmap backed catalog sources
// Allow egress to kube-apiserver and DNS from configmap backed catalog sources
if catalogSource.Spec.SourceType == v1alpha1.SourceTypeConfigmap || catalogSource.Spec.SourceType == v1alpha1.SourceTypeInternal {
np.Spec.Egress = []networkingv1.NetworkPolicyEgressRule{
// Wildcard allow all IPs/Ports for kube-apiserver
{},
// Wildcard allow all IPs with DNS ports
{
Ports: []networkingv1.NetworkPolicyPort{
{
Protocol: ptr.To(corev1.ProtocolTCP),
Port: ptr.To(intstr.FromInt32(6443)),
Port: ptr.To(intstr.FromInt32(53)),
},
{
Protocol: ptr.To(corev1.ProtocolUDP),
Port: ptr.To(intstr.FromInt32(53)),
},
{
Protocol: ptr.To(corev1.ProtocolTCP),
Port: ptr.To(intstr.FromInt32(5353)),
},
{
Protocol: ptr.To(corev1.ProtocolUDP),
Port: ptr.To(intstr.FromInt32(5353)),
},
},
},
Expand Down Expand Up @@ -90,11 +105,26 @@ func DesiredUnpackBundlesNetworkPolicy(catalogSource client.Object) *networkingv
},
PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkingv1.PolicyTypeEgress},
Egress: []networkingv1.NetworkPolicyEgressRule{
// Wildcard allow all IPs/Ports for kube-apiserver
{},
// Wildcard allow all IPs with DNS ports
{
Ports: []networkingv1.NetworkPolicyPort{
{
Protocol: ptr.To(corev1.ProtocolTCP),
Port: ptr.To(intstr.FromInt32(6443)),
Port: ptr.To(intstr.FromInt32(53)),
},
{
Protocol: ptr.To(corev1.ProtocolUDP),
Port: ptr.To(intstr.FromInt32(53)),
},
{
Protocol: ptr.To(corev1.ProtocolTCP),
Port: ptr.To(intstr.FromInt32(5353)),
},
{
Protocol: ptr.To(corev1.ProtocolUDP),
Port: ptr.To(intstr.FromInt32(5353)),
},
},
},
Expand Down
Loading