Skip to content

Commit 908505f

Browse files
author
jeff nasseri
committed
feat(helm): Add Hello World Helm chart for Kubernetes deployments
Key components included: - Chart.yml with metadata and version information - Standard Kubernetes manifests (deployment, service) - Comprehensive values.yml with sensible defaults - Helper templates for consistent naming and labeling - Detailed README with installation instructions and parameter documentation - .helmignore file for excluding unnecessary files during packaging - NOTES.txt template for post-installation guidance
1 parent 7cb24ab commit 908505f

File tree

8 files changed

+262
-0
lines changed

8 files changed

+262
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

src/helm/src/hello-world/Chart.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
name: hello-world
3+
description: A Helm chart for a simple Hello World application
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.0.0"
7+
maintainers:
8+
- name: Jeff Nasseri
9+
email: jeff@example.com

src/helm/src/hello-world/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Hello World Helm Chart
2+
3+
This is a simple Hello World Helm chart that demonstrates basic Helm functionality.
4+
It deploys an Nginx container that serves a simple webpage.
5+
6+
## Prerequisites
7+
8+
- Kubernetes 1.19+
9+
- Helm 3.2.0+
10+
11+
## Installing the Chart
12+
13+
To install the chart with the release name `my-hello`:
14+
15+
```bash
16+
helm install my-hello ./hello-world
17+
```
18+
19+
## Uninstalling the Chart
20+
21+
To uninstall/delete the `my-hello` release:
22+
23+
```bash
24+
helm uninstall my-hello
25+
```
26+
27+
## Configuration
28+
29+
The following table lists the configurable parameters of the hello-world chart and their default values.
30+
31+
| Parameter | Description | Default |
32+
|-----------------------|----------------------------------|------------------------|
33+
| `replicaCount` | Number of replicas | `1` |
34+
| `image.repository` | Container image repository | `nginx` |
35+
| `image.tag` | Container image tag | `stable` |
36+
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
37+
| `service.type` | Kubernetes Service type | `ClusterIP` |
38+
| `service.port` | Service port | `80` |
39+
| `message` | Message to display | `Hello, World from Helm!` |
40+
| `resources` | CPU/Memory resource requests/limits | See `values.yaml` |
41+
| `nodeSelector` | Node labels for pod assignment | `{}` |
42+
| `tolerations` | Tolerations for pod assignment | `[]` |
43+
| `affinity` | Affinity for pod assignment | `{}` |
44+
45+
## Testing Your MCP Helm Server
46+
47+
You can use this chart to test your MCP Helm server with commands like:
48+
49+
```bash
50+
# Using the hello-world chart
51+
python -m mcp_helm_server --chart-dir ./hello-world
52+
```
53+
54+
This will start the MCP Helm server with the hello-world chart directory. You can then use the server to:
55+
56+
1. Show chart details: `helm_show`
57+
2. Create a template: `helm_template`
58+
3. Lint the chart: `helm_lint`
59+
4. Package the chart: `helm_package`
60+
5. Install the chart: `helm_install`
61+
6. And other operations provided by the MCP Helm server
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Thank you for installing {{ .Chart.Name }}.
2+
3+
Your release is named {{ .Release.Name }}.
4+
5+
To get the application URL, run these commands:
6+
{{- if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "hello-world.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "hello-world.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "hello-world.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "hello-world.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
18+
echo "Visit http://127.0.0.1:8080 to use your application"
19+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
20+
{{- end }}
21+
22+
The current message being displayed is: {{ .Values.message }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "hello-world.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
7+
{{- end }}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "hello-world.fullname" -}}
15+
{{- if .Values.fullnameOverride }}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
17+
{{- else }}
18+
{{- $name := default .Chart.Name .Values.nameOverride }}
19+
{{- if contains $name .Release.Name }}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
21+
{{- else }}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
23+
{{- end }}
24+
{{- end }}
25+
{{- end }}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "hello-world.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
32+
{{- end }}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "hello-world.labels" -}}
38+
helm.sh/chart: {{ include "hello-world.chart" . }}
39+
{{ include "hello-world.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end }}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "hello-world.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "hello-world.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "hello-world.fullname" . }}
5+
labels:
6+
{{- include "hello-world.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "hello-world.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
labels:
15+
{{- include "hello-world.selectorLabels" . | nindent 8 }}
16+
spec:
17+
containers:
18+
- name: {{ .Chart.Name }}
19+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
20+
imagePullPolicy: {{ .Values.image.pullPolicy }}
21+
env:
22+
- name: MESSAGE
23+
value: {{ .Values.message | quote }}
24+
ports:
25+
- name: http
26+
containerPort: 80
27+
protocol: TCP
28+
livenessProbe:
29+
httpGet:
30+
path: /
31+
port: http
32+
readinessProbe:
33+
httpGet:
34+
path: /
35+
port: http
36+
resources:
37+
{{- toYaml .Values.resources | nindent 12 }}
38+
{{- with .Values.nodeSelector }}
39+
nodeSelector:
40+
{{- toYaml . | nindent 8 }}
41+
{{- end }}
42+
{{- with .Values.affinity }}
43+
affinity:
44+
{{- toYaml . | nindent 8 }}
45+
{{- end }}
46+
{{- with .Values.tolerations }}
47+
tolerations:
48+
{{- toYaml . | nindent 8 }}
49+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "hello-world.fullname" . }}
5+
labels:
6+
{{- include "hello-world.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "hello-world.selectorLabels" . | nindent 4 }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Default values for hello-world chart
2+
replicaCount: 1
3+
4+
image:
5+
repository: nginx
6+
tag: stable
7+
pullPolicy: IfNotPresent
8+
9+
nameOverride: ""
10+
fullnameOverride: ""
11+
12+
service:
13+
type: ClusterIP
14+
port: 80
15+
16+
resources:
17+
limits:
18+
cpu: 100m
19+
memory: 128Mi
20+
requests:
21+
cpu: 50m
22+
memory: 64Mi
23+
24+
nodeSelector: {}
25+
26+
tolerations: []
27+
28+
affinity: {}
29+
30+
# Custom message to display
31+
message: "Hello, World from Helm!"

0 commit comments

Comments
 (0)