semi-working draft

This commit is contained in:
Isaac Johnson 2026-10-30 05:56:46 -05:00
parent f8acc55f67
commit a99be0bd93
4 changed files with 84 additions and 1 deletions

View File

@ -2,5 +2,5 @@ apiVersion: v2
name: dadjoke-app
description: A basic Helm chart for the Programming Dad Joke Flask application
type: application
version: 0.1.0
version: 0.1.2
appVersion: "0.1"

View File

@ -0,0 +1,28 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dadjoke-app.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "dadjoke-app.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dadjoke-app.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dadjoke-app.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
{{- if .Values.cloudflared.enabled }}
Cloudflare Ephemeral Quick Tunnel is enabled!
To retrieve your generated *.trycloudflare.com URL, run:
kubectl --namespace {{ .Release.Namespace }} logs deploy/{{ include "dadjoke-app.fullname" . }} -c cloudflared | grep trycloudflare.com
{{- end }}

View File

@ -59,6 +59,37 @@ spec:
timeoutSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.cloudflared.enabled }}
- name: cloudflared
image: "{{ .Values.cloudflared.image.repository }}:{{ .Values.cloudflared.image.tag }}"
imagePullPolicy: {{ .Values.cloudflared.image.pullPolicy }}
command:
- cloudflared
- tunnel
- --no-autoupdate
- --loglevel
- {{ .Values.cloudflared.loglevel | quote }}
- --metrics
- "0.0.0.0:{{ .Values.cloudflared.metricsPort }}"
- --url
- {{ .Values.cloudflared.url | default (printf "http://localhost:%v" (.Values.service.targetPort | default .Values.service.port)) | quote }}
{{- range .Values.cloudflared.extraArgs }}
- {{ . | quote }}
{{- end }}
ports:
- name: cf-metrics
containerPort: {{ .Values.cloudflared.metricsPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /ready
port: cf-metrics
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
resources:
{{- toYaml .Values.cloudflared.resources | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

View File

@ -25,6 +25,30 @@ securityContext:
service:
type: ClusterIP
port: 80
targetPort: 80
# ----------------------------------------------------------------------------
# Cloudflare Quick Tunnel Sidecar Configuration (Ephemeral *.trycloudflare.com)
# ----------------------------------------------------------------------------
cloudflared:
enabled: true
image:
repository: cloudflare/cloudflared
tag: "latest"
pullPolicy: IfNotPresent
# Target URL to tunnel to. Defaults to http://localhost:<service.targetPort> (80)
url: ""
loglevel: info
metricsPort: 2000
# Optional additional arguments to pass to `cloudflared tunnel`
extraArgs: []
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
env:
OLLAMA_HOST: "http://harbor.freshbrewed.science:11444"