Skip to content

Non-kube network observer installation - #2532

Open
nluaces wants to merge 17 commits into
skupperproject:mainfrom
nluaces:add-network-observer-to-non-kube-env
Open

Non-kube network observer installation#2532
nluaces wants to merge 17 commits into
skupperproject:mainfrom
nluaces:add-network-observer-to-non-kube-env

Conversation

@nluaces

@nluaces nluaces commented Jul 10, 2026

Copy link
Copy Markdown
Member

resolves #2489


New command:

$ skupper system network-observer --help
Install the Skupper network observer to collect and expose network metrics.
The network observer requires an existing Skupper site and will deploy three containers:
- network-observer: Collects metrics from the router
- prometheus: Stores metrics
- nginx: Provides HTTPS access with HTTP Basic Auth

Usage:
  skupper system network-observer [flags]

Examples:
skupper network-observer  --namespace west
skupper network-observer -n west --username admin --password secret

Flags:
  -h, --help              help for network-observer
      --password string   Password for HTTP Basic Auth (auto-generated if not provided)
      --uninstall         Uninstall Network Observer and related containers
      --username string   Username for HTTP Basic Auth (default "skupper")

Global Flags:
  -n, --namespace string   Set the namespace
  -p, --platform string    Set the platform type to use [kubernetes, podman, docker, linux]

Notes:

  • By default it uses the ports 8443, 9090, 8080, and 9000; like the kubernetes version. If any of them is not available it will be assigned the next one that is free.

Summary by CodeRabbit

  • New Features

    • Added a system network observer that installs Network Observer and Prometheus services for non-Kubernetes environments.
    • Added an access URL after successful installation.
    • Added --uninstall support to remove Network Observer services and data by namespace.
    • Integrated automatic cleanup with forced system uninstall operations.
    • Added system service management for Docker and Podman environments.
  • Updates

    • Updated the bundled Prometheus image to version 3.11.3.
  • Limitations

    • Network Observer installation is not supported on Kubernetes platforms.

@nluaces nluaces self-assigned this Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds non-Kubernetes Network Observer installation and uninstallation, including container and Prometheus configuration, systemd services, namespace cleanup integration, image updates, and new system network-observer command wiring.

Changes

Network Observer deployment

Layer / File(s) Summary
Stack configuration and container artifacts
go.mod, internal/images/*, internal/nonkube/network-observer/config_templates.go, internal/nonkube/network-observer/containers.go
Adds image helpers and the Prometheus v3.11.3 image, renders Prometheus configuration, and defines Network Observer and Prometheus container specifications.
Systemd service management
internal/nonkube/network-observer/systemd.go
Adds systemd unit templates, service creation and startup, Podman-specific options, and service removal.
Installer and uninstaller workflow
internal/nonkube/network-observer/installer.go
Adds platform and runtime detection, prerequisite checks, directory and port setup, container installation, systemd integration, and namespace-scoped cleanup.
System command integration and uninstall hooks
internal/cmd/skupper/common/flags.go, internal/cmd/skupper/system/*, internal/cmd/skupper/system/kube/*
Registers the network-observer command and --uninstall flag, implements non-Kubernetes behavior, provides Kubernetes stubs, and invokes observer cleanup during forced system uninstall with tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant SystemCommand
  participant Installer
  participant ContainerRuntime
  participant Systemd
  Operator->>SystemCommand: run system network-observer
  SystemCommand->>Installer: create and validate installer
  SystemCommand->>Installer: install stack
  Installer->>ContainerRuntime: pull, create, and start containers
  Installer->>Systemd: create, enable, and start services
  Installer-->>SystemCommand: return access URL
Loading

Suggested reviewers: c-kruse

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds network-observer and Prometheus support, but it omits the Nginx container and service requested by #2489. Restore the Nginx deployment/systemd unit, or update the linked issue scope if removing Nginx is intentional.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the non-Kubernetes network-observer install work.
Out of Scope Changes check ✅ Passed The changes are tied to the network-observer install/uninstall feature and its supporting tests, images, and systemd wiring.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nluaces
nluaces force-pushed the add-network-observer-to-non-kube-env branch from 5b694b6 to 8da7426 Compare July 10, 2026 20:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (5)
internal/nonkube/network-observer/systemd.go (2)

47-47: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant --restart always in container run commands.

All three templates specify --restart always in the docker run/podman run command while also using systemd Restart=always. On container exit, both the container runtime and systemd will attempt restarts, which can race. The ExecStartPre stop/rm mitigates this but adds unnecessary churn. Let systemd own the lifecycle and drop --restart from the container command.

Also applies to: 79-79, 113-113


295-296: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use structured logging instead of fmt.Printf for warnings.

RemoveServices uses fmt.Printf for a warning message while the rest of the codebase uses slog. Consider injecting a logger into SystemdServiceManager or accepting one as a parameter.

internal/nonkube/network-observer/installer.go (2)

143-159: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Containers are created and started directly, then immediately recreated by systemd.

installContainer() pulls, creates, and starts each container. Then createSystemdServices() starts systemd units whose ExecStartPre stops and removes those same containers before ExecStart runs new ones. The direct container creation is redundant and causes unnecessary churn. If the intent is validation, consider only pulling images or creating containers without starting them.


409-409: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use structured logger instead of fmt.Printf.

installContainer uses fmt.Printf for the "Pulled image" message while the rest of the installer uses slog.

internal/cmd/skupper/system/kube/system_network-observer.go (1)

13-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unused fields namespace, user, password flagged by linter.

These fields mirror the nonkube struct but are never set or read in the kube stub. Consider removing them or adding //nolint:unused comments to keep linter output clean.

Source: Linters/SAST tools


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba6e9269-549e-423f-b915-392d3f6b7123

📥 Commits

Reviewing files that changed from the base of the PR and between 62dda19 and 8da7426.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • go.mod
  • internal/cmd/skupper/common/flags.go
  • internal/cmd/skupper/system/kube/system_network-observer.go
  • internal/cmd/skupper/system/nonkube/system_network-observer.go
  • internal/cmd/skupper/system/nonkube/system_network-observer_test.go
  • internal/cmd/skupper/system/system.go
  • internal/cmd/skupper/system/system_test.go
  • internal/images/image_utils.go
  • internal/images/images.go
  • internal/nonkube/network-observer/certificates.go
  • internal/nonkube/network-observer/config_templates.go
  • internal/nonkube/network-observer/containers.go
  • internal/nonkube/network-observer/installer.go
  • internal/nonkube/network-observer/password.go
  • internal/nonkube/network-observer/password_test.go
  • internal/nonkube/network-observer/systemd.go

Comment thread go.mod Outdated
Comment thread internal/nonkube/network-observer/config_templates.go
Comment thread internal/nonkube/network-observer/containers.go
Comment thread internal/nonkube/network-observer/installer.go Outdated
Comment thread internal/nonkube/network-observer/installer.go Outdated
Comment thread internal/nonkube/network-observer/systemd.go Outdated
Comment thread internal/nonkube/network-observer/systemd.go Outdated

@fgiorgetti fgiorgetti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@nluaces can we have an option to disable basic auth at all?
Eventually configure the host to be bound as well?

@nluaces

nluaces commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@nluaces can we have an option to disable basic auth at all? Eventually configure the host to be bound as well?

@fgiorgetti I was planning to remove basic auth, nginx and the generated certs like Christian suggested. Does it work for you?

@fgiorgetti

Copy link
Copy Markdown
Member

@nluaces can we have an option to disable basic auth at all? Eventually configure the host to be bound as well?

@fgiorgetti I was planning to remove basic auth, nginx and the generated certs like Christian suggested. Does it work for you?

Yes @nluaces ! Thank you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
internal/nonkube/network-observer/installer.go (1)

134-151: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Broken Authentication (CWE-306): Missing Authentication for Critical Function

Reachability: External

Protect the network-observer HTTP endpoint bound by the default installation

The nonkube installer starts the observer container with -listen=:{{NetobsPort}} in systemd.go and returns an http://localhost:... URL in installer.go, so any local user accessing that address can reach the observer API without credentials. Add authentication for the observer endpoint and require TLS when the port cannot be guaranteed loopback-only; make binding to other interfaces opt-in.

internal/nonkube/network-observer/systemd.go (1)

251-265: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Stop and disable every generated unit before deleting its files.

CreateServices() enables the main, Prometheus, and app units, but RemoveServices() only calls stopAndDisableService() for the main unit. Add the same unit not-found handling and iterate over all three units so the Prometheus and app enablement symlinks are removed and their containers are stopped before deleting the unit files.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9801bc60-8b74-476b-bb4b-c0fb6a443253

📥 Commits

Reviewing files that changed from the base of the PR and between 0934b33 and 8bd5f0d.

📒 Files selected for processing (13)
  • internal/cmd/skupper/common/flags.go
  • internal/cmd/skupper/system/nonkube/system_network-observer.go
  • internal/cmd/skupper/system/nonkube/system_network-observer_test.go
  • internal/cmd/skupper/system/nonkube/system_uninstall.go
  • internal/cmd/skupper/system/nonkube/system_uninstall_test.go
  • internal/cmd/skupper/system/system.go
  • internal/cmd/skupper/system/system_test.go
  • internal/images/image_utils.go
  • internal/images/images.go
  • internal/nonkube/network-observer/config_templates.go
  • internal/nonkube/network-observer/containers.go
  • internal/nonkube/network-observer/installer.go
  • internal/nonkube/network-observer/systemd.go
💤 Files with no reviewable changes (5)
  • internal/nonkube/network-observer/config_templates.go
  • internal/images/images.go
  • internal/cmd/skupper/common/flags.go
  • internal/images/image_utils.go
  • internal/cmd/skupper/system/system_test.go

Comment thread internal/cmd/skupper/system/system.go Outdated
Comment thread internal/nonkube/network-observer/installer.go Outdated
Comment thread internal/nonkube/network-observer/systemd.go Outdated
Comment thread internal/nonkube/network-observer/systemd.go Outdated
Comment thread internal/nonkube/network-observer/containers.go Outdated
Comment thread internal/nonkube/network-observer/containers.go Outdated
Comment thread internal/nonkube/network-observer/containers.go Outdated
Comment thread internal/nonkube/network-observer/systemd.go
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.

Include Network Observer feature in system sites

3 participants