From 3d8af6d27f44e6fe0f697a7f97912640432cc7bc Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 13:20:36 +0100 Subject: [PATCH 01/14] chore: wip helm chart configuration --- .gitignore | 5 + Dockerfile | 2 +- Makefile | 30 +++++ README.md | 30 +++++ helm/.helmignore | 24 ++++ helm/Chart.yaml | 17 +++ helm/templates/_helpers.tpl | 63 +++++++++++ helm/templates/deployment.yaml | 85 ++++++++++++++ helm/templates/hpa.yaml | 33 ++++++ helm/templates/ingress.yaml | 42 +++++++ helm/templates/service.yaml | 19 ++++ helm/templates/serviceaccount.yaml | 14 +++ helm/values-dev.yaml | 75 ++++++++++++ helm/values.yaml | 176 +++++++++++++++++++++++++++++ 14 files changed, 614 insertions(+), 1 deletion(-) create mode 100644 helm/.helmignore create mode 100644 helm/Chart.yaml create mode 100644 helm/templates/_helpers.tpl create mode 100644 helm/templates/deployment.yaml create mode 100644 helm/templates/hpa.yaml create mode 100644 helm/templates/ingress.yaml create mode 100644 helm/templates/service.yaml create mode 100644 helm/templates/serviceaccount.yaml create mode 100644 helm/values-dev.yaml create mode 100644 helm/values.yaml diff --git a/.gitignore b/.gitignore index 5ef6a52..5eb4b53 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,8 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# helm +*.tgz +helm/charts/ +helm/*.lock diff --git a/Dockerfile b/Dockerfile index 1009418..8e38501 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN corepack enable && corepack prepare pnpm@10.18.3 --activate WORKDIR /app -# Install dependencies based on the preferred package manager +# Install dependencies COPY package.json pnpm-lock.yaml* ./ RUN pnpm install --frozen-lockfile diff --git a/Makefile b/Makefile index 4033492..c93d153 100644 --- a/Makefile +++ b/Makefile @@ -51,3 +51,33 @@ shell: rebuild: clean build @echo "Rebuild complete" +## Build image for minikube +minikube-build: + @echo "Building image for minikube..." + @eval $$(minikube docker-env) && docker build -t $(IMAGE_NAME):$(IMAGE_TAG) . + @echo "Image built in minikube Docker daemon" + +## Deploy to minikube with Helm +minikube-deploy: minikube-build + @echo "Deploying to minikube..." + @helm upgrade --install toolhive-ui ./helm -f ./helm/values-dev.yaml --wait --timeout=5m + @echo "Deployment complete!" + @echo "" + @echo "To access the application:" + @echo "1. Add to /etc/hosts: echo \"\$$(minikube ip) toolhive-ui.local\" | sudo tee -a /etc/hosts" + @echo "2. Open http://toolhive-ui.local" + +## Uninstall from minikube +minikube-uninstall: + @helm uninstall toolhive-ui || true + @echo "Uninstalled from minikube" + +## View minikube logs +minikube-logs: + @kubectl logs -f deployment/toolhive-ui-toolhive-cloud-ui + +## Port-forward to localhost +minikube-port-forward: + @echo "Forwarding to http://localhost:8080" + @kubectl port-forward svc/toolhive-ui-toolhive-cloud-ui 8080:80 + diff --git a/README.md b/README.md index cd01ecc..dfa09f7 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,39 @@ make clean # Rebuild from scratch make rebuild +``` The application will be available at [http://localhost:3000](http://localhost:3000). +## Kubernetes / Minikube Deployment + +This project includes a complete Helm chart for deploying to Kubernetes (optimized for minikube). + +### Quick Start with Minikube + +```bash +# Deploy to minikube (includes build and deployment) +make minikube-deploy + +# View logs +make minikube-logs + +# Port-forward to localhost:8080 +make minikube-port-forward + +# Uninstall +make minikube-uninstall +``` + +The Helm chart is located in the `helm/` directory and includes: + +- Deployment with configurable replicas +- Service (ClusterIP/NodePort/LoadBalancer) +- Ingress with customizable rules +- Horizontal Pod Autoscaler (optional) +- Configurable resource limits +- Health checks (startup, liveness and readiness probes) + ## Learn More To learn more about Next.js, take a look at the following resources: diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 0000000..898df48 --- /dev/null +++ b/helm/.helmignore @@ -0,0 +1,24 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ + diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..85a80da --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +name: toolhive-cloud-ui +description: A Helm chart for ToolHive Cloud UI - Next.js application +type: application +version: 0.1.0 +appVersion: "0.1.0" +keywords: + - nextjs + - react + - frontend + - ui +home: https://github.com/toolhive/cloud-ui +sources: + - https://github.com/toolhive/cloud-ui +maintainers: + - name: ToolHive Team +kubeVersion: ">=1.24.0-0" diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl new file mode 100644 index 0000000..4e3c138 --- /dev/null +++ b/helm/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "toolhive-cloud-ui.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "toolhive-cloud-ui.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "toolhive-cloud-ui.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "toolhive-cloud-ui.labels" -}} +helm.sh/chart: {{ include "toolhive-cloud-ui.chart" . }} +{{ include "toolhive-cloud-ui.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/component: frontend +app.kubernetes.io/part-of: toolhive +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "toolhive-cloud-ui.selectorLabels" -}} +app.kubernetes.io/name: {{ include "toolhive-cloud-ui.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "toolhive-cloud-ui.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "toolhive-cloud-ui.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml new file mode 100644 index 0000000..3e4bdda --- /dev/null +++ b/helm/templates/deployment.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "toolhive-cloud-ui.fullname" . }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "toolhive-cloud-ui.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "toolhive-cloud-ui.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.targetPort }} + protocol: TCP + {{- if .Values.startupProbe }} + startupProbe: + {{- toYaml .Values.startupProbe | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.envFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + diff --git a/helm/templates/hpa.yaml b/helm/templates/hpa.yaml new file mode 100644 index 0000000..ac62c21 --- /dev/null +++ b/helm/templates/hpa.yaml @@ -0,0 +1,33 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "toolhive-cloud-ui.fullname" . }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "toolhive-cloud-ui.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} + diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000..664e948 --- /dev/null +++ b/helm/templates/ingress.yaml @@ -0,0 +1,42 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "toolhive-cloud-ui.fullname" . }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "toolhive-cloud-ui.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} + diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml new file mode 100644 index 0000000..fa938c1 --- /dev/null +++ b/helm/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "toolhive-cloud-ui.fullname" . }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + {{- include "toolhive-cloud-ui.selectorLabels" . | nindent 4 }} + diff --git a/helm/templates/serviceaccount.yaml b/helm/templates/serviceaccount.yaml new file mode 100644 index 0000000..eb9078c --- /dev/null +++ b/helm/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "toolhive-cloud-ui.serviceAccountName" . }} + labels: + {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} + diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml new file mode 100644 index 0000000..0baadd4 --- /dev/null +++ b/helm/values-dev.yaml @@ -0,0 +1,75 @@ +# Valori per ambiente di sviluppo su minikube +# Usage: helm install toolhive-ui ./helm -f ./helm/values-dev.yaml + +# -- Number of replicas for development +replicaCount: 1 + +image: + # -- Image repository + repository: toolhive-cloud-ui + # -- Never pull from registry, use local image for minikube + pullPolicy: Never + # -- Override with "latest" for local development + tag: "latest" + +service: + type: ClusterIP + port: 80 + targetPort: 3000 + +ingress: + enabled: true + className: "nginx" + hosts: + - host: toolhive-ui.local + paths: + - path: / + pathType: Prefix + +# Risorse ridotte per ambiente di sviluppo +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 100m + memory: 128Mi + +# Probe più veloci e permissive per sviluppo +startupProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 3 + timeoutSeconds: 2 + successThreshold: 1 + failureThreshold: 20 + +livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 5 + +readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + timeoutSeconds: 2 + successThreshold: 1 + failureThreshold: 3 + +# Variabili d'ambiente per sviluppo (esempio) +env: [] +# - name: NEXT_PUBLIC_API_URL +# value: "http://api.toolhive-ui.local" +# - name: NODE_ENV +# value: "development" + diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..61fe7ca --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,176 @@ +# -- Number of replicas for the deployment +replicaCount: 1 + +image: + # -- Image repository + repository: toolhive-cloud-ui + # -- Image pull policy (Never for local development with minikube) + pullPolicy: Never + # -- Overrides the image tag whose default is the chart appVersion + tag: "" + +# -- Secrets for image pull (if using private registry) +imagePullSecrets: [] + +# -- Override the name of the chart +nameOverride: "" + +# -- Override the full name of the resources +fullnameOverride: "" + +serviceAccount: + # -- Specifies whether a service account should be created + create: false + # -- Automatically mount a ServiceAccount's API credentials + automount: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use (if not set and create is true, a name is generated using the fullname template) + name: "" + +# -- Annotations to add to the pod +podAnnotations: {} + +# -- Labels to add to the pod +podLabels: {} + +# -- Security context for the pod +podSecurityContext: + runAsNonRoot: true + runAsUser: 1001 + runAsGroup: 1001 + fsGroup: 1001 + seccompProfile: + type: RuntimeDefault + +# -- Security context for the container +securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1001 + capabilities: + drop: + - ALL + readOnlyRootFilesystem: false + +service: + # -- Kubernetes service type + type: ClusterIP + # -- Service port + port: 80 + # -- Container target port + targetPort: 3000 + # -- NodePort (only used if type is NodePort, range: 30000-32767) + nodePort: null + +ingress: + # -- Enable ingress controller resource + enabled: true + # -- IngressClass that will be used (nginx, traefik, etc.) + className: "nginx" + # -- Additional annotations for the Ingress resource + annotations: + {} + # nginx.ingress.kubernetes.io/rewrite-target: / + # cert-manager.io/cluster-issuer: letsencrypt-prod + # -- Ingress hosts configuration + hosts: + - host: toolhive-ui.local + paths: + - path: / + pathType: Prefix + # -- TLS configuration + tls: [] + # - secretName: toolhive-ui-tls + # hosts: + # - toolhive-ui.local + +# -- Resource limits and requests for the container +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 100m + memory: 128Mi + +# -- Startup probe configuration (checks if app is ready to start) +startupProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 30 + +# -- Liveness probe configuration (checks if app is alive) +livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 3 + +# -- Readiness probe configuration (checks if app can receive traffic) +readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + +autoscaling: + # -- Enable Horizontal Pod Autoscaler + enabled: false + # -- Minimum number of replicas + minReplicas: 1 + # -- Maximum number of replicas + maxReplicas: 5 + # -- Target CPU utilization percentage + targetCPUUtilizationPercentage: 80 + # -- Target memory utilization percentage + # targetMemoryUtilizationPercentage: 80 + +# -- Additional volumes for the pod +volumes: [] +# - name: config +# configMap: +# name: app-config + +# -- Additional volume mounts for the container +volumeMounts: [] +# - name: config +# mountPath: /etc/config +# readOnly: true + +# -- Node labels for pod assignment +nodeSelector: {} + +# -- Tolerations for pod assignment +tolerations: [] + +# -- Affinity rules for pod assignment +affinity: {} + +# -- Environment variables for the container +env: [] +# - name: NEXT_PUBLIC_API_URL +# value: "https://api.example.com" +# - name: NODE_ENV +# value: "production" + +# -- Environment variables from ConfigMaps or Secrets +envFrom: [] +# - configMapRef: +# name: app-config +# - secretRef: +# name: app-secrets + From 730158bcfe06618c99b8d36b7b73649a67f96797 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 13:28:23 +0100 Subject: [PATCH 02/14] leftover --- helm/values-dev.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 0baadd4..64eeb7e 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -1,4 +1,4 @@ -# Valori per ambiente di sviluppo su minikube +# Development values for minikube environment # Usage: helm install toolhive-ui ./helm -f ./helm/values-dev.yaml # -- Number of replicas for development @@ -26,7 +26,7 @@ ingress: - path: / pathType: Prefix -# Risorse ridotte per ambiente di sviluppo +# Reduced resources for development environment resources: limits: cpu: 500m @@ -35,7 +35,7 @@ resources: cpu: 100m memory: 128Mi -# Probe più veloci e permissive per sviluppo +# Faster and more permissive probes for development startupProbe: httpGet: path: / @@ -66,7 +66,7 @@ readinessProbe: successThreshold: 1 failureThreshold: 3 -# Variabili d'ambiente per sviluppo (esempio) +# Environment variables for development (example) env: [] # - name: NEXT_PUBLIC_API_URL # value: "http://api.toolhive-ui.local" From 9e7f7ade7979410331acca8f48a3f17419d7512b Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 14:29:02 +0100 Subject: [PATCH 03/14] refactor: remove ingress --- Makefile | 6 +++--- README.md | 2 +- helm/templates/ingress.yaml | 42 ------------------------------------- helm/values-dev.yaml | 9 -------- helm/values.yaml | 22 ------------------- 5 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 helm/templates/ingress.yaml diff --git a/Makefile b/Makefile index c93d153..b82ab25 100644 --- a/Makefile +++ b/Makefile @@ -63,9 +63,9 @@ minikube-deploy: minikube-build @helm upgrade --install toolhive-ui ./helm -f ./helm/values-dev.yaml --wait --timeout=5m @echo "Deployment complete!" @echo "" - @echo "To access the application:" - @echo "1. Add to /etc/hosts: echo \"\$$(minikube ip) toolhive-ui.local\" | sudo tee -a /etc/hosts" - @echo "2. Open http://toolhive-ui.local" + @echo "To access the application, run:" + @echo " make minikube-port-forward" + @echo "Then open: http://localhost:8080" ## Uninstall from minikube minikube-uninstall: diff --git a/README.md b/README.md index dfa09f7..cad22cf 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ The Helm chart is located in the `helm/` directory and includes: - Deployment with configurable replicas - Service (ClusterIP/NodePort/LoadBalancer) -- Ingress with customizable rules - Horizontal Pod Autoscaler (optional) - Configurable resource limits - Health checks (startup, liveness and readiness probes) +- Security contexts following Pod Security Standards ## Learn More diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml deleted file mode 100644 index 664e948..0000000 --- a/helm/templates/ingress.yaml +++ /dev/null @@ -1,42 +0,0 @@ -{{- if .Values.ingress.enabled -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "toolhive-cloud-ui.fullname" . }} - labels: - {{- include "toolhive-cloud-ui.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.className }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - pathType: {{ .pathType }} - backend: - service: - name: {{ include "toolhive-cloud-ui.fullname" $ }} - port: - number: {{ $.Values.service.port }} - {{- end }} - {{- end }} -{{- end }} - diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 64eeb7e..cfc38d3 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -17,15 +17,6 @@ service: port: 80 targetPort: 3000 -ingress: - enabled: true - className: "nginx" - hosts: - - host: toolhive-ui.local - paths: - - path: / - pathType: Prefix - # Reduced resources for development environment resources: limits: diff --git a/helm/values.yaml b/helm/values.yaml index 61fe7ca..a7db30c 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -63,28 +63,6 @@ service: # -- NodePort (only used if type is NodePort, range: 30000-32767) nodePort: null -ingress: - # -- Enable ingress controller resource - enabled: true - # -- IngressClass that will be used (nginx, traefik, etc.) - className: "nginx" - # -- Additional annotations for the Ingress resource - annotations: - {} - # nginx.ingress.kubernetes.io/rewrite-target: / - # cert-manager.io/cluster-issuer: letsencrypt-prod - # -- Ingress hosts configuration - hosts: - - host: toolhive-ui.local - paths: - - path: / - pathType: Prefix - # -- TLS configuration - tls: [] - # - secretName: toolhive-ui-tls - # hosts: - # - toolhive-ui.local - # -- Resource limits and requests for the container resources: limits: From c01c4f3850c8c478db5abc0030c8f2e49a832409 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 15:27:22 +0100 Subject: [PATCH 04/14] chore: use kind and test helm chart on ci --- .github/workflows/helm-test.yml | 74 +++++++++++++++++++++++++++++ .github/workflows/lint-helm.yml | 46 ++++++++++++++++++ Makefile | 82 ++++++++++++++++++++++++--------- README.md | 40 ++++++++++++---- helm/values-dev.yaml | 6 +-- 5 files changed, 213 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/helm-test.yml create mode 100644 .github/workflows/lint-helm.yml diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml new file mode 100644 index 0000000..7e36f97 --- /dev/null +++ b/.github/workflows/helm-test.yml @@ -0,0 +1,74 @@ +name: Helm Chart Test + +on: + push: + branches: [main] + paths: + - "helm/**" + - ".github/workflows/helm-test.yml" + pull_request: + branches: [main] + paths: + - "helm/**" + - ".github/workflows/helm-test.yml" + +jobs: + test-helm-chart: + name: Test Helm Chart with Kind + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@2856a9e524044420f517685a4655470535401539 # v3.0.0 + + - name: Build Docker image + uses: docker/build-push-action@e2a61776269e8d6936392d704d05a56504c68377 # v6.0.0 + with: + context: . + load: true + tags: toolhive-cloud-ui:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Create Kind cluster + uses: helm/kind-action@026472392573094226832982b6a5182641d20195 # v1.0.0 + with: + cluster_name: toolhive-test + wait: 120s + + - name: Load image into Kind + run: | + kind load docker-image toolhive-cloud-ui:latest --name toolhive-test + + - name: Install Helm chart + run: | + helm upgrade --install toolhive-cloud-ui ./helm \ + -f ./helm/values-dev.yaml \ + --wait \ + --timeout=5m + + - name: Check deployment status + run: | + kubectl get pods -l app.kubernetes.io/name=toolhive-cloud-ui + kubectl get svc -l app.kubernetes.io/name=toolhive-cloud-ui + + - name: Verify application is responding + run: | + kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=toolhive-cloud-ui --timeout=120s + kubectl port-forward svc/toolhive-cloud-ui 8080:80 & + sleep 5 + curl -f http://localhost:8080 || (kubectl logs -l app.kubernetes.io/name=toolhive-cloud-ui && exit 1) + + - name: Run Helm tests (if any) + run: | + helm test toolhive-cloud-ui || echo "No tests defined" + + - name: Show logs on failure + if: failure() + run: | + kubectl get all -l app.kubernetes.io/name=toolhive-cloud-ui + kubectl describe pods -l app.kubernetes.io/name=toolhive-cloud-ui + kubectl logs -l app.kubernetes.io/name=toolhive-cloud-ui --tail=100 diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml new file mode 100644 index 0000000..c284fa3 --- /dev/null +++ b/.github/workflows/lint-helm.yml @@ -0,0 +1,46 @@ +name: Lint Helm Chart + +on: + push: + branches: [main] + paths: + - "helm/**" + - ".github/workflows/lint-helm.yml" + pull_request: + branches: [main] + paths: + - "helm/**" + - ".github/workflows/lint-helm.yml" + +jobs: + lint-chart: + name: Lint Helm Chart + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 + with: + version: "latest" + + - name: Run Helm lint + run: | + helm lint ./helm + helm lint ./helm -f ./helm/values-dev.yaml + + - name: Validate templates + run: | + helm template toolhive-ui ./helm --debug + helm template toolhive-ui ./helm -f ./helm/values-dev.yaml --debug + + - name: Check for Kubernetes API deprecations + uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 + + - name: Run chart-testing (lint) + run: | + ct lint --target-branch main --charts helm/ diff --git a/Makefile b/Makefile index b82ab25..58bc661 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,27 @@ PORT := 3000 ## Show this help message help: - @echo "Available commands:" - @grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' | awk 'NR%2==1{printf "\033[36m%-15s\033[0m ",$$1} NR%2==0{print}' + @echo "ToolHive Cloud UI - Available Commands" + @echo "" + @echo "Docker (Local Development):" + @echo " make build - Build production Docker image" + @echo " make start - Start Docker container" + @echo " make stop - Stop Docker container" + @echo " make logs - View container logs" + @echo " make clean - Remove container and image" + @echo " make rebuild - Clean and rebuild" + @echo "" + @echo "Kind (Kubernetes):" + @echo " make kind-setup - Create cluster and deploy (first time)" + @echo " make kind-create - Create Kind cluster" + @echo " make kind-deploy - Build and deploy to Kind" + @echo " make kind-port-forward - Port-forward to localhost:8080" + @echo " make kind-logs - View application logs" + @echo " make kind-uninstall - Uninstall from Kind" + @echo " make kind-delete - Delete Kind cluster" + @echo "" + @echo "Development:" + @echo " make dev - Run Next.js dev server" ## Build the production docker image build: @@ -51,33 +70,52 @@ shell: rebuild: clean build @echo "Rebuild complete" -## Build image for minikube -minikube-build: - @echo "Building image for minikube..." - @eval $$(minikube docker-env) && docker build -t $(IMAGE_NAME):$(IMAGE_TAG) . - @echo "Image built in minikube Docker daemon" - -## Deploy to minikube with Helm -minikube-deploy: minikube-build - @echo "Deploying to minikube..." - @helm upgrade --install toolhive-ui ./helm -f ./helm/values-dev.yaml --wait --timeout=5m +## Create Kind cluster +kind-create: + @echo "Creating Kind cluster..." + @kind create cluster --name toolhive || echo "Cluster already exists" + @kubectl cluster-info --context kind-toolhive + @echo "Kind cluster ready!" + +## Delete Kind cluster +kind-delete: + @echo "Deleting Kind cluster..." + @kind delete cluster --name toolhive + @echo "Cluster deleted" + +## Build and load image into Kind +kind-build: + @echo "Building Docker image..." + @docker build -t $(IMAGE_NAME):$(IMAGE_TAG) . + @echo "Loading image into Kind cluster..." + @kind load docker-image $(IMAGE_NAME):$(IMAGE_TAG) --name toolhive + @echo "Image loaded successfully" + +## Deploy to Kind with Helm +kind-deploy: kind-build + @echo "Deploying to Kind..." + @helm upgrade --install toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --wait --timeout=5m @echo "Deployment complete!" @echo "" @echo "To access the application, run:" - @echo " make minikube-port-forward" + @echo " make kind-port-forward" @echo "Then open: http://localhost:8080" -## Uninstall from minikube -minikube-uninstall: - @helm uninstall toolhive-ui || true - @echo "Uninstalled from minikube" +## Uninstall from Kind +kind-uninstall: + @helm uninstall toolhive-cloud-ui || true + @echo "Uninstalled from Kind" -## View minikube logs -minikube-logs: - @kubectl logs -f deployment/toolhive-ui-toolhive-cloud-ui +## View logs +kind-logs: + @kubectl logs -f deployment/toolhive-cloud-ui ## Port-forward to localhost -minikube-port-forward: +kind-port-forward: @echo "Forwarding to http://localhost:8080" - @kubectl port-forward svc/toolhive-ui-toolhive-cloud-ui 8080:80 + @kubectl port-forward svc/toolhive-cloud-ui 8080:80 + +## Full setup: create cluster and deploy +kind-setup: kind-create kind-deploy + @echo "Setup complete!" diff --git a/README.md b/README.md index cad22cf..aa73967 100644 --- a/README.md +++ b/README.md @@ -51,26 +51,39 @@ make rebuild The application will be available at [http://localhost:3000](http://localhost:3000). -## Kubernetes / Minikube Deployment +## Kubernetes / Kind Deployment -This project includes a complete Helm chart for deploying to Kubernetes (optimized for minikube). +This project includes a complete Helm chart for deploying to Kubernetes (optimized for Kind). -### Quick Start with Minikube +### Quick Start with Kind ```bash -# Deploy to minikube (includes build and deployment) -make minikube-deploy +# Create cluster and deploy (first time) +make kind-setup -# View logs -make minikube-logs +# Or step by step: +# 1. Create Kind cluster +make kind-create + +# 2. Deploy application +make kind-deploy -# Port-forward to localhost:8080 -make minikube-port-forward +# 3. Access the application +make kind-port-forward +# Then open: http://localhost:8080 + +# View logs +make kind-logs # Uninstall -make minikube-uninstall +make kind-uninstall + +# Delete cluster +make kind-delete ``` +### Helm Chart + The Helm chart is located in the `helm/` directory and includes: - Deployment with configurable replicas @@ -80,6 +93,13 @@ The Helm chart is located in the `helm/` directory and includes: - Health checks (startup, liveness and readiness probes) - Security contexts following Pod Security Standards +### CI/CD + +The chart is automatically tested on every push using GitHub Actions with Kind: + +- **Helm Lint**: Validates chart syntax and best practices +- **Integration Test**: Deploys to Kind cluster and verifies the app responds + ## Learn More To learn more about Next.js, take a look at the following resources: diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index cfc38d3..267380f 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -1,5 +1,5 @@ -# Development values for minikube environment -# Usage: helm install toolhive-ui ./helm -f ./helm/values-dev.yaml +# Development values for local Kubernetes (Kind/Minikube) +# Usage: helm install toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml # -- Number of replicas for development replicaCount: 1 @@ -7,7 +7,7 @@ replicaCount: 1 image: # -- Image repository repository: toolhive-cloud-ui - # -- Never pull from registry, use local image for minikube + # -- Never pull from registry, use local image pullPolicy: Never # -- Override with "latest" for local development tag: "latest" From 389262cd5d0a1477cd9a2fb2c8a63e275f0ec936 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 15:44:12 +0100 Subject: [PATCH 05/14] fix: gh action version and k8s kind version --- .github/workflows/helm-test.yml | 5 +++-- .github/workflows/lint-helm.yml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 7e36f97..2ddb2ad 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -22,10 +22,10 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@2856a9e524044420f517685a4655470535401539 # v3.0.0 + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - name: Build Docker image - uses: docker/build-push-action@e2a61776269e8d6936392d704d05a56504c68377 # v6.0.0 + uses: docker/build-push-action@c382f710d39a5bb4e430307530a720f50c2d3318 # v6.0.0 with: context: . load: true @@ -37,6 +37,7 @@ jobs: uses: helm/kind-action@026472392573094226832982b6a5182641d20195 # v1.0.0 with: cluster_name: toolhive-test + node_image: kindest/node:v1.28.0 wait: 120s - name: Load image into Kind diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index c284fa3..32cdef3 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -35,8 +35,8 @@ jobs: - name: Validate templates run: | - helm template toolhive-ui ./helm --debug - helm template toolhive-ui ./helm -f ./helm/values-dev.yaml --debug + helm template toolhive-cloud-ui ./helm --debug + helm template toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --debug - name: Check for Kubernetes API deprecations uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 From fd9f985a8c91ef239e870d3707adf825c277f195 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 15:49:49 +0100 Subject: [PATCH 06/14] fix(ci): correct action hashes, upgrade kind to v1.13.0, add security permissions --- .github/workflows/helm-test.yml | 5 ++++- .github/workflows/lint-helm.yml | 3 +++ helm/values.yaml | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 2ddb2ad..6221f31 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -12,6 +12,9 @@ on: - "helm/**" - ".github/workflows/helm-test.yml" +permissions: + contents: read + jobs: test-helm-chart: name: Test Helm Chart with Kind @@ -34,7 +37,7 @@ jobs: cache-to: type=gha,mode=max - name: Create Kind cluster - uses: helm/kind-action@026472392573094226832982b6a5182641d20195 # v1.0.0 + uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0 with: cluster_name: toolhive-test node_image: kindest/node:v1.28.0 diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index 32cdef3..2873b75 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -12,6 +12,9 @@ on: - "helm/**" - ".github/workflows/lint-helm.yml" +permissions: + contents: read + jobs: lint-chart: name: Lint Helm Chart diff --git a/helm/values.yaml b/helm/values.yaml index a7db30c..b2331fe 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -151,4 +151,3 @@ envFrom: [] # name: app-config # - secretRef: # name: app-secrets - From 2f31b84d5b55d956e8e3a320b3110dc54439bafb Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 15:56:56 +0100 Subject: [PATCH 07/14] leftover --- .github/workflows/helm-test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 6221f31..c51641a 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -38,14 +38,10 @@ jobs: - name: Create Kind cluster uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0 - with: - cluster_name: toolhive-test - node_image: kindest/node:v1.28.0 - wait: 120s - name: Load image into Kind run: | - kind load docker-image toolhive-cloud-ui:latest --name toolhive-test + kind load docker-image toolhive-cloud-ui:latest --name chart-testing - name: Install Helm chart run: | From 58a35f06cc47531d918dc33317707d68dfe7e600 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:04:31 +0100 Subject: [PATCH 08/14] fix(helm): add maintainer email to pass chart-testing validation --- helm/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 85a80da..7a7947d 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -14,4 +14,5 @@ sources: - https://github.com/toolhive/cloud-ui maintainers: - name: ToolHive Team + email: team@stacklok.com kubeVersion: ">=1.24.0-0" From 9d45619847daf394d3d53ca8401cf08bb768a313 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:05:40 +0100 Subject: [PATCH 09/14] fix: remove unneeded config --- helm/Chart.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 7a7947d..638afaf 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -12,7 +12,4 @@ keywords: home: https://github.com/toolhive/cloud-ui sources: - https://github.com/toolhive/cloud-ui -maintainers: - - name: ToolHive Team - email: team@stacklok.com kubeVersion: ">=1.24.0-0" From 27983baba2c315938b14e145181161fbc4464a5d Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:21:46 +0100 Subject: [PATCH 10/14] fix: remove unneeded config --- .github/workflows/lint-helm.yml | 7 ------- helm/Chart.yaml | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index 2873b75..e2d88aa 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -40,10 +40,3 @@ jobs: run: | helm template toolhive-cloud-ui ./helm --debug helm template toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --debug - - - name: Check for Kubernetes API deprecations - uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 - - - name: Run chart-testing (lint) - run: | - ct lint --target-branch main --charts helm/ diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 638afaf..88e9cf3 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -9,7 +9,7 @@ keywords: - react - frontend - ui -home: https://github.com/toolhive/cloud-ui +home: https://github.com/stacklok/toolhive-cloud-ui sources: - - https://github.com/toolhive/cloud-ui + - https://github.com/stacklok/toolhive-cloud-ui kubeVersion: ">=1.24.0-0" From 584fc607f90ac24dbecac544661a1f773778cf2d Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:24:17 +0100 Subject: [PATCH 11/14] chore: rename job title --- .github/workflows/helm-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index c51641a..1255ce1 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -17,7 +17,7 @@ permissions: jobs: test-helm-chart: - name: Test Helm Chart with Kind + name: Test Helm Chart runs-on: ubuntu-latest steps: From 70dfcfbd1e5b0bed8611a3450c77d77570dbbf09 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:28:37 +0100 Subject: [PATCH 12/14] fix(ci): simplify helm lint workflow and fix Chart.yaml - Remove ct lint step (too restrictive, requires maintainers) - Remove chart-testing-action setup (unused) - Add --kube-version 1.28.0 to helm template for compatibility - Fix Chart.yaml URLs to point to stacklok/toolhive-cloud-ui - Remove maintainers field (not required without ct lint) - Align with toolhive operator chart structure --- .github/workflows/lint-helm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index e2d88aa..740fed7 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -38,5 +38,5 @@ jobs: - name: Validate templates run: | - helm template toolhive-cloud-ui ./helm --debug - helm template toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --debug + helm template toolhive-cloud-ui ./helm --kube-version 1.28.0 --debug + helm template toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --kube-version 1.28.0 --debug From 2280e7f64de0c925ed0c86f0503737f8d85eee04 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:34:08 +0100 Subject: [PATCH 13/14] refactor: review copilot --- helm/values-dev.yaml | 6 +++--- helm/values.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 267380f..b712868 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -1,4 +1,4 @@ -# Development values for local Kubernetes (Kind/Minikube) +# Development values for local Kubernetes Kind # Usage: helm install toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml # -- Number of replicas for development @@ -7,8 +7,8 @@ replicaCount: 1 image: # -- Image repository repository: toolhive-cloud-ui - # -- Never pull from registry, use local image - pullPolicy: Never + # -- Pull from registry if available, use local image if not + pullPolicy: IfNotPresent # -- Override with "latest" for local development tag: "latest" diff --git a/helm/values.yaml b/helm/values.yaml index b2331fe..ee28519 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,8 +4,8 @@ replicaCount: 1 image: # -- Image repository repository: toolhive-cloud-ui - # -- Image pull policy (Never for local development with minikube) - pullPolicy: Never + # -- Pull from registry if available, use local image if not + pullPolicy: IfNotPresent # -- Overrides the image tag whose default is the chart appVersion tag: "" From cdf345216d14ad2af3bb9820edb9aaafb20f3f86 Mon Sep 17 00:00:00 2001 From: Giuseppe Scuglia Date: Thu, 13 Nov 2025 16:35:30 +0100 Subject: [PATCH 14/14] refactor(makefile): use RELEASE_NAME variable for helm commands - Add RELEASE_NAME variable to avoid hardcoded deployment name - Use variable in kind-deploy, kind-uninstall, kind-logs, kind-port-forward - Improves flexibility and maintainability - Addresses Copilot review suggestion --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 58bc661..c577545 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ IMAGE_NAME := toolhive-cloud-ui IMAGE_TAG := latest CONTAINER_NAME := toolhive-cloud-ui PORT := 3000 +RELEASE_NAME := toolhive-cloud-ui ## Show this help message help: @@ -94,7 +95,7 @@ kind-build: ## Deploy to Kind with Helm kind-deploy: kind-build @echo "Deploying to Kind..." - @helm upgrade --install toolhive-cloud-ui ./helm -f ./helm/values-dev.yaml --wait --timeout=5m + @helm upgrade --install $(RELEASE_NAME) ./helm -f ./helm/values-dev.yaml --wait --timeout=5m @echo "Deployment complete!" @echo "" @echo "To access the application, run:" @@ -103,17 +104,17 @@ kind-deploy: kind-build ## Uninstall from Kind kind-uninstall: - @helm uninstall toolhive-cloud-ui || true + @helm uninstall $(RELEASE_NAME) || true @echo "Uninstalled from Kind" ## View logs kind-logs: - @kubectl logs -f deployment/toolhive-cloud-ui + @kubectl logs -f deployment/$(RELEASE_NAME) ## Port-forward to localhost kind-port-forward: @echo "Forwarding to http://localhost:8080" - @kubectl port-forward svc/toolhive-cloud-ui 8080:80 + @kubectl port-forward svc/$(RELEASE_NAME) 8080:80 ## Full setup: create cluster and deploy kind-setup: kind-create kind-deploy