This document describes the automated build and deployment workflows for Intelligent HPA.
The project uses GitHub Actions to automate the building and publishing of container images and Kubernetes manifests.
Container images are built and published to GitHub Container Registry (ghcr.io) automatically.
- Registry:
ghcr.io/cyberagent/intelligent-hpa/intelligent-hpa-controller - Source:
ihpa-controller/Dockerfile - Build Context:
./ihpa-controller
- Registry:
ghcr.io/cyberagent/intelligent-hpa/intelligent-hpa-fittingjob - Source:
fittingjob/Dockerfile - Build Context:
./fittingjob
The automation workflow is triggered by:
- Push to main/master branch: Builds and pushes images with the
latesttag and updates manifests - Push tags (v)*: Builds and pushes images with version tags (e.g.,
v1.0.0,1.0) - Pull requests: Builds images but does not push them (validation only)
The following tags are automatically generated:
latest: Latest build from the default branch (main/master)<branch-name>: Branch name for branch buildspr-<number>: Pull request number for PR buildssha-<sha>: Short commit SHA (e.g.,sha-024ec94)<version>: Semantic version from git tags (e.g.,1.0.0)<major>.<minor>: Semantic version without patch (e.g.,1.0)
The Kubernetes manifest is automatically generated and updated in manifests/intelligent-hpa.yaml when:
- Images are successfully built and pushed
- The event is not a pull request
The manifest generation process:
- Runs
make manifestsin the ihpa-controller directory to generate CRDs and RBAC - Updates the controller image reference in kustomization to use the appropriate tag
- Builds the final manifest using kustomize
- Commits and pushes the updated manifest back to the repository
You can also build and push images manually using the Makefile:
# Build and push controller image
make controller
# Build and push fittingjob image
make fittingjob
# Generate manifest
make manifestBy default, the Makefile uses GitHub Container Registry. You can override the registry by setting the REGISTRY environment variable:
# Use a different registry
REGISTRY=docker.io/myorg make controllerThe workflow requires the following permissions:
contents: read- To checkout the repositorypackages: write- To push images to GitHub Container Registry
These permissions are automatically granted to the GITHUB_TOKEN in the workflow.
To use the published images in your Kubernetes cluster:
# Pull the latest controller image
docker pull ghcr.io/cyberagent/intelligent-hpa/intelligent-hpa-controller:latest
# Pull the latest fittingjob image
docker pull ghcr.io/cyberagent/intelligent-hpa/intelligent-hpa-fittingjob:latestNote: GitHub Container Registry images are public by default for public repositories. For private repositories, you'll need to authenticate:
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin