Skip to content

Conversation

raybejjani
Copy link
Contributor

@raybejjani raybejjani commented Jan 18, 2019

This removes entries that match the matchName or CIDR, removing lookups
that occurred before the time the API call was issued. No-parameter
invocations will clear the entire cache.


This change is Reviewable

@raybejjani raybejjani added wip area/daemon Impacts operation of the Cilium daemon. labels Jan 18, 2019
@raybejjani raybejjani requested a review from a team January 18, 2019 18:03
@raybejjani raybejjani requested a review from a team as a code owner January 18, 2019 18:03
@raybejjani
Copy link
Contributor Author

test-me-please

@coveralls
Copy link

coveralls commented Jan 18, 2019

Coverage Status

Coverage decreased (-0.02%) to 43.238% when pulling 1a16f80 on raybejjani:fqdn-api into 8308b07 on cilium:master.

@raybejjani
Copy link
Contributor Author

test-me-please

@raybejjani
Copy link
Contributor Author

test-me-please

1 similar comment
@raybejjani
Copy link
Contributor Author

test-me-please

@raybejjani
Copy link
Contributor Author

test-me-please

generatedRules, namesMissingIPs := gen.GenerateRulesFromSources(rulesToUpdate)
if len(namesMissingIPs) != 0 {
log.WithField(logfields.DNSName, strings.Join(namesMissingIPs, ",")).
Warn("Missing IPs for ToFQDN rule")
Copy link
Member

Choose a reason for hiding this comment

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

This is a warning stating there are missing IPs for ToFQDN, Is this a user problem? If yes, what can the user to to workaround this problem?

Copy link
Contributor Author

@raybejjani raybejjani Jan 24, 2019

Choose a reason for hiding this comment

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

It is a problem for them, assuming they included a matchName but no IPs are known for it. The only instructions I can think to include would be a little complicated. Something like:
Missing IPs for toFQDN rule. Ensure DNS data exists via the DNS Proxy or DNS Polling.
This used to also say: Using stale data or something like that. This line is copied from the function above.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand the warning. Why is it a problem if no IPs are in the cache for a matchName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is inherited from the DNS poller days, and it is less useful with the proxy. Let's say I include

toFQDNS:
  - matchName: foo.com
  - matchName: bar.com

If the poller can't resolve these, it means the policy will never work as intended. This warning is the only indication of this (there might also be a timeout error, actually). In the proxy case it is less clear that it's a problem. In that case if a lookup for foo.com happens, bar.com still has no data but that might be ok. In that case, it is more confusing. We now have an api to list the IPs in the DNS cache, so we can check foo.com and bar.com and this is less of an issue.

Are you saying it can be an info? or a debug? I'm ok with either, I guess, since I don't know how to make this reasonable in the dns proxy case.

@raybejjani
Copy link
Contributor Author

test-me-please

@raybejjani
Copy link
Contributor Author

@aanm @eloycoto @ianvernon I realised I had bugs with the CIDR handling, and fixing it caused a lot more complexity. Since it isn't clearly needed I removed it. The code is largely the same, but with fewer lines of additional code.

@raybejjani
Copy link
Contributor Author

test-me-please

In normal operation, the cache will only expire entries after the TTL.
In some circumstances, we will need to forcibly clear part of the cache
without removing all the data within it. ForceExpire and the updated
removeExpired allow doing this per-name and by LookupTime.

Signed-off-by: Ray Bejjani <ray@covalent.io>
There are circumstances to trigger a rule regeneration without new IP
information (such as a cache clear or TTL expiration without a new DNS
event). ForceGenerateDNS allows running logic similar to
UpdateGenerateDNS, where DNS names are matched against rules and new
versions generated.

Signed-off-by: Ray Bejjani <ray@covalent.io>
Signed-off-by: Ray Bejjani <ray@covalent.io>
This removes entries that match the matchName or CIDR, removing lookups
that occurred before the time the API call was issued. No-parameter
invocations will clear the entire cache.

Signed-off-by: Ray Bejjani <ray@covalent.io>
@raybejjani
Copy link
Contributor Author

test-me-please

@raybejjani
Copy link
Contributor Author

test-me-please

@ianvernon ianvernon requested review from aanm and a team January 25, 2019 21:30
generatedRules, namesMissingIPs := gen.GenerateRulesFromSources(rulesToUpdate)
if len(namesMissingIPs) != 0 {
log.WithField(logfields.DNSName, strings.Join(namesMissingIPs, ",")).
Warn("Missing IPs for ToFQDN rule")
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand the warning. Why is it a problem if no IPs are in the cache for a matchName?

@tgraf
Copy link
Member

tgraf commented Jan 25, 2019

I agree with @aanm that the warning is a bit weird. I would not know what to do as a user. Other pieces look good though so I'm merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants