mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 10:02:28 +02:00
feat: kubedog integration with unified resource handling (#2383)
* feat: add kubedog-based resource tracking integration Add kubedog tracking as an alternative to Helm's --wait flag with: - Real-time deployment progress tracking - Container log streaming - Fine-grained resource filtering (trackKinds/skipKinds/trackResources) Features: - New pkg/resource package for unified manifest parsing and filtering - New pkg/kubedog package wrapping kubedog library - CLI flags: --track-mode, --track-timeout, --track-logs - Helmfile YAML support for trackMode, trackTimeout, trackLogs, trackKinds, skipKinds, trackResources - Case-insensitive kind matching for filtering - Multi-context support with proper kubeconfig/kubeContext handling Tracking supports: Deployment, StatefulSet, DaemonSet, Job Resource filtering priority (highest to lowest): 1. trackResources - explicit resource whitelist 2. skipKinds - blacklist specific kinds 3. trackKinds - whitelist specific kinds Integration: - Disable Helm --wait when using kubedog tracking - Track after successful Helm sync/apply - Respect release.Namespace as fallback for resources without namespace - Use getKubeContext() for correct cluster targeting Tests: - Unit tests for resource filtering and kubedog options - Integration test with httpbin chart - E2E snapshot tests for YAML serialization - Documentation in docs/advanced-features.md Signed-off-by: yxxhero <aiopsclub@163.com> * fix: address PR #2383 review comments (round 4) 1. resource/filter.go: Skip empty whitelist entries in matchWhitelist - At least one field (kind/name/namespace) must be specified - Prevents matching all resources with empty TrackResources entries 2. config/apply.go: Add ValidateConfig for track-mode validation - Validate --track-mode must be 'helm' or 'kubedog' - Reject invalid values like --track-mode foo 3. config/sync.go: Add ValidateConfig for track-mode validation - Same validation as apply command - Ensures consistent behavior across commands Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -1,10 +1,97 @@
|
||||
## Advanced Features
|
||||
|
||||
- [Resource Tracking with Kubedog](#resource-tracking-with-kubedog)
|
||||
- [Import Configuration Parameters into Helmfile](#import-configuration-parameters-into-helmfile)
|
||||
- [Deploy Kustomization with Helmfile](#deploy-kustomizations-with-helmfile)
|
||||
- [Adhoc Kustomization of Helm Charts](#adhoc-kustomization-of-helm-charts)
|
||||
- [Adding dependencies without forking the chart](#adding-dependencies-without-forking-the-chart)
|
||||
|
||||
### Resource Tracking with Kubedog
|
||||
|
||||
Helmfile can use [kubedog](https://github.com/werf/kubedog) for advanced resource tracking instead of Helm's built-in `--wait` flag. This provides more detailed feedback and control over deployment progress.
|
||||
|
||||
#### Basic Usage
|
||||
|
||||
Enable kubedog tracking in your `helmfile.yaml`:
|
||||
|
||||
```yaml
|
||||
releases:
|
||||
- name: myapp
|
||||
chart: ./charts/myapp
|
||||
trackMode: kubedog
|
||||
trackTimeout: 300 # seconds
|
||||
trackLogs: true
|
||||
```
|
||||
|
||||
Or use command-line flags:
|
||||
|
||||
```bash
|
||||
helmfile apply --track-mode kubedog --track-timeout 300 --track-logs
|
||||
```
|
||||
|
||||
#### Configuration Options
|
||||
|
||||
- **`trackMode`**: Set to `kubedog` to enable kubedog tracking (default: `helm`)
|
||||
- **`trackTimeout`**: Timeout in seconds for tracking resources (default: 300)
|
||||
- **`trackLogs`**: Enable real-time log streaming from tracked resources
|
||||
|
||||
#### Resource Filtering
|
||||
|
||||
Control which resources to track using whitelist/blacklist:
|
||||
|
||||
```yaml
|
||||
releases:
|
||||
- name: myapp
|
||||
chart: ./charts/myapp
|
||||
trackMode: kubedog
|
||||
# Track only specific resource kinds
|
||||
trackKinds:
|
||||
- Deployment
|
||||
- StatefulSet
|
||||
# Skip certain resource kinds
|
||||
skipKinds:
|
||||
- ConfigMap
|
||||
- Secret
|
||||
```
|
||||
|
||||
#### Specific Resource Tracking
|
||||
|
||||
Track only specific resources by name and namespace:
|
||||
|
||||
```yaml
|
||||
releases:
|
||||
- name: myapp
|
||||
chart: ./charts/myapp
|
||||
trackMode: kubedog
|
||||
trackResources:
|
||||
- kind: Deployment
|
||||
name: myapp-deployment
|
||||
namespace: default
|
||||
- kind: Job
|
||||
name: myapp-job
|
||||
```
|
||||
|
||||
#### Priority Rules
|
||||
|
||||
Resource filtering follows this priority (highest to lowest):
|
||||
|
||||
1. **`trackResources`**: Whitelist specific resources (takes highest priority)
|
||||
2. **`skipKinds`**: Blacklist resource kinds
|
||||
3. **`trackKinds`**: Whitelist resource kinds
|
||||
|
||||
#### Benefits
|
||||
|
||||
- **Real-time feedback**: See deployment progress with detailed status updates
|
||||
- **Log streaming**: View container logs during deployment
|
||||
- **Fine-grained control**: Track only the resources you care about
|
||||
- **Better debugging**: Immediate visibility into deployment issues
|
||||
|
||||
#### Compatibility
|
||||
|
||||
- Kubedog tracking is compatible with Helm 3.x
|
||||
- Kubedog is a compiled dependency and is only used when `trackMode: kubedog` is set
|
||||
- Works with charts that deploy supported workload kinds (currently `Deployment`, `StatefulSet`, `DaemonSet`, and `Job`); other resource kinds are created by Helm/Helmfile as usual but are ignored by the kubedog tracker
|
||||
|
||||
### Import Configuration Parameters into Helmfile
|
||||
|
||||
Helmfile integrates [vals]() to import configuration parameters from following backends:
|
||||
|
||||
Reference in New Issue
Block a user