From a99be0bd93f1cd0b740e523e8177f287ab5e50d0 Mon Sep 17 00:00:00 2001 From: Isaac Johnson Date: Fri, 30 Oct 2026 05:56:46 -0500 Subject: [PATCH] semi-working draft --- helm-chart/Chart.yaml | 2 +- helm-chart/templates/NOTES.txt | 28 +++++++++++++++++++++++++ helm-chart/templates/deployment.yaml | 31 ++++++++++++++++++++++++++++ helm-chart/values.yaml | 24 +++++++++++++++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 helm-chart/templates/NOTES.txt diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 786aded..f088ac5 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -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" diff --git a/helm-chart/templates/NOTES.txt b/helm-chart/templates/NOTES.txt new file mode 100644 index 0000000..9cef086 --- /dev/null +++ b/helm-chart/templates/NOTES.txt @@ -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 }} diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml index 172900e..2ba7134 100644 --- a/helm-chart/templates/deployment.yaml +++ b/helm-chart/templates/deployment.yaml @@ -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 }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 442d492..25feb95 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -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: (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"