talkops-helm-mcp-server 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. helm_mcp_server/__init__.py +4 -0
  2. helm_mcp_server/config.py +83 -0
  3. helm_mcp_server/exceptions/__init__.py +18 -0
  4. helm_mcp_server/exceptions/custom.py +54 -0
  5. helm_mcp_server/main.py +40 -0
  6. helm_mcp_server/prompts/__init__.py +33 -0
  7. helm_mcp_server/prompts/base.py +42 -0
  8. helm_mcp_server/prompts/installation_prompts.py +69 -0
  9. helm_mcp_server/prompts/registry.py +33 -0
  10. helm_mcp_server/prompts/rollback_prompts.py +213 -0
  11. helm_mcp_server/prompts/security_prompts.py +133 -0
  12. helm_mcp_server/prompts/troubleshooting_prompts.py +155 -0
  13. helm_mcp_server/prompts/upgrade_prompts.py +58 -0
  14. helm_mcp_server/prompts/workflow_prompts.py +180 -0
  15. helm_mcp_server/resources/__init__.py +29 -0
  16. helm_mcp_server/resources/base.py +42 -0
  17. helm_mcp_server/resources/chart_resources.py +117 -0
  18. helm_mcp_server/resources/helm_resources.py +82 -0
  19. helm_mcp_server/resources/kubernetes_resources.py +55 -0
  20. helm_mcp_server/resources/registry.py +38 -0
  21. helm_mcp_server/resources/static_resources.py +53 -0
  22. helm_mcp_server/scripts/scrape_helm_best_practices.py +120 -0
  23. helm_mcp_server/server/__init__.py +10 -0
  24. helm_mcp_server/server/bootstrap.py +50 -0
  25. helm_mcp_server/server/core.py +49 -0
  26. helm_mcp_server/server/middleware.py +130 -0
  27. helm_mcp_server/services/__init__.py +12 -0
  28. helm_mcp_server/services/helm_service.py +1882 -0
  29. helm_mcp_server/services/kubernetes_service.py +429 -0
  30. helm_mcp_server/services/validation_service.py +206 -0
  31. helm_mcp_server/static/HELM_BEST_PRACTICES.md +831 -0
  32. helm_mcp_server/static/HELM_MCP_INSTRUCTIONS.md +190 -0
  33. helm_mcp_server/static/HELM_WORKFLOW_GUIDE.md +554 -0
  34. helm_mcp_server/static/__init__.py +0 -0
  35. helm_mcp_server/tools/__init__.py +31 -0
  36. helm_mcp_server/tools/base.py +45 -0
  37. helm_mcp_server/tools/discovery/__init__.py +6 -0
  38. helm_mcp_server/tools/discovery/chart_discovery.py +307 -0
  39. helm_mcp_server/tools/installation/__init__.py +6 -0
  40. helm_mcp_server/tools/installation/chart_management.py +553 -0
  41. helm_mcp_server/tools/kubernetes/__init__.py +6 -0
  42. helm_mcp_server/tools/kubernetes/cluster_ops.py +319 -0
  43. helm_mcp_server/tools/monitoring/__init__.py +6 -0
  44. helm_mcp_server/tools/monitoring/deployment_monitor.py +183 -0
  45. helm_mcp_server/tools/registry.py +38 -0
  46. helm_mcp_server/tools/validation/__init__.py +6 -0
  47. helm_mcp_server/tools/validation/chart_validation.py +420 -0
  48. helm_mcp_server/utils/__init__.py +11 -0
  49. helm_mcp_server/utils/helm_helper.py +70 -0
  50. talkops_helm_mcp_server-0.3.0.dist-info/METADATA +676 -0
  51. talkops_helm_mcp_server-0.3.0.dist-info/RECORD +53 -0
  52. talkops_helm_mcp_server-0.3.0.dist-info/WHEEL +4 -0
  53. talkops_helm_mcp_server-0.3.0.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,4 @@
1
+ """Helm MCP Server package."""
2
+
3
+ __version__ = '1.0.0'
4
+
@@ -0,0 +1,83 @@
1
+ """Application configuration management."""
2
+
3
+ import os
4
+ from dataclasses import dataclass, field
5
+ from typing import Optional
6
+ from pathlib import Path
7
+
8
+
9
+ @dataclass
10
+ class HelmConfig:
11
+ """Helm configuration."""
12
+ timeout: int = 300
13
+ repositories: list[str] = field(default_factory=lambda: ['bitnami'])
14
+ max_concurrent_operations: int = 10
15
+
16
+
17
+ @dataclass
18
+ class KubernetesConfig:
19
+ """Kubernetes configuration."""
20
+ timeout: int = 30
21
+ verify_ssl: bool = True
22
+ connection_pool_size: int = 10
23
+ kubeconfig: Optional[str] = None
24
+
25
+
26
+ @dataclass
27
+ class LoggingConfig:
28
+ """Logging configuration."""
29
+ level: str = 'INFO'
30
+ format: str = 'json'
31
+ file_path: str = './logs/mcp_server.log'
32
+ max_bytes: int = 10485760 # 10MB
33
+
34
+
35
+ @dataclass
36
+ class ServerConfig:
37
+ """MCP server configuration."""
38
+ name: str = 'helm-mcp-server'
39
+ version: str = '0.2.0'
40
+ transport: str = 'http' # http (Streamable HTTP) or stdio
41
+ host: str = '0.0.0.0'
42
+ port: int = 8765 # HTTP/SSE server port
43
+ path: str = '/mcp' # MCP endpoint path
44
+ allow_write: bool = False # Enable write access for mutating operations
45
+ # HTTP server timeout settings (in seconds)
46
+ http_timeout: int = 300 # HTTP request timeout
47
+ http_keepalive_timeout: int = 5 # HTTP keepalive timeout
48
+ http_connect_timeout: int = 60 # HTTP connection timeout
49
+
50
+ helm: HelmConfig = field(default_factory=HelmConfig)
51
+ kubernetes: KubernetesConfig = field(default_factory=KubernetesConfig)
52
+ logging: LoggingConfig = field(default_factory=LoggingConfig)
53
+
54
+
55
+ class Config:
56
+ """Configuration loader."""
57
+
58
+ @staticmethod
59
+ def from_env() -> ServerConfig:
60
+ """Load configuration from environment variables."""
61
+ return ServerConfig(
62
+ name=os.getenv('MCP_SERVER_NAME', 'helm-mcp-server'),
63
+ version=os.getenv('MCP_SERVER_VERSION', '0.2.0'),
64
+ transport=os.getenv('MCP_TRANSPORT', 'http'),
65
+ host=os.getenv('MCP_HOST', '0.0.0.0'),
66
+ port=int(os.getenv('MCP_PORT', '8765')),
67
+ path=os.getenv('MCP_PATH', '/mcp'),
68
+ allow_write=os.getenv('MCP_ALLOW_WRITE', 'true').lower() == 'true',
69
+ http_timeout=int(os.getenv('MCP_HTTP_TIMEOUT', '300')),
70
+ http_keepalive_timeout=int(os.getenv('MCP_HTTP_KEEPALIVE_TIMEOUT', '5')),
71
+ http_connect_timeout=int(os.getenv('MCP_HTTP_CONNECT_TIMEOUT', '60')),
72
+ helm=HelmConfig(
73
+ timeout=int(os.getenv('HELM_TIMEOUT', '300')),
74
+ ),
75
+ kubernetes=KubernetesConfig(
76
+ timeout=int(os.getenv('K8S_TIMEOUT', '30')),
77
+ ),
78
+ logging=LoggingConfig(
79
+ level=os.getenv('MCP_LOG_LEVEL', 'INFO'),
80
+ format=os.getenv('MCP_LOG_FORMAT', 'json'),
81
+ ),
82
+ )
83
+
@@ -0,0 +1,18 @@
1
+ """Exception module."""
2
+
3
+ from helm_mcp_server.exceptions.custom import (
4
+ HelmOperationError,
5
+ KubernetesOperationError,
6
+ HelmResourceError,
7
+ HelmResourceNotFoundError,
8
+ HelmValidationError,
9
+ )
10
+
11
+ __all__ = [
12
+ 'HelmOperationError',
13
+ 'KubernetesOperationError',
14
+ 'HelmResourceError',
15
+ 'HelmResourceNotFoundError',
16
+ 'HelmValidationError',
17
+ ]
18
+
@@ -0,0 +1,54 @@
1
+ """Custom exceptions for Helm MCP server.
2
+
3
+ Following FastMCP exceptions from:
4
+ https://gofastmcp.com/python-sdk/fastmcp-exceptions
5
+ """
6
+
7
+ from fastmcp.exceptions import (
8
+ FastMCPError,
9
+ ToolError,
10
+ ResourceError,
11
+ NotFoundError,
12
+ ValidationError,
13
+ )
14
+
15
+
16
+ class HelmOperationError(ToolError):
17
+ """Error during Helm operations.
18
+
19
+ Inherits from ToolError for tool-related Helm operations.
20
+ """
21
+ pass
22
+
23
+
24
+ class KubernetesOperationError(ToolError):
25
+ """Error during Kubernetes operations.
26
+
27
+ Inherits from ToolError for tool-related Kubernetes operations.
28
+ """
29
+ pass
30
+
31
+
32
+ class HelmResourceError(ResourceError):
33
+ """Error during Helm resource operations.
34
+
35
+ Inherits from ResourceError for resource-related Helm operations.
36
+ """
37
+ pass
38
+
39
+
40
+ class HelmResourceNotFoundError(NotFoundError):
41
+ """Error when a Helm resource is not found.
42
+
43
+ Inherits from NotFoundError for resource not found scenarios.
44
+ """
45
+ pass
46
+
47
+
48
+ class HelmValidationError(ValidationError):
49
+ """Error validating Helm chart parameters or values.
50
+
51
+ Inherits from ValidationError for validation-related errors.
52
+ """
53
+ pass
54
+
@@ -0,0 +1,40 @@
1
+ """Application entry point."""
2
+
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ # Add project root to Python path for direct execution with uv run
7
+ project_root = Path(__file__).parent.parent
8
+ if str(project_root) not in sys.path:
9
+ sys.path.insert(0, str(project_root))
10
+
11
+ from helm_mcp_server.server.bootstrap import ServerBootstrap
12
+
13
+
14
+ def main():
15
+ """Run the MCP server."""
16
+ try:
17
+ mcp, config = ServerBootstrap.initialize()
18
+
19
+ # Run FastMCP server with the configured transport
20
+ if config.transport == 'http':
21
+ # HTTP/Streamable HTTP transport mode (single unified endpoint)
22
+ mcp.run(transport='streamable-http', host=config.host, port=config.port, path=config.path)
23
+ else:
24
+ # STDIO transport mode (default for MCP)
25
+ mcp.run()
26
+
27
+ except KeyboardInterrupt:
28
+ pass
29
+ except Exception as e:
30
+ raise
31
+
32
+
33
+ def cli():
34
+ """CLI entry point for the helm-mcp-server command."""
35
+ main()
36
+
37
+
38
+ if __name__ == '__main__':
39
+ cli()
40
+
@@ -0,0 +1,33 @@
1
+ """Prompts module initialization."""
2
+
3
+ from typing import Dict, Any
4
+ from helm_mcp_server.prompts.registry import PromptRegistry
5
+ from helm_mcp_server.prompts.installation_prompts import InstallationPrompts
6
+ from helm_mcp_server.prompts.troubleshooting_prompts import TroubleshootingPrompts
7
+ from helm_mcp_server.prompts.security_prompts import SecurityPrompts
8
+ from helm_mcp_server.prompts.upgrade_prompts import UpgradePrompts
9
+ from helm_mcp_server.prompts.rollback_prompts import RollbackPrompts
10
+ from helm_mcp_server.prompts.workflow_prompts import WorkflowPrompts
11
+
12
+
13
+ def initialize_prompts(service_locator: Dict[str, Any]) -> PromptRegistry:
14
+ """Initialize all prompt modules.
15
+
16
+ Args:
17
+ service_locator: Dictionary of services
18
+
19
+ Returns:
20
+ Prompt registry with all prompts registered
21
+ """
22
+ registry = PromptRegistry()
23
+
24
+ # Register prompt groups
25
+ registry.register_prompt(InstallationPrompts(service_locator))
26
+ registry.register_prompt(TroubleshootingPrompts(service_locator))
27
+ registry.register_prompt(SecurityPrompts(service_locator))
28
+ registry.register_prompt(UpgradePrompts(service_locator))
29
+ registry.register_prompt(RollbackPrompts(service_locator))
30
+ registry.register_prompt(WorkflowPrompts(service_locator))
31
+
32
+ return registry
33
+
@@ -0,0 +1,42 @@
1
+ """Base class for all prompts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from abc import ABC, abstractmethod
6
+ from typing import TYPE_CHECKING, Dict, Any
7
+
8
+ if TYPE_CHECKING:
9
+ from helm_mcp_server.services.helm_service import HelmService
10
+ from helm_mcp_server.services.kubernetes_service import KubernetesService
11
+ from helm_mcp_server.services.validation_service import ValidationService
12
+
13
+
14
+ class BasePrompt(ABC):
15
+ """Abstract base class for all prompts.
16
+
17
+ Subclasses implement specific prompt logic while inheriting
18
+ common patterns like dependency injection.
19
+ """
20
+
21
+ helm_service: HelmService
22
+ k8s_service: KubernetesService
23
+ validation_service: ValidationService
24
+
25
+ def __init__(self, service_locator: Dict[str, Any]):
26
+ """Initialize prompt with service locator.
27
+
28
+ Args:
29
+ service_locator: Dictionary of services (helm_service, k8s_service, validation_service, etc.)
30
+ """
31
+ self.helm_service = service_locator.get('helm_service') # type: ignore[assignment]
32
+ self.k8s_service = service_locator.get('k8s_service') # type: ignore[assignment]
33
+ self.validation_service = service_locator.get('validation_service') # type: ignore[assignment]
34
+
35
+ @abstractmethod
36
+ def register(self, mcp_instance) -> None:
37
+ """Register prompts with FastMCP instance.
38
+
39
+ Args:
40
+ mcp_instance: FastMCP server instance
41
+ """
42
+ pass
@@ -0,0 +1,69 @@
1
+ """Installation-related prompts."""
2
+
3
+ from typing import List
4
+ from mcp.types import PromptMessage, TextContent
5
+ from helm_mcp_server.prompts.base import BasePrompt
6
+
7
+
8
+ class InstallationPrompts(BasePrompt):
9
+ """Installation prompts."""
10
+
11
+ def register(self, mcp_instance) -> None:
12
+ """Register prompts with FastMCP."""
13
+
14
+ @mcp_instance.prompt(
15
+ name="helm-installation-guidelines",
16
+ description="Best practices for Helm chart installation",
17
+ )
18
+ def helm_installation_guidelines() -> List[PromptMessage]:
19
+ """Helm installation guidelines and best practices.
20
+
21
+ This prompt provides guidelines for safe Helm chart installation.
22
+ """
23
+ return [
24
+ PromptMessage(
25
+ role="user",
26
+ content=TextContent(
27
+ type="text",
28
+ text="""# Helm Installation Best Practices
29
+
30
+ ## Pre-Installation Checklist
31
+ - [ ] Verify cluster connectivity and permissions
32
+ - [ ] Review chart documentation and release notes
33
+ - [ ] Validate all required configuration values
34
+ - [ ] Check resource availability (CPU, memory, storage)
35
+ - [ ] Plan for rollback if needed
36
+ - [ ] Verify namespace exists or will be created
37
+ - [ ] Check for conflicting releases or resources
38
+
39
+ ## Installation Steps
40
+ 1. **Fetch chart metadata** - Get chart info and schema
41
+ 2. **Validate configuration** - Check values against schema
42
+ 3. **Render manifests** - Preview what will be deployed
43
+ 4. **Dry-run** - Test installation without deploying
44
+ 5. **Review output** - Check for any warnings or errors
45
+ 6. **Get approval** - Ensure stakeholder sign-off
46
+ 7. **Install** - Deploy to cluster
47
+ 8. **Monitor** - Watch pods and services
48
+ 9. **Verify** - Run health checks
49
+ 10. **Document** - Record configuration and access info
50
+
51
+ ## Common Mistakes to Avoid
52
+ - ❌ Not testing with --dry-run first
53
+ - ❌ Using 'latest' version (pin specific versions)
54
+ - ❌ Ignoring resource limits
55
+ - ❌ Not backing up before upgrades
56
+ - ❌ Installing to production without testing first
57
+ - ❌ Forgetting about persistent volumes
58
+ - ❌ Not setting up monitoring/alerting
59
+
60
+ ## Post-Installation
61
+ - Verify all pods are running
62
+ - Check service endpoints are accessible
63
+ - Review logs for any errors
64
+ - Set up monitoring and alerts
65
+ - Document the installation
66
+ - Create runbook for maintenance"""
67
+ )
68
+ )
69
+ ]
@@ -0,0 +1,33 @@
1
+ """Prompt registry for managing all prompts."""
2
+
3
+ from typing import List
4
+ from helm_mcp_server.prompts.base import BasePrompt
5
+
6
+
7
+ class PromptRegistry:
8
+ """Registry for managing prompts.
9
+
10
+ Encapsulates prompt registration and lifecycle.
11
+ """
12
+
13
+ def __init__(self):
14
+ """Initialize registry."""
15
+ self.prompts: List[BasePrompt] = []
16
+
17
+ def register_prompt(self, prompt: BasePrompt) -> None:
18
+ """Register a prompt.
19
+
20
+ Args:
21
+ prompt: Prompt instance
22
+ """
23
+ self.prompts.append(prompt)
24
+
25
+ def register_all_prompts(self, mcp_instance) -> None:
26
+ """Register all prompts with FastMCP instance.
27
+
28
+ Args:
29
+ mcp_instance: FastMCP server instance
30
+ """
31
+ for prompt in self.prompts:
32
+ prompt.register(mcp_instance)
33
+
@@ -0,0 +1,213 @@
1
+ """Rollback-related prompts."""
2
+
3
+ from typing import List
4
+ from mcp.types import PromptMessage, TextContent
5
+ from helm_mcp_server.prompts.base import BasePrompt
6
+
7
+
8
+ class RollbackPrompts(BasePrompt):
9
+ """Rollback prompts."""
10
+
11
+ def register(self, mcp_instance) -> None:
12
+ """Register prompts with FastMCP."""
13
+
14
+ @mcp_instance.prompt(
15
+ name="helm-rollback-procedures",
16
+ description="Step-by-step rollback procedures for Helm releases",
17
+ )
18
+ def helm_rollback_procedures(release_name: str) -> List[PromptMessage]:
19
+ """Step-by-step rollback procedures for Helm releases.
20
+
21
+ Arguments:
22
+ release_name: Name of the Helm release to rollback
23
+ """
24
+ return [
25
+ PromptMessage(
26
+ role="user",
27
+ content=TextContent(
28
+ type="text",
29
+ text=f"""# Helm Rollback Procedures: {release_name}
30
+
31
+ ## When to Rollback
32
+
33
+ Rollback should be considered when:
34
+ - Upgrade or installation fails
35
+ - Application is not functioning correctly after deployment
36
+ - Critical bugs are discovered in new version
37
+ - Performance degradation occurs
38
+ - Data integrity issues are detected
39
+
40
+ ## Pre-Rollback Assessment
41
+
42
+ ### Current State
43
+ - [ ] Identify the issue requiring rollback
44
+ - [ ] Check current release status: `helm status {release_name}`
45
+ - [ ] Review release history: `helm history {release_name}`
46
+ - [ ] Document current problems
47
+ - [ ] Assess impact of rollback
48
+
49
+ ### Release History
50
+ ```bash
51
+ helm history {release_name}
52
+ ```
53
+
54
+ This shows all revisions of the release. Identify which revision to rollback to (typically the previous working version).
55
+
56
+ ## Rollback Process
57
+
58
+ ### Step 1: Review Release History
59
+ ```bash
60
+ # List all revisions
61
+ helm history {release_name}
62
+
63
+ # Get details of specific revision
64
+ helm get values {release_name} --revision <revision-number>
65
+ helm get manifest {release_name} --revision <revision-number>
66
+ ```
67
+
68
+ ### Step 2: Identify Target Revision
69
+ - Review revision numbers
70
+ - Identify last known good revision
71
+ - Verify target revision configuration
72
+ - Check if target revision is stable
73
+
74
+ ### Step 3: Perform Rollback
75
+ ```bash
76
+ # Rollback to previous revision
77
+ helm rollback {release_name}
78
+
79
+ # Rollback to specific revision
80
+ helm rollback {release_name} <revision-number>
81
+
82
+ # Rollback with wait
83
+ helm rollback {release_name} <revision-number> --wait --timeout 10m
84
+ ```
85
+
86
+ ### Step 4: Verify Rollback
87
+ ```bash
88
+ # Check release status
89
+ helm status {release_name}
90
+
91
+ # Verify pods are running
92
+ kubectl get pods -l app.kubernetes.io/instance={release_name}
93
+
94
+ # Check release history
95
+ helm history {release_name}
96
+ ```
97
+
98
+ ## Post-Rollback Verification
99
+
100
+ ### Immediate Checks
101
+ - [ ] Verify release status shows correct revision
102
+ - [ ] Check all pods are running and healthy
103
+ - [ ] Verify services are accessible
104
+ - [ ] Review pod logs for errors
105
+ - [ ] Check for any error events
106
+
107
+ ### Functional Testing
108
+ - [ ] Test application functionality
109
+ - [ ] Verify data integrity
110
+ - [ ] Check service endpoints
111
+ - [ ] Test critical workflows
112
+ - [ ] Monitor application metrics
113
+
114
+ ### Monitoring
115
+ - [ ] Watch pod status for 15-30 minutes
116
+ - [ ] Monitor resource usage
117
+ - [ ] Check application logs
118
+ - [ ] Review metrics and alerts
119
+ - [ ] Verify health checks
120
+
121
+ ## Rollback Scenarios
122
+
123
+ ### Scenario 1: Failed Upgrade
124
+ 1. Upgrade failed mid-process
125
+ 2. Release is in inconsistent state
126
+ 3. Rollback to previous stable revision
127
+ 4. Investigate upgrade failure
128
+ 5. Fix issues before retrying
129
+
130
+ ### Scenario 2: Application Issues
131
+ 1. New version has bugs
132
+ 2. Application not functioning correctly
133
+ 3. Rollback to previous working version
134
+ 4. Report issues to chart maintainers
135
+ 5. Wait for fix before upgrading again
136
+
137
+ ### Scenario 3: Performance Degradation
138
+ 1. New version performs worse
139
+ 2. Resource usage increased significantly
140
+ 3. Rollback to previous version
141
+ 4. Analyze performance differences
142
+ 5. Optimize before upgrading
143
+
144
+ ## Best Practices
145
+
146
+ ### Before Rollback
147
+ - ✅ Document the reason for rollback
148
+ - ✅ Review release history carefully
149
+ - ✅ Verify target revision is stable
150
+ - ✅ Backup current state if possible
151
+ - ✅ Notify stakeholders
152
+
153
+ ### During Rollback
154
+ - ✅ Use `--wait` flag to ensure completion
155
+ - ✅ Monitor rollback progress
156
+ - ✅ Watch for any errors
157
+ - ✅ Verify each step completes
158
+
159
+ ### After Rollback
160
+ - ✅ Document rollback in change log
161
+ - ✅ Investigate root cause
162
+ - ✅ Fix issues before retrying
163
+ - ✅ Update runbooks if needed
164
+ - ✅ Share lessons learned
165
+
166
+ ## Troubleshooting Rollback Issues
167
+
168
+ ### Rollback Fails
169
+ 1. Check release history for available revisions
170
+ 2. Verify target revision exists
171
+ 3. Check for resource conflicts
172
+ 4. Review Kubernetes events
173
+ 5. Try manual rollback if needed
174
+
175
+ ### Partial Rollback
176
+ 1. Check which resources rolled back
177
+ 2. Manually fix remaining resources if needed
178
+ 3. Verify all components are consistent
179
+ 4. Consider full uninstall/reinstall if severe
180
+
181
+ ### Data Concerns
182
+ 1. Verify data persistence (if applicable)
183
+ 2. Check for data corruption
184
+ 3. Review backup availability
185
+ 4. Consider data migration if needed
186
+
187
+ ## Alternative: Manual Rollback
188
+
189
+ If `helm rollback` doesn't work:
190
+
191
+ ```bash
192
+ # Get previous revision values
193
+ helm get values {release_name} --revision <previous-revision> > values.yaml
194
+
195
+ # Get previous revision chart version
196
+ helm get manifest {release_name} --revision <previous-revision>
197
+
198
+ # Manually upgrade to previous configuration
199
+ helm upgrade {release_name} <previous-chart-version> --values values.yaml
200
+ ```
201
+
202
+ ## Prevention
203
+
204
+ To avoid needing rollbacks:
205
+ - Always test upgrades in non-production
206
+ - Review changelogs and breaking changes
207
+ - Use dry-run before actual upgrades
208
+ - Have rollback plan ready
209
+ - Monitor closely after upgrades
210
+ - Keep backups current"""
211
+ )
212
+ )
213
+ ]