Skip to content

Commit 69e176c

Browse files
committed
start some cursorrules
1 parent aa047a6 commit 69e176c

File tree

3 files changed

+663
-0
lines changed

3 files changed

+663
-0
lines changed

.cursor/rules/helm.mdc

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
In this project, Helm charts will typically be found in a `/charts/$chart-name` subdirectory.
7+
8+
# Helm Chart Best Practices
9+
10+
This document contains best practices for creating Helm charts, based on the official Helm documentation at https://helm.sh/docs/chart_best_practices/.
11+
12+
## General Conventions
13+
14+
- Chart names should use lowercase letters, numbers, and dashes (no uppercase or underscores)
15+
- Chart names should be descriptive without being too long
16+
- Version numbers should follow SemVer 2 standard
17+
- Reuse official base images for your charts where possible
18+
- Document all chart dependencies
19+
- Keep chart simple and focused on one application per chart
20+
- Ensure your chart properly handles upgrades and rollbacks
21+
22+
## Values
23+
24+
- Use camelCase for key names in values.yaml
25+
- Document all values using comments in values.yaml
26+
- Define sensible defaults that work out-of-the-box
27+
- Use appropriate data types (string, int, boolean, etc.)
28+
- Structure values hierarchically when appropriate
29+
- Mark sensitive values with comments
30+
- Use a flat structure for values that represent environment variables
31+
32+
## Templates
33+
34+
- Clearly structure template files in the templates/ directory
35+
- Use the include function instead of template for reusable template blocks
36+
- Add helpful NOTES.txt for users after installation
37+
- Template functions should use lowercase (e.g., quote not Quote)
38+
- Whitespace formatting: use YAML's indent feature (|-) for readability
39+
- Use standard Kubernetes naming conventions in templates
40+
- Templates should emit valid YAML
41+
- Validate templates with `helm lint` and `helm template`
42+
43+
## Dependencies
44+
45+
- Use the requirements.yaml file to manage dependencies
46+
- Pin versions of dependencies to specific ranges
47+
- Document what your dependencies provide and how they're used
48+
- Set appropriate global values that dependencies can access
49+
- Minimize external dependencies when possible
50+
- Use conditions to enable/disable dependencies where appropriate
51+
52+
## Labels and Annotations
53+
54+
- Include Helm-recommended labels:
55+
- app.kubernetes.io/name
56+
- app.kubernetes.io/instance
57+
- app.kubernetes.io/version
58+
- app.kubernetes.io/managed-by
59+
- helm.sh/chart
60+
- Use namespaces with your custom labels to avoid collisions
61+
- Keep annotations focused on tools that will use them
62+
- Don't use annotations when labels are more appropriate
63+
- Follow Kubernetes label syntax constraints
64+
65+
## Pods and PodTemplates
66+
67+
- Set appropriate container resources (requests and limits)
68+
- Create useful liveness and readiness probes
69+
- Set security context settings appropriately
70+
- Use init containers correctly if needed
71+
- Define suitable update strategies
72+
- Set appropriate termination periods
73+
- Handle persistent volumes properly
74+
75+
## Custom Resource Definitions (CRDs)
76+
77+
- Place CRDs in the crds/ directory (not templates/)
78+
- Document clearly which CRDs your chart requires
79+
- Label your CRDs appropriately
80+
- Consider separation of CRD installation and application installation
81+
- Handle CRD updates carefully (they aren't automatically updated)
82+
83+
## Role-Based Access Control (RBAC)
84+
85+
- Follow principle of least privilege
86+
- Create dedicated ServiceAccounts for your applications
87+
- Create specific Roles rather than using ClusterRoles when possible
88+
- Document all permissions required
89+
- Use templating to allow users to add custom rules
90+
- Set clear namespace restrictions where possible
91+
92+
## References
93+
94+
- [Helm Chart Best Practices](mdc:https:/helm.sh/docs/chart_best_practices)
95+
- [Helm Documentation](mdc:https:/helm.sh/docs)

0 commit comments

Comments
 (0)