Skip to content

Feature/helm setup#108

Closed
NotYuSheng wants to merge 15 commits into
devfrom
feature/helm-setup
Closed

Feature/helm setup#108
NotYuSheng wants to merge 15 commits into
devfrom
feature/helm-setup

Conversation

@NotYuSheng

Copy link
Copy Markdown
Owner

Summary

Introduces Helm chart support for the chat-service microservice and a centralized Makefile for managing deployments across all services.

Address #98


Changes Made

  • Created Helm chart for chat-service under helm/chat-service/

  • Defined Kubernetes manifests for Deployment, Service, and Helm NOTES.txt

  • Introduced values.yaml with configurable ports, replica count, image name, and probes

  • Added centralized Makefile with:

    • install, upgrade, uninstall, status, and lint for individual charts
    • install-all, upgrade-all, uninstall-all for batch operations
    • Configurable port-forward target
  • Included examples and usage notes via make help

  • Updated README.md to document Makefile usage and best practices


Context / Rationale

This PR establishes production-ready deployment scaffolding for OmniPDF microservices using Helm. It enforces structure, standardization, and simplicity for both individual and multi-chart operations. The Makefile bridges the gap between local development workflows and Kubernetes-friendly deployment practices. This is the foundational step toward full CI/CD integration with Helm chart linting and versioned releases.


Related Docs or References


General Checklist

  • I have tested these changes locally
  • I have updated relevant documentation or added comments where needed
  • I have linked relevant issues and tagged reviewers
  • I have followed coding conventions and naming standards

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @NotYuSheng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances our deployment capabilities by integrating Helm for Kubernetes-native application management. It provides a dedicated Helm chart for the chat-service and introduces a centralized Makefile to streamline common deployment tasks, ensuring a more consistent and efficient approach to managing our microservices in a Kubernetes environment.

Highlights

  • Helm Chart for Chat Service: I've introduced a new Helm chart specifically for the chat-service microservice, located under helm/chat-service/. This chart includes standard Kubernetes manifests for Deployment, Service, Horizontal Pod Autoscaler (HPA), Ingress, and ServiceAccount, all configurable via a comprehensive values.yaml file. It also includes a NOTES.txt for post-installation guidance and a basic test connection pod.
  • Centralized Makefile for Deployment Management: A new Makefile has been added to the root directory to centralize and simplify Helm and Kubernetes operations. It provides targets for installing, upgrading, uninstalling, linting, and checking the status of individual Helm charts, as well as batch operations (install-all, upgrade-all, uninstall-all) for all charts under the helm/ directory. A port-forward target is also included for local access.
  • Standardized Deployment Scaffolding: This PR establishes a foundational structure for production-ready deployments across OmniPDF microservices. By leveraging Helm and a unified Makefile, it aims to enforce standardization, simplify deployment workflows, and prepare the project for future CI/CD integration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces Helm chart support for the chat-service microservice and a centralized Makefile for managing deployments. I've provided feedback to improve the robustness, security, and portability of the new deployment scripts and Helm chart. The most critical issues relate to a hardcoded API key and missing environment variables in the deployment.

Comment thread helm/chat-service/values.yaml Outdated
Comment thread helm/chat-service/templates/deployment.yaml
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread helm/chat-service/values.yaml Outdated
Comment thread helm/chat-service/values.yaml Outdated
Comment thread helm/chat-service/templates/NOTES.txt Outdated

1. Access your application via port-forward:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chat-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Release.Namespace }} port-forward $$POD_NAME 8080:8080

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The port-forward command in the notes has a hardcoded container port (8080). However, the actual container port is configurable via .Values.service.port (which defaults to 8000).

This instruction will fail or connect to the wrong port if the service port is changed. The command should use the value from values.yaml to provide accurate instructions to the user.

  kubectl --namespace {{ .Release.Namespace }} port-forward $$POD_NAME 8080:{{ .Values.service.port }}

@NotYuSheng

Copy link
Copy Markdown
Owner Author

Add helm linter issue

@NotYuSheng NotYuSheng moved this from Done to In progress in OmniPDF Kanban Jul 9, 2025
NotYuSheng and others added 4 commits July 9, 2025 17:07
…loyment automation

Introduces Helm chart support for the chat-service microservice and a centralized Makefile for managing deployments across all services, with comprehensive production hardening.

Address #98

Changes Made:
- Created Helm chart for chat-service under helm/chat-service/
- Defined Kubernetes manifests for Deployment, Service, and Helm NOTES.txt
- Introduced values.yaml with configurable ports, replica count, image name, and probes
- Added centralized Makefile with install, upgrade, uninstall, status, and lint for individual charts
- Included install-all, upgrade-all, uninstall-all for batch operations
- Added configurable port-forward target
- Included examples and usage notes via make help
- Added production-ready resource limits (200m CPU, 256Mi memory)
- Configured security hardening (non-root user, read-only filesystem, dropped capabilities)
- Fixed environment variable injection in deployment template
- Enabled autoscaling with realistic limits (2-10 replicas)
- Added comprehensive health checks (startup, liveness, readiness probes)
- Added local image repository setup documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Use helm upgrade --install for robust deployment in Makefile
- Fix image repository name (chat_service -> chat-service) following K8s conventions
- Remove hardcoded image tag, use Chart.yaml appVersion instead
- Fix hardcoded ports in NOTES.txt to use dynamic service port values
- Set pullPolicy to Never for offline production environments
- Add missing startupProbe to deployment template
- Improve chart portability and offline deployment readiness

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@NotYuSheng

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR introduces Helm chart support for the chat-service and a Makefile for deployment management. The changes are well-structured and follow Helm best practices. My review focuses on improving security by removing hardcoded secrets, increasing robustness of Makefile targets and Helm templates, and ensuring consistency in naming and documentation.

Comment thread helm/chat-service/values.yaml Outdated
Comment thread Makefile Outdated
Comment thread helm/LOCAL_IMAGE_REPOSITORY.md
Comment thread helm/chat-service/values.yaml Outdated
Comment thread helm/chat-service/values.yaml Outdated
Comment thread helm/chat-service/values.yaml Outdated
Comment thread Makefile Outdated
Comment on lines +78 to +81
helm install $$CHART helm/$$CHART \
--namespace $(NAMESPACE) \
--create-namespace \
--values helm/$$CHART/values.yaml; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The install-all target uses helm install, which will fail if a release with the same name already exists. For idempotency and consistency with the single install target (which uses helm upgrade --install), it's better to use helm upgrade --install here as well. This ensures the command can be run multiple times safely, either installing or upgrading the charts.

		helm upgrade --install $$CHART helm/$$CHART \
			--namespace $(NAMESPACE) \
			--create-namespace \
			--values helm/$$CHART/values.yaml; \


# Update deployment with new image
make upgrade CHART_NAME=chat-service
``` No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file is missing a final newline. It's a good practice to end all text files with a newline.

Comment thread helm/chat-service/values.yaml
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "chat-service.fullname" . }}:{{ .Values.service.port }}']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current test only checks if a TCP connection can be established to the service port. A more robust test would be to query the /health endpoint and check for a successful HTTP response. You can do this by adjusting the wget arguments.

      args: ['-q', '-O', '/dev/null', 'http://{{ include "chat-service.fullname" . }}:{{ .Values.service.port }}/health']

root and others added 7 commits August 5, 2025 16:42
…ables

- Remove OPENAI_API_KEY from values.yaml to prevent secrets in git
- Add Secret template for secure credential management
- Update deployment to use secretKeyRef for API key injection
- Add comprehensive README with security best practices
- Maintain backward compatibility with optional secret creation
- Eliminate security vulnerability of plaintext secrets in version control

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix inconsistent port examples (8080 -> 8000) in port-forward help
- Update comment to reflect correct default port (8000:8000)
- Align examples with actual chat-service port configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix ifndef CHART_NAME check that never triggered due to default value
- Use ifeq to properly detect when CHART_NAME is still set to default
- Remove trailing spaces from CHART_NAME default value
- Prevent accidental port-forward attempts to non-existent example-service
- Ensure users get clear error message when CHART_NAME not specified

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Change all health probes to use 'port: http' instead of hardcoded 8000
- Makes chart robust to service.port configuration changes
- Update install-all and upgrade-all to use 'helm upgrade --install'
- Ensures batch operations are idempotent and won't fail on re-runs
- Add --create-namespace to upgrade-all for consistency
- Improve overall chart reliability and user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
… TCP check

- Replace basic TCP connectivity test with HTTP health endpoint verification
- Add --spider flag to check URL without downloading content
- Add 10-second timeout to prevent test hanging
- Provides more robust service health validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…mage loading

- Add CLAUDE.md with development guidance and architectural overview
- Enhance Makefile with multi-environment support (dev/staging/prestaging/prod)
- Create automated image loading script (load-images.sh) for CRC registry
- Add comprehensive chat-service Helm chart with production-grade features:
  * Multi-environment values files (prestaging, staging, prod)
  * Enterprise templates: NetworkPolicy, PodDisruptionBudget, ResourceQuota, ServiceMonitor
  * Enhanced deployment with LLM configuration and security contexts
  * Proper secret management and environment variable handling
- Update LOCAL_IMAGE_REPOSITORY.md with automated workflow documentation
- Configure prestaging environment for external vLLM service connectivity
- Add sample images.txt for batch image loading

Successfully tested prestaging deployment with chat-service connecting to external vLLM.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@NotYuSheng NotYuSheng closed this Aug 11, 2025
@NotYuSheng NotYuSheng deleted the feature/helm-setup branch August 11, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New user-facing functionality

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant