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

Do not throw spurious error when minTTL=0 for the domain in egress network policy #19950

Merged

Conversation

pravisankar
Copy link

@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 8, 2018
@pravisankar
Copy link
Author

@openshift/sig-networking @knobunc PTAL

@pravisankar
Copy link
Author

@knobunc We are already adding "." to the end of the domain name before querying the dns server.
dns.Fqdn() in https://github.com/openshift/origin/blob/master/pkg/network/common/dns.go#L135 is doing it for us.

// We could potentially get zero TTL as we try to query the DNS
// server at the end of the TTL value for the domain.
// Adding 1 sec will ensure non zero minTTL
ttl := t.Hdr.Ttl + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make minTTL an int32 (what does dns spec the ttl as?) Then we can set the minTTL to -1 when we initialize it.

Then we can just compare the ttl against the minTTL and not have to do the 1s offset.

Copy link
Author

Choose a reason for hiding this comment

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

github.com/miekg/dns has t.Hdr.Ttl as uint32 which is as per the DNS spec. So converting to int32 will be an issue (not sure whether so high TTL values are set in real world or not)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, sounds good to me.

// Adding 1 sec will ensure non zero minTTL
ttl := t.Hdr.Ttl + 1

if minTTL == 0 || ttl < minTTL {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't this just be:
if ttl < minTTL {

Why do we care if minTTL == 0

Copy link
Author

Choose a reason for hiding this comment

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

We were overloading this field to know whether this field is set or not otherwise we don't care about the value of minTTL. Let me fix this one.

@danwinship
Copy link
Contributor

I never see a TTL of 0 returned from dig... if I query repeatedly, it always rolls around from 1 second back to the max TTL without the returned TTL ever being 0.

So I wonder if the problem isn't something else. Maybe add some more debugging/error checking?

@pravisankar
Copy link
Author

pravisankar commented Jun 8, 2018 via email

Ravi Sankar Penta added 2 commits June 8, 2018 12:50
- This will ensure dns failure of one domain will not block periodic
updates for other domains in the egress network policy.
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 8, 2018
@pravisankar pravisankar changed the title Ensure non-zero minimum TTL for the domain in egress network policy Do not throw spurious error when minTTL=0 for the domain in egress network policy Jun 8, 2018
@pravisankar
Copy link
Author

@knobunc @danwinship updated, PTAL

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knobunc, pravisankar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 0756803 into openshift:master Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/networking lgtm Indicates that a PR is ready to be merged. sig/networking size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants