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

Add API server NetworkPolicy to support a potential deny all egress #573

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kabicin
Copy link
Member

@kabicin kabicin commented Apr 23, 2024

No description provided.

// If allowed, add an Egress rule to access the API server.
// Otherwise, if the OpenShift DNS or K8s CoreDNS Egress rule does not provide permissive cluster-wide access
// and the K8s API server could not be found, use a permissive cluster-wide Egress rule.
if apiServerEndpoints, err := r.getEndpoints("kubernetes", "default"); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think, if we can't get DNS info and using permissive rule we can skip this step as optimization. Without DNS it won't be able to resolve hostname in the pod, even if it allows kuberneres service IPs. And most likely if we codun't get DNS svc info we also will fail on this one

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the usingPermissiveRule flag out of the else if block to also exit early when trying the API server Endpoint lookup if DNS check is using permissive rule.

also, add nil check to dnsEndpoints.Subsets and GetEndpointPortByName
@kabicin kabicin requested a review from arturdzm April 24, 2024 15:37
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