mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 09:37:15 +00:00
style: format all files with prettier
This commit is contained in:
@@ -14,6 +14,7 @@ This skill provides step-by-step instructions for building production-ready Helm
|
||||
## When to Use This Skill
|
||||
|
||||
Use this skill when you need to:
|
||||
|
||||
- Create new Helm charts from scratch
|
||||
- Package Kubernetes applications for distribution
|
||||
- Manage multi-environment deployments with Helm
|
||||
@@ -24,6 +25,7 @@ Use this skill when you need to:
|
||||
## Helm Overview
|
||||
|
||||
**Helm** is the package manager for Kubernetes that:
|
||||
|
||||
- Templates Kubernetes manifests for reusability
|
||||
- Manages application releases and rollbacks
|
||||
- Handles dependencies between charts
|
||||
@@ -35,11 +37,13 @@ Use this skill when you need to:
|
||||
### 1. Initialize Chart Structure
|
||||
|
||||
**Create new chart:**
|
||||
|
||||
```bash
|
||||
helm create my-app
|
||||
```
|
||||
|
||||
**Standard chart structure:**
|
||||
|
||||
```
|
||||
my-app/
|
||||
├── Chart.yaml # Chart metadata
|
||||
@@ -67,7 +71,7 @@ apiVersion: v2
|
||||
name: my-app
|
||||
description: A Helm chart for My Application
|
||||
type: application
|
||||
version: 1.0.0 # Chart version
|
||||
version: 1.0.0 # Chart version
|
||||
appVersion: "2.1.0" # Application version
|
||||
|
||||
# Keywords for chart discovery
|
||||
@@ -180,6 +184,7 @@ redis:
|
||||
**Use Go templating with Helm functions:**
|
||||
|
||||
**templates/deployment.yaml:**
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -214,7 +219,8 @@ spec:
|
||||
|
||||
### 5. Create Template Helpers
|
||||
|
||||
**templates/_helpers.tpl:**
|
||||
**templates/\_helpers.tpl:**
|
||||
|
||||
```yaml
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
@@ -263,6 +269,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
### 6. Manage Dependencies
|
||||
|
||||
**Add dependencies in Chart.yaml:**
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
@@ -272,12 +279,14 @@ dependencies:
|
||||
```
|
||||
|
||||
**Update dependencies:**
|
||||
|
||||
```bash
|
||||
helm dependency update
|
||||
helm dependency build
|
||||
```
|
||||
|
||||
**Override dependency values:**
|
||||
|
||||
```yaml
|
||||
# values.yaml
|
||||
postgresql:
|
||||
@@ -295,6 +304,7 @@ postgresql:
|
||||
### 7. Test and Validate
|
||||
|
||||
**Validation commands:**
|
||||
|
||||
```bash
|
||||
# Lint the chart
|
||||
helm lint my-app/
|
||||
@@ -313,6 +323,7 @@ helm show values ./my-app
|
||||
```
|
||||
|
||||
**Validation script:**
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
@@ -334,12 +345,14 @@ echo "All validations passed!"
|
||||
### 8. Package and Distribute
|
||||
|
||||
**Package the chart:**
|
||||
|
||||
```bash
|
||||
helm package my-app/
|
||||
# Creates: my-app-1.0.0.tgz
|
||||
```
|
||||
|
||||
**Create chart repository:**
|
||||
|
||||
```bash
|
||||
# Create index
|
||||
helm repo index .
|
||||
@@ -350,6 +363,7 @@ aws s3 sync . s3://my-helm-charts/ --exclude "*" --include "*.tgz" --include "in
|
||||
```
|
||||
|
||||
**Use the chart:**
|
||||
|
||||
```bash
|
||||
helm repo add my-repo https://charts.example.com
|
||||
helm repo update
|
||||
@@ -369,6 +383,7 @@ my-app/
|
||||
```
|
||||
|
||||
**values-prod.yaml:**
|
||||
|
||||
```yaml
|
||||
replicaCount: 5
|
||||
|
||||
@@ -404,6 +419,7 @@ postgresql:
|
||||
```
|
||||
|
||||
**Install with environment:**
|
||||
|
||||
```bash
|
||||
helm install my-app ./my-app -f values-prod.yaml --namespace production
|
||||
```
|
||||
@@ -411,6 +427,7 @@ helm install my-app ./my-app -f values-prod.yaml --namespace production
|
||||
### 10. Implement Hooks and Tests
|
||||
|
||||
**Pre-install hook:**
|
||||
|
||||
```yaml
|
||||
# templates/pre-install-job.yaml
|
||||
apiVersion: batch/v1
|
||||
@@ -432,6 +449,7 @@ spec:
|
||||
```
|
||||
|
||||
**Test connection:**
|
||||
|
||||
```yaml
|
||||
# templates/tests/test-connection.yaml
|
||||
apiVersion: v1
|
||||
@@ -450,6 +468,7 @@ spec:
|
||||
```
|
||||
|
||||
**Run tests:**
|
||||
|
||||
```bash
|
||||
helm test my-app
|
||||
```
|
||||
@@ -515,17 +534,20 @@ image: {{ .Values.global.imageRegistry }}/{{ .Values.image.repository }}
|
||||
## Troubleshooting
|
||||
|
||||
**Template rendering errors:**
|
||||
|
||||
```bash
|
||||
helm template my-app ./my-app --debug
|
||||
```
|
||||
|
||||
**Dependency issues:**
|
||||
|
||||
```bash
|
||||
helm dependency update
|
||||
helm dependency list
|
||||
```
|
||||
|
||||
**Installation failures:**
|
||||
|
||||
```bash
|
||||
helm install my-app ./my-app --dry-run --debug
|
||||
kubectl get events --sort-by='.lastTimestamp'
|
||||
|
||||
@@ -41,29 +41,29 @@ my-app/
|
||||
### API Version v2 (Helm 3+)
|
||||
|
||||
```yaml
|
||||
apiVersion: v2 # Required: API version
|
||||
name: my-application # Required: Chart name
|
||||
version: 1.2.3 # Required: Chart version (SemVer)
|
||||
appVersion: "2.5.0" # Application version
|
||||
description: A Helm chart for my application # Required
|
||||
type: application # Chart type: application or library
|
||||
keywords: # Search keywords
|
||||
apiVersion: v2 # Required: API version
|
||||
name: my-application # Required: Chart name
|
||||
version: 1.2.3 # Required: Chart version (SemVer)
|
||||
appVersion: "2.5.0" # Application version
|
||||
description: A Helm chart for my application # Required
|
||||
type: application # Chart type: application or library
|
||||
keywords: # Search keywords
|
||||
- web
|
||||
- api
|
||||
- backend
|
||||
home: https://example.com # Project home page
|
||||
sources: # Source code URLs
|
||||
home: https://example.com # Project home page
|
||||
sources: # Source code URLs
|
||||
- https://github.com/example/my-app
|
||||
maintainers: # Maintainer list
|
||||
maintainers: # Maintainer list
|
||||
- name: John Doe
|
||||
email: john@example.com
|
||||
url: https://github.com/johndoe
|
||||
icon: https://example.com/icon.png # Chart icon URL
|
||||
kubeVersion: ">=1.24.0" # Compatible Kubernetes versions
|
||||
deprecated: false # Mark chart as deprecated
|
||||
annotations: # Arbitrary annotations
|
||||
icon: https://example.com/icon.png # Chart icon URL
|
||||
kubeVersion: ">=1.24.0" # Compatible Kubernetes versions
|
||||
deprecated: false # Mark chart as deprecated
|
||||
annotations: # Arbitrary annotations
|
||||
example.com/release-notes: https://example.com/releases/v1.2.3
|
||||
dependencies: # Chart dependencies
|
||||
dependencies: # Chart dependencies
|
||||
- name: postgresql
|
||||
version: "12.0.0"
|
||||
repository: "https://charts.bitnami.com/bitnami"
|
||||
@@ -79,17 +79,21 @@ dependencies: # Chart dependencies
|
||||
## Chart Types
|
||||
|
||||
### Application Chart
|
||||
|
||||
```yaml
|
||||
type: application
|
||||
```
|
||||
|
||||
- Standard Kubernetes applications
|
||||
- Can be installed and managed
|
||||
- Contains templates for K8s resources
|
||||
|
||||
### Library Chart
|
||||
|
||||
```yaml
|
||||
type: library
|
||||
```
|
||||
|
||||
- Shared template helpers
|
||||
- Cannot be installed directly
|
||||
- Used as dependency by other charts
|
||||
@@ -98,6 +102,7 @@ type: library
|
||||
## Values Files Organization
|
||||
|
||||
### values.yaml (defaults)
|
||||
|
||||
```yaml
|
||||
# Global values (shared with subcharts)
|
||||
global:
|
||||
@@ -108,7 +113,7 @@ global:
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: myapp/web
|
||||
tag: "" # Defaults to .Chart.AppVersion
|
||||
tag: "" # Defaults to .Chart.AppVersion
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
# Deployment settings
|
||||
@@ -128,7 +133,7 @@ securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
- ALL
|
||||
|
||||
# Service
|
||||
service:
|
||||
@@ -165,6 +170,7 @@ serviceMonitor:
|
||||
```
|
||||
|
||||
### values.schema.json (validation)
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/schema#",
|
||||
@@ -206,7 +212,8 @@ serviceMonitor:
|
||||
|
||||
### Common Templates
|
||||
|
||||
#### _helpers.tpl
|
||||
#### \_helpers.tpl
|
||||
|
||||
```yaml
|
||||
{{/*
|
||||
Standard naming helpers
|
||||
@@ -261,6 +268,7 @@ Image name helper
|
||||
```
|
||||
|
||||
#### NOTES.txt
|
||||
|
||||
```
|
||||
Thank you for installing {{ .Chart.Name }}.
|
||||
|
||||
@@ -296,13 +304,13 @@ dependencies:
|
||||
- name: postgresql
|
||||
version: "12.0.0"
|
||||
repository: "https://charts.bitnami.com/bitnami"
|
||||
condition: postgresql.enabled # Enable/disable via values
|
||||
tags: # Group dependencies
|
||||
condition: postgresql.enabled # Enable/disable via values
|
||||
tags: # Group dependencies
|
||||
- database
|
||||
import-values: # Import values from subchart
|
||||
import-values: # Import values from subchart
|
||||
- child: database
|
||||
parent: database
|
||||
alias: db # Reference as .Values.db
|
||||
alias: db # Reference as .Values.db
|
||||
```
|
||||
|
||||
### Managing Dependencies
|
||||
@@ -324,9 +332,9 @@ Generated automatically by `helm dependency update`:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 12.0.0
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 12.0.0
|
||||
digest: sha256:abcd1234...
|
||||
generated: "2024-01-01T00:00:00Z"
|
||||
```
|
||||
@@ -374,6 +382,7 @@ crds/
|
||||
```
|
||||
|
||||
**Important CRD notes:**
|
||||
|
||||
- CRDs are installed before any templates
|
||||
- CRDs are NOT templated (no `{{ }}` syntax)
|
||||
- CRDs are NOT upgraded or deleted with chart
|
||||
@@ -393,7 +402,7 @@ crds/
|
||||
- Not required to follow SemVer
|
||||
|
||||
```yaml
|
||||
version: 2.3.1 # Chart version
|
||||
version: 2.3.1 # Chart version
|
||||
appVersion: "1.5.0" # Application version
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user