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

admin: include cilium networkpolicies in envoy config dump #184

Merged

Conversation

mhofstetter
Copy link
Member

Currently, only builtin Envoy resources are part of the Envoy config dump on the admin API (/admin/config_dump).

This commit adds Ciliums NetworkPolicies to the config dump, by registering a callback to the configtracker of the adminserver.

This way, the network policies which are actually taken into account by the Envoy Cilium filters are also part of Ciliums sysdump.

Example output (Network Policy output manually flattened to reduce vertical usage)

{
    "configs": [
     {
      "@type": "type.googleapis.com/envoy.admin.v3.BootstrapConfigDump",
      ...
     },
     {
      "@type": "type.googleapis.com/envoy.admin.v3.ClustersConfigDump",
      "static_clusters": [
       ...
      ]
     },
     {
      "@type": "type.googleapis.com/envoy.admin.v3.ListenersConfigDump",
      "version_info": "3",
      "dynamic_listeners": [
       ...
      ]
     },
     {
      "@type": "type.googleapis.com/cilium.NetworkPoliciesConfigDump",
      "networkpolicies": [
       {
        "endpoint_ips": ["10.244.1.10"],
        "endpoint_id": "3559",
        "ingress_per_port_policies": [{"port": 80, "rules": [{"http_rules": {"http_rules": [{"headers": [{"name": ":path","string_match": {"safe_regex": {"regex": "/"}}}]}]}}]}],
        "egress_per_port_policies": [{"port": 53}, {"port": 80, "rules": [
            {"remote_policies": ["24471"], "http_rules": {"http_rules": [{"headers": [{"name": ":path","string_match": {"safe_regex": {"regex": "/"}}}]}]}},
            {"remote_policies": ["61667"], "http_rules": {"http_rules": [{"headers": [{"name": ":path","string_match": {"safe_regex": {"regex": "/"}}}]}]}}
          ]}],
        "conntrack_map_name": "global"
       },
       {
        "endpoint_ips": ["10.244.1.132"],
        "endpoint_id": "3962",
        "ingress_per_port_policies": [{}],
        "egress_per_port_policies": [{}],
        "conntrack_map_name": "global"
       },
       ...
      ]
     },
        ...
   }

Currently, only builtin Envoy resources are part of the Envoy config
dump on the admin API (/admin/config_dump).

This commit adds Ciliums NetworkPolicies to the config dump, by
registering a callback to the configtracker of the adminserver.

This way, the network policies which are actually taken into account
by the Envoy Cilium filters are also part of Ciliums sysdump.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
@mhofstetter mhofstetter marked this pull request as ready for review April 20, 2023 07:04
@mhofstetter
Copy link
Member Author

mhofstetter commented Apr 20, 2023

/test-cilium-integration ciliumCli=d3fe1c3d38bc83c1c3dc350f09d95fa2811fdd2a

-> Cilium Integration Tests are failing due to cilium/cilium-cli#1520 (edit: fixed ✔️ )

-> But it looks like the issue_comment triggered action gets skipped 🤔

Copy link
Member

@jrajahalme jrajahalme left a comment

Choose a reason for hiding this comment

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

This is awesome! Wanted for this for the longest time, but never got to dig out how to do this, thank you :-)

@jrajahalme jrajahalme merged commit 797bea8 into cilium:main Apr 20, 2023
3 checks passed
@sayboras sayboras added the needs-backport/1.23 Needs backport for v1.23 branch label Apr 21, 2023
@mhofstetter mhofstetter deleted the pr/mhofstetter/confgdump-cilium-resources branch April 21, 2023 05:54
mhofstetter added a commit to mhofstetter/cilium that referenced this pull request Apr 25, 2023
This commit updates the Cilium Proxy docker image to the latest version
with underlying Envoy 1.25 (`797bea843de17da8f8a096747c4691405b540aa8`).

It comes with the following changes / new features:

* Support Ingress ID also for east/west Ingress cilium/proxy#167
* admin: include cilium networkpolicies in envoy config dump
  cilium/proxy#184
* patches: Update for upstreamed versions cilium/proxy#183

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
mhofstetter added a commit to mhofstetter/cilium that referenced this pull request Apr 25, 2023
This commit updates the latest Cilium Proxy API matching.

It includes the following changes / new features:

* Support Ingress ID also for east/west Ingress cilium/proxy#167
* admin: include cilium networkpolicies in envoy config dump cilium/proxy#184
* patches: Update for upstreamed versions cilium/proxy#183

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
sayboras pushed a commit to cilium/cilium that referenced this pull request Apr 26, 2023
This commit updates the Cilium Proxy docker image to the latest version
with underlying Envoy 1.25 (`797bea843de17da8f8a096747c4691405b540aa8`).

It comes with the following changes / new features:

* Support Ingress ID also for east/west Ingress cilium/proxy#167
* admin: include cilium networkpolicies in envoy config dump
  cilium/proxy#184
* patches: Update for upstreamed versions cilium/proxy#183

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
sayboras pushed a commit to cilium/cilium that referenced this pull request Apr 26, 2023
This commit updates the latest Cilium Proxy API matching.

It includes the following changes / new features:

* Support Ingress ID also for east/west Ingress cilium/proxy#167
* admin: include cilium networkpolicies in envoy config dump cilium/proxy#184
* patches: Update for upstreamed versions cilium/proxy#183

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport/1.23 Needs backport for v1.23 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants