Skip to content

mbp-1126: Network segmentation using UDN#147

Draft
mlorenzofr wants to merge 1 commit into
validatedpatterns:mainfrom
mlorenzofr:mbp-1126
Draft

mbp-1126: Network segmentation using UDN#147
mlorenzofr wants to merge 1 commit into
validatedpatterns:mainfrom
mlorenzofr:mbp-1126

Conversation

@mlorenzofr

Copy link
Copy Markdown
Collaborator

Description

Implements network segmentation using User Defined Networks (UDNs) for the qtodo application

Summary

  • Adds NetworkAttachmentDefinition and UserDefinedNetwork resources for isolated network segments
  • Configures AdminNetworkPolicy with ingress/egress rules to control traffic between network segments
  • Updates qtodo app deployment and PostgreSQL statefulset to use the new UDN
  • Adds documentation on UDN usage and configuration
  • Introduces feature flag system to enable/disable UDN functionality

Test plan

  • Validate feature flag enables/disables UDN resources correctly
  • Verify qtodo pods attach to the UDN successfully
  • Confirm AdminNetworkPolicy rules allow expected traffic and block unauthorized access
  • Test qtodo application
  • Review documentation

Signed-off-by: Manuel Lorenzo <mlorenzofr@redhat.com>
@mlorenzofr mlorenzofr marked this pull request as draft June 23, 2026 16:52
@minmzzhang

Copy link
Copy Markdown
Collaborator

There seems to be a conflict role of the UDN. In udn-user-defined-netowrk.yaml, the layer2 role was set to Primary, however, in app-deployment.yaml, it uses k8s.v1.cni.cocf.io/networks annotations to attach pods to the UDN:

k8s.v1.cni.cncf.io/networks: {{ .Release.Namespace }}/{{ .Values.app.udn.nadName }}

@minmzzhang minmzzhang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shall we use Primary or Secondary role for this UDN work? If we use Primary, then no manual NAD should be needed and no pod annotations of k8s.v1.cni.cncf.io/networks

oc exec -n qtodo deploy/qtodo -c qtodo -- getent hosts qtodo-db

# PostgreSQL connectivity (should work via net1)
oc exec -n qtodo deploy/qtodo -c qtodo -- timeout 5 bash -c '</dev/tcp/qtodo-db/5433 &>/dev/null' && echo "OK"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should this port be 5432?

{{- end }}
{{- if .Values.app.udn.networkPolicy.egress.postgresql.enabled }}
# Allow ingress to PostgreSQL from qtodo pods within same namespace on UDN
- name: allow-postgresql-ingress

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The flag used here is for egress

Comment thread charts/qtodo/values.yaml
mtu: 1400
# IPAM configuration
ipam:
type: static

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ipam is defined but not referenced by templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants