Skip to content

feat(self-managed): add function autoscaler to self-hosted stack - #512

Merged
borao merged 7 commits into
mainfrom
feat/self-managed/add-function-autoscaler
Jul 30, 2026
Merged

feat(self-managed): add function autoscaler to self-hosted stack#512
borao merged 7 commits into
mainfrom
feat/self-managed/add-function-autoscaler

Conversation

@borao

@borao borao commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Add the function autoscaler to the self-hosted stack by default.

Additional Details (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

  • Adds chart-owned self-managed runtime defaults for the function autoscaler env config.
  • Adds the autoscaler metrics port to the chart service/container ports.
  • Adds a default monitor selector for the autoscaler ServiceMonitor.
  • Adds slim self-managed values wiring for image, vault, and env overrides.
  • Adds the function-autoscaler release to 03-observability.yaml.gotmpl, enabled by default through functionAutoscaler.enabled.

For the Reviewer

Please look closely at:

  • deploy/helm/function-autoscaler/values.yaml
  • deploy/stacks/self-managed/global.yaml.gotmpl
  • deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl

The main intent is to keep the stack-level surface small and leave runtime defaults in the chart.

Issues

Relates to #15

Related context: #480

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features
    • Enabled Function Autoscaler for self-managed installs by default, aligned to image/chart app version 1.18.7.
    • Exposed autoscaler metrics port 41338 and added Control Plane ServiceMonitor integration, honoring disabled-service settings.
  • Deployment Improvements
    • Added deploy-time validations and improved ServiceMonitor rendering logic.
    • Expanded runtime configuration for Cassandra, timeseries, and NVCF API settings (including auth behavior).
  • Bug Fixes
    • Improved JWT handling by using a static Vault-provided access token when available.
  • Documentation
    • Updated the nvcf-openbao-migrations artifact to 0.16.2.

@borao
borao requested review from a team as code owners July 28, 2026 21:09
@borao
borao requested a review from along-2017 July 28, 2026 21:09
@coderabbitai

coderabbitai Bot commented Jul 28, 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 self-managed deployment configuration for function-autoscaler, including runtime settings, static-token authentication, metrics exposure, Helmfile release wiring, configuration validation, version metadata, and ServiceMonitor integration.

Changes

Function Autoscaler Integration

Layer / File(s) Summary
Autoscaler runtime and authentication configuration
deploy/helm/function-autoscaler/values.yaml, deploy/helm/function-autoscaler/vault-agent-templates/secrets.json.tmpl, src/control-plane-services/function-autoscaler/crates/server/src/secrets/secrets_config.rs, src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/nvcf_client.rs
Adds metrics exposure, runtime environment settings, Vault-backed access-token rendering, optional credential fields, and default OAuth2 API address deserialization.
Self-managed release wiring
deploy/stacks/self-managed/environments/base.yaml, deploy/stacks/self-managed/global.yaml.gotmpl, deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl
Enables the autoscaler, renders its Helm values, validates observability and TSDB settings, and adds the release with a state-metrics dependency.
Static token authentication
src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/oauth2_client.rs
Uses a non-empty static access token before cached-token validation or OAuth2 refresh and tests that behavior.
Autoscaler ServiceMonitor integration
deploy/stacks/observability/charts/nvcf-default-monitors/*, deploy/stacks/self-managed/helmfile.d/00-observability-infrastructure.yaml.gotmpl
Adds the function-autoscaler ServiceMonitor and suppresses it when the autoscaler is disabled, with disabled-service list validation.
Release and artifact metadata
deploy/helm/function-autoscaler/Chart.yaml, docs/user/manifest.md, docs/version-catalog/main.yaml
Sets the chart application version to 1.18.7 and updates OpenBao migrations metadata from 0.16.1 to 0.16.2.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Helmfile
  participant GlobalValues
  participant StateMetrics
  participant FunctionAutoscalerChart
  participant ServiceMonitor
  Helmfile->>Helmfile: Validate autoscaler and observability settings
  Helmfile->>GlobalValues: Render functionautoscaler values
  Helmfile->>StateMetrics: Wait for nvcf/state-metrics
  Helmfile->>FunctionAutoscalerChart: Install enabled release
  FunctionAutoscalerChart->>ServiceMonitor: Expose metrics service on TCP 41338
  ServiceMonitor->>FunctionAutoscalerChart: Scrape selected metrics endpoint
Loading

Possibly related PRs

  • NVIDIA/nvcf#480: Adds observability infrastructure wiring extended here with function-autoscaler disabled-service handling.
  • NVIDIA/nvcf#509: Adds overlapping function-autoscaler observability profile, validation, and release gating changes.

Suggested reviewers: kristinapathak, apartha-nv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the main change: adding the function autoscaler to the self-managed stack.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/self-managed/add-function-autoscaler
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/self-managed/add-function-autoscaler

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

@bright-poku bright-poku left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM ✅. tested from scratch on k3d, full stack comes up 2/2 (obs infra + state-metrics + autoscaler), and the new autoscaler ServiceMonitor is scraping its nvcf_autoscaler_* metrics into VM. Looks good

@borao
borao force-pushed the feat/self-managed/add-function-autoscaler branch from cf9a682 to cf790c6 Compare July 29, 2026 20:48

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl`:
- Around line 9-32: Add Helmfile render tests covering invalid observability
modes and value types, missing TIMESERIES_DB__TIMESERIES_DB_URL requirements,
the functionAutoscaler dependency on state-metrics, and disabled ServiceMonitor
behavior. Exercise the validation around observability, functionAutoscaler, and
victoriaMetrics values, and verify rendering fails or succeeds according to the
deployment contract.
- Around line 22-31: Validate the types of the values assigned to
$functionAutoscalerEnabled and $functionAutoscalerTsdbURL before the existing
mode guards use them: require enabled to be a boolean and the Timeseries DB URL
to be a string, failing template rendering for invalid inputs. Preserve the
current default values and validation behavior for correctly typed values.
- Around line 24-31: The validation around functionAutoscalerEnabled must also
require stateMetrics.enabled=true, matching its unconditional dependency on
nvcf/state-metrics. Update the existing Helm template checks near the
functionAutoscaler validation to fail with a clear message when
functionAutoscaler is enabled while stateMetrics is disabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: abda161f-616a-4345-8494-9a6cbae5c2fb

📥 Commits

Reviewing files that changed from the base of the PR and between cf9a682 and cf790c6.

📒 Files selected for processing (7)
  • deploy/helm/function-autoscaler/values.yaml
  • deploy/stacks/observability/charts/nvcf-default-monitors/templates/controlplane-servicemonitors.yaml
  • deploy/stacks/observability/charts/nvcf-default-monitors/values.yaml
  • deploy/stacks/self-managed/environments/base.yaml
  • deploy/stacks/self-managed/global.yaml.gotmpl
  • deploy/stacks/self-managed/helmfile.d/00-observability-infrastructure.yaml.gotmpl
  • deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl
🚧 Files skipped from review as they are similar to previous changes (3)
  • deploy/stacks/self-managed/environments/base.yaml
  • deploy/helm/function-autoscaler/values.yaml
  • deploy/stacks/self-managed/global.yaml.gotmpl

Comment thread deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl Outdated
Comment thread deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl Outdated
Comment thread deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl Outdated
Comment thread deploy/helm/function-autoscaler/values.yaml Outdated
Comment thread deploy/helm/function-autoscaler/values.yaml Outdated
Comment thread deploy/stacks/observability/charts/nvcf-default-monitors/values.yaml Outdated
Comment thread deploy/stacks/self-managed/environments/base.yaml Outdated
Comment thread deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl Outdated

@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.

🧹 Nitpick comments (1)
src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/oauth2_client.rs (1)

186-189: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid re-entering the static-token branch on every refresh interval.

This path returns the watcher token without populating token_cache, so the background task continues seeing an empty cache and logs a successful “refresh” every interval. Skip background refresh while a static token is configured, or cache it with an explicit rotation/expiry strategy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/oauth2_client.rs`
around lines 186 - 189, Update the access-token handling around the static-token
branch in the OAuth2 client so a configured watcher token does not trigger
repeated background refresh attempts. Either bypass refresh scheduling while the
static token is present, or populate token_cache using an explicit
rotation/expiry strategy; preserve dynamic-token refresh behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/oauth2_client.rs`:
- Around line 186-189: Update the access-token handling around the static-token
branch in the OAuth2 client so a configured watcher token does not trigger
repeated background refresh attempts. Either bypass refresh scheduling while the
static token is present, or populate token_cache using an explicit
rotation/expiry strategy; preserve dynamic-token refresh behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a8a005c4-b31b-48a2-819e-661cf0a17728

📥 Commits

Reviewing files that changed from the base of the PR and between 8926ceb and 871288c.

📒 Files selected for processing (5)
  • deploy/helm/function-autoscaler/values.yaml
  • deploy/helm/function-autoscaler/vault-agent-templates/secrets.json.tmpl
  • deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl
  • src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/oauth2_client.rs
  • src/control-plane-services/function-autoscaler/crates/server/src/secrets/secrets_config.rs

@borao
borao requested a review from a team as a code owner July 29, 2026 23: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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/user/manifest.md`:
- Line 160: Regenerate the generated manifest block instead of editing
docs/user/manifest.md directly: update the nvcf-openbao-migrations version in
docs/version-catalog/main.yaml, then run the docs version-sync generator and the
specified version-sync and documentation validation commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e12ee45c-303a-427a-8eb4-f11305a81584

📥 Commits

Reviewing files that changed from the base of the PR and between 871288c and 8f5c854.

📒 Files selected for processing (6)
  • deploy/helm/function-autoscaler/Chart.yaml
  • deploy/stacks/self-managed/environments/base.yaml
  • deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl
  • docs/user/manifest.md
  • docs/version-catalog/main.yaml
  • src/control-plane-services/function-autoscaler/crates/server/src/nvcf_api/nvcf_client.rs
💤 Files with no reviewable changes (2)
  • deploy/stacks/self-managed/environments/base.yaml
  • deploy/stacks/self-managed/helmfile.d/03-observability.yaml.gotmpl

Comment thread docs/user/manifest.md
@borao
borao force-pushed the feat/self-managed/add-function-autoscaler branch from 8f5c854 to 2e8a202 Compare July 29, 2026 23:50
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis

🚨 Found 2 issue(s)

Severity Breakdown:

  • 🔴 Errors: 0
  • 🟡 Warnings: 0
  • 🔵 Notes: 0
📋 Top Issues

🔗 View full details in Security tab

🕐 Last updated: 2026-07-29 23:53:02 UTC | Commit: 2e8a202

Comment thread deploy/helm/function-autoscaler/Chart.yaml Outdated
borao added 7 commits July 29, 2026 22:52
Wire the self-managed observability helmfile to deploy the function autoscaler when enabled.

Keep runtime defaults in the function autoscaler chart and expose only slim stack-level image and env overrides.

Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
@borao
borao force-pushed the feat/self-managed/add-function-autoscaler branch from 033ee0d to bfd069b Compare July 30, 2026 05:52
@borao
borao enabled auto-merge July 30, 2026 05:54
@borao
borao added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 6e96474 Jul 30, 2026
20 checks passed
@borao
borao deleted the feat/self-managed/add-function-autoscaler branch July 30, 2026 06:21
@balajinvda

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version nvcf-function-autoscaler-v1.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@balajinvda

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version helm-nvcf-function-autoscaler-v0.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants