github-actions-cache-server icon indicating copy to clipboard operation
github-actions-cache-server copied to clipboard

feat: add Helm chart for GitHub Actions cache server

Open kahirokunn opened this issue 1 year ago • 3 comments

feat: Add Helm Chart for GitHub Actions Cache Server

This PR introduces a Helm chart for deploying a GitHub Actions cache server on Kubernetes. With this addition, setting up a local or production-ready cache server for GitHub Actions becomes straightforward and easily manageable via Kubernetes.

Key Features

  • Helm Chart: Simplifies the deployment process of the GitHub Actions cache server onto any Kubernetes cluster.
  • Namespace Support: The chart installs the cache server into a dedicated namespace (github-actions) to ensure clean and organized deployments.
  • Local Development: Supports easy local Kubernetes cluster setups with kind for development and testing.

Quick Start

To quickly get started with a local Kubernetes setup using kind:

  1. Install kind:
brew install kind
  1. Create a local Kubernetes cluster:
kind create cluster
  1. Install the cache server with Helm:
helm upgrade --install cache -n github-actions --create-namespace --set fullnameOverride=cache install/kubernetes/github-actions-cache-server
  1. Access the Cache Server Locally: Run the following commands to forward the cache server port to your local machine:
export POD_NAME=$(kubectl get pods --namespace github-actions -l "app.kubernetes.io/name=github-actions-cache-server,app.kubernetes.io/instance=cache" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace github-actions $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
kubectl --namespace github-actions port-forward $POD_NAME 3000:$CONTAINER_PORT

Releasing a New Helm Chart

To release a new version of the Helm chart, follow these steps:

  1. Update the Chart.yaml Version: Before packaging the Helm chart, ensure that the version field in the Chart.yaml file is updated to the new release version. For example:
apiVersion: v2
name: github-actions-cache-server
version: 0.1.0 # Update this version

Make sure to replace 0.1.0 with the new version number for the release.

  1. Package the Helm Chart: Once the Chart.yaml is updated, package the Helm chart by navigating to the directory containing your Helm chart and running the following command:
helm package install/kubernetes/github-actions-cache-server

This will create a .tgz package file for your Helm chart.

  1. Push the Helm Chart to the OCI Registry: After packaging, use the helm push command to upload the packaged Helm chart to the OCI registry. Make sure to use the correct version number that matches the one in Chart.yaml:
helm push github-actions-cache-server-0.1.0.tgz oci://ghcr.io/falcondev-oss

Replace 0.1.0 with the actual version number you're releasing.

Ensure you have the appropriate permissions to push to the specified OCI registry.

Notes

  • This setup is ideal for local development and testing. For production environments, please adjust the Helm install command and configurations according to your specific needs.
  • Feedback and contributions are welcome to enhance this chart further!

Looking forward to your reviews and suggestions!

kahirokunn avatar Aug 29 '24 06:08 kahirokunn

Thank you! ❤️ What a nice idea. I can look into it this Sunday.

DrJume avatar Aug 29 '24 10:08 DrJume

Thank you so much! 😊 I'm thrilled that you liked the idea. Looking forward to your feedback after the weekend. Have a fantastic Sunday, and thanks again for taking the time to check it out! 🌟

kahirokunn avatar Aug 30 '24 01:08 kahirokunn

FYI, I attempted to use this helm template and I found several issues:

  • ENOENT issues with tmp ephemeral volume and "non root” securityContext
  • If persistentVolumeClaim was enabled, pods can't scale because they are using the same PVC, and it happens that they do not detach properly. So I would remove all scaling logic with HPA and propose a rollingStrategy like Recreate

matteovivona avatar Sep 19 '24 10:09 matteovivona

@matteovivona I changed it so that you can change the strategy. It is Recreate by default.

kahirokunn avatar Nov 21 '24 13:11 kahirokunn