Skip to content

Allow instance IP ordering and filtering#18

Merged
frodenas merged 3 commits intocloudfoundry:masterfrom
psycofdj:filtering_ips
Feb 9, 2019
Merged

Allow instance IP ordering and filtering#18
frodenas merged 3 commits intocloudfoundry:masterfrom
psycofdj:filtering_ips

Conversation

@psycofdj
Copy link
Contributor

This PR allows users to choose which IP of the bosh instance to use as target and label as requested in #17

How it works

  • It adds a new parameter filter.cidrs that gives a coma-seperated list of CIDR.
  • Each instance IP is matched against each CIDR in the order given by the list
  • The first match gives the IP to use as target and label
  • Default value for filter.cidrs is 0.0.0.0/0 which matches any IP. Consequently, the default behavior is unchanged: the first available IP is used.
  • When couldn't match any IPs to any given CIDR, the instance is dropped (which provides a way to filter-out instances by their IP)

Example:

  • Given two instances with their IPs

    • A: 172.30.0.3 and 10.234.244.37
    • B: 192.168.0.55
  • With --filter.cidrs="0.0.0.0/0" (default flag value)

    • step A1. 172.30.0.3 is checked against 0.0.0.0/0, match
      • 172.30.0.3 is used for A
    • step B1. 192.168.0.55 is checked against 0.0.0.0/0, match
      • 192.168.0.55 is used for B
  • With --filter.cidrs="10.234.0.0/16,0.0.0.0/0"

    • step A1. 172.30.0.3 is checked against 10.234.0.0/16, no match
    • step A2. 10.234.244.37 is checked against 10.234.0.0/16, match
      • 10.234.244.37 is used for A
    • step B1. 192.168.0.55 is checked against 10.234.0.0/16, no match
    • step B2. 192.168.0.55 is checked against 0.0.0.0/0, match
      • 192.168.0.55 is used for B

@psycofdj
Copy link
Contributor Author

@frodenas Please can you give me an initial feedback about the approach, implementation and documentation ?

I'll remove the [WIP] flag after pushing some additional unit tests

@psycofdj psycofdj changed the title [WIP] Allow instance IP ordering and filtering Allow instance IP ordering and filtering Mar 27, 2018
@psycofdj
Copy link
Contributor Author

psycofdj commented Apr 7, 2018

@frodenas any news on this matter ?

1 similar comment
@psycofdj
Copy link
Contributor Author

@frodenas any news on this matter ?

@psycofdj
Copy link
Contributor Author

Hello @frodenas
Is there any problem with this PR ?

@frodenas frodenas merged commit 149099d into cloudfoundry:master Feb 9, 2019
@frodenas
Copy link
Contributor

frodenas commented Feb 9, 2019

Thanks @psycofdj and apologies for the super late review.

gberche-orange added a commit to orange-cloudfoundry/node-exporter-boshrelease that referenced this pull request Feb 7, 2024
Would emit (interface, addr, netmask, scope) labels for every network interface

See prometheus/node_exporter#2105

This complements current bosh exporter support for a single IP address, see cloudfoundry/bosh_exporter#18
benjaminguttmann-avtq pushed a commit to cloudfoundry/node-exporter-boshrelease that referenced this pull request Feb 27, 2024
Would emit (interface, addr, netmask, scope) labels for every network interface

See prometheus/node_exporter#2105

This complements current bosh exporter support for a single IP address, see cloudfoundry/bosh_exporter#18
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