feat: add init-plugins container for ClawHub plugin installation#3
feat: add init-plugins container for ClawHub plugin installation#3aehrt55 wants to merge 3 commits intofix/gateway-token-stabilityfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an automated plugin installation process using an init container in the deployment template, supported by a new Secret for ClawHub authentication tokens. Feedback points out a critical error regarding a missing Helm template helper for the init container image and recommends removing error suppression in the installation script to ensure that failures are properly surfaced during deployment.
|
|
||
| {{- if .Values.plugins }} | ||
| - name: init-plugins | ||
| image: "{{ include "openclaw-helm.image" . }}" |
There was a problem hiding this comment.
The Helm template helper openclaw-helm.image is not defined in this chart's _helpers.tpl. This will cause a template rendering error and fail the deployment if .Values.plugins is enabled. You should use the image configuration from .Values directly, similar to the other containers in this deployment.
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"| {{- range .Values.plugins }} | ||
| if [ ! -d "/home/node/.openclaw/extensions/{{ . }}" ]; then | ||
| echo "Installing plugin {{ . }} from ClawHub..." | ||
| node dist/index.js plugins install "clawhub:{{ . }}" || true |
There was a problem hiding this comment.
Using || true will suppress any errors from the plugin installation command. This means that if a plugin fails to install (e.g., due to a network issue, a typo in the plugin name, or an invalid token), the init container will still succeed, and the main application will start without the required plugin. This can lead to unexpected runtime failures that are difficult to debug. It's better to let the init container fail so that the problem is immediately visible from the pod status, and Kubernetes can retry according to the pod's restartPolicy.
node dist/index.js plugins install "clawhub:{{ . }}"
🤖 PR ReviewBranch: 📊 Summary
Status: ✅ Ready for merge (1 suggestion deferred to backlog) 🔴 Critical Issues1. ✅ Undefined
|
| # | Suggestion | Agent | Status |
|---|---|---|---|
| 1 | Add optional: true to secretKeyRef for resilience (matches init-config pattern) |
code-reviewer | ✅ Fixed |
| 2 | Directory existence is an unreliable install-success indicator; partial installs persist forever | silent-failure-hunter | ⏭️ N/A — openclaw uses staging + rename pattern; risk is low |
| 3 | Reword sops-specific comment to be tool-agnostic: "Provide via encrypted values file or --set" | comment-analyzer | ✅ Fixed |
| 4 | Soften "higher rate limits" claim — avoid embedding external service behavior assumptions | comment-analyzer | ✅ Fixed — changed to "may provide higher rate limits" and marked as optional |
| 5 | Consider adding values.schema.json for type validation of plugins list and clawhub config |
type-design-analyzer | ⏭️ Deferred to backlog |
✨ Strengths
- Clean conditional structure:
{{- if .Values.plugins }}correctly wraps the entire init container, avoiding unnecessary containers on default installs - Proper Secret management: Token stored in K8s Secret, not as plain env var; Secret only created when both plugins and token are configured
- Idempotent design: Directory existence check prevents re-installing on pod restarts
- Good separation of concerns: ClawHub token only exposed to init-plugins container, not the main container
- Consistent with existing patterns: Follows the
init-skillscontainer structure for volume mounts and conditional logic - Runtime observability: Echo messages in the shell script improve debuggability over the echo-less
init-skillscontainer
📋 Type Design Ratings
| Type | Encap. | Express. | Useful. | Enforce. | Overall |
|---|---|---|---|---|---|
plugins (list of strings) |
5/10 | 4/10 | 7/10 | 3/10 | 5/10 |
clawhub (object w/ token) |
6/10 | 5/10 | 7/10 | 4/10 | 6/10 |
Key concern: No values.schema.json exists for validation. Plugin names have no format enforcement.
🧪 Test Coverage
No automated template tests exist in this chart. The only test is a live cluster integration test (test-connection.yaml) that does not exercise init container logic.
Recommended tests (via helm-unittest):
helm templaterenders successfully with plugins enabled- Secret created only when both plugins and token are set (4 combinations)
- Init container absent when
plugins: [] - Multiple plugins produce correct install commands
CLAWHUB_TOKENenv var conditionally included
🎯 Action Plan
Before Merge:
- Fix undefined
openclaw-helm.imagehelper (Critical feat: add extensibility fields and harden deployment defaults #1) — resolved by rebase onto PR fix: preserve gateway token across helm upgrades #2 - Address
|| truesilent failure suppression (Critical fix: preserve gateway token across helm upgrades #2) — tolerate-partial-failures pattern - Confirm
HOMEenv var intent or align withinit-skills— N/A, design decision documented - Add
set -eto shell script
After Merge (Backlog):
- Add
values.schema.jsonfor plugin/clawhub validation - Add helm-unittest template tests
- Fix same
|| truepattern in pre-existinginit-skillscontainer - Consider version-aware plugin updates (not just directory existence)
Generated by pr-review-and-document skill | Round 1 | [View edit history](click edited)
690bc80 to
43bbaee
Compare
- New init container installs plugins from ClawHub on pod startup - Plugins specified via values.plugins list, skipped if already on PVC - ClawHub auth token managed as a dedicated Secret (clawhub.token) for authenticated downloads with higher rate limits - Token only injected into init-plugins container, not main container Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace || true with tolerate-partial-failures pattern that reports each failed plugin while still attempting all installations. Add set -e, optional: true on secretKeyRef, and clarify values.yaml comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f21295a to
a298c0c
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a298c0c to
94f0710
Compare
Summary
init-pluginsinit container that installs plugins from ClawHub on pod startupvalues.pluginslist, skipped if already present on PVCclawhub.token) for authenticated downloads with higher rate limitsConfiguration
Test plan
pluginslist and verify init-plugins installs from ClawHubclawhub.tokencreates Secret and init-plugins uses authenticated downloadCLAWHUB_TOKENenv varclawhub.tokenand verify unauthenticated install still works🤖 Generated with Claude Code