Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically create NetworkPolicies if NetworkPolicy usage is detected #3497

Open
jrcichra opened this issue Oct 31, 2024 · 2 comments
Open
Assignees
Labels
kind/enhancement lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@jrcichra
Copy link

Is your feature request related to a problem? Please describe:
When specifying a URL to import either via virtctl image-upload or on a dataVolumeTemplate and the cluster makes use of NetworkPolicies, users are required to apply a NetworkPolicy in their namespace to make the import work.

For dataVolumeTemplate of an Ubuntu ISO:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-ubuntu-iso-download
spec:
  egress:
    - ports:
        - port: 443
          protocol: TCP
  podSelector:
    matchLabels:
      app: containerized-data-importer
  policyTypes:
    - Egress

For virtctl image-upload:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-image-upload
spec:
  ingress:
    - from:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: cdi
    - ports:
        - port: 443
          protocol: TCP
  podSelector:
    matchLabels:
      app: containerized-data-importer
  policyTypes:
    - Ingress

Describe the solution you'd like:
An option for KubeVirt CDI to detect if NetworkPolicies are being used in a namespace. If they are, add one to allow containerized-data-importer to download the image. If not, don't apply a NetworkPolicy.

Describe alternatives you've considered:
For now users are able to specify the above NetworkPolicies to import their VM.

Additional context:
Add any other context or screenshots about the feature request here.

@aglitke
Copy link
Member

aglitke commented Nov 18, 2024

/assign @akalenyu

@kubevirt-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kubevirt-bot kubevirt-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants