How to Use a Private GitHub Repository for HiveMQ Helm Charts with Argo CD
This article explains how to copy the HiveMQ Helm Charts repository into a private Git repository and configure it for use with Argo CD. Follow the steps below to replicate the process.
Prerequisites
Access to both the public HiveMQ Helm Charts repository and your private Git repository.
Git installed on your machine.
Argo CD configured in your environment.
Step 1: Clone Repositories
First, clone both the public HiveMQ Helm Charts repository and your private repository to your local system.
# Clean up any previous directories
rm -rf helm-charts my-helm-charts-private
# Clone the private repository
git clone https://github.com/<your-organization>/<your-private-repo>.git my-helm-charts-private
# Clone the public HiveMQ Helm Charts repository
git clone https://github.com/hivemq/helm-charts.git
Step 2: Process the Operator Version
Follow these steps to copy the hivemq-platform-operator
version into your private repository.
Switch to the Operator Version
Navigate to the public repository and switch to the
hivemq-platform-operator
version tag.cd helm-charts git switch hivemq-platform-operator-0.2.14 --detach cd ..
Replace Contents in the Private Repository
Copy the Helm Charts from the public repository into the private repository.
cd my-helm-charts-private rm -rf * cp -r ../helm-charts/* .
Tag the Operator Version
Add, tag, and commit the changes in your private repository. Delete any existing tags with the same name to avoid conflicts.
if git rev-parse hivemq-platform-operator-0.2.14; then git tag --delete hivemq-platform-operator-0.2.14; fi git add . git tag hivemq-platform-operator-0.2.14 git commit --allow-empty -m "Replace contents with helm-charts hivemq-platform-operator-0.2.14"
Push the Operator Version
Push the changes and tags to the remote private repository.
git push origin main --force --tags git fetch --tags cd ..
Step 3: Process the Platform Version
Follow these steps to copy the hivemq-platform
version into your private repository.
Switch to the Platform Version
Navigate to the public repository and switch to the
hivemq-platform
version tag.cd helm-charts git switch hivemq-platform-0.2.31 --detach cd ..
Replace Contents in the Private Repository
Copy the Helm Charts from the public repository into the private repository.
cd my-helm-charts-private rm -rf * cp -r ../helm-charts/* .
Tag the Platform Version
Add, tag, and commit the changes in your private repository. Delete any existing tags with the same name to avoid conflicts.
if git rev-parse hivemq-platform-0.2.31; then git tag --delete hivemq-platform-0.2.31; fi git add . git tag hivemq-platform-0.2.31 git commit --allow-empty -m "Replace contents with helm-charts hivemq-platform-0.2.31"
Push the Platform Version
Push the changes and tags to the remote private repository.
git push origin main --force --tags git fetch --tags cd ..
Step 4: Add the Private Repository to Argo CD
To use the private repository in Argo CD, you first need to create a GitHub deploy key with read access and then add the repository to Argo CD using the private key file.
Create a GitHub Deploy Key
Generate an SSH key pair:
ssh-keygen -t rsa -b 4096 -C "argo-cd-deploy-key" -f argo-cd-deploy-key -N ""
Add the public key (
argo-cd-deploy-key.pub
) to your private repository as a deploy key with read access in GitHub.
Add the Repository to Argo CD
Use the private key (
argo-cd-deploy-key
) to add the repository to Argo CD.argocd repo add git@github.com:<your-organization>/<your-private-repo>.git \ --ssh-private-key-path ./argo-cd-deploy-key \ --name my-private-helm-repo
Update the Application Manifest
Update the
HelmRepository
or application manifest in Argo CD to point to your private repository.apiVersion: helm.argoproj.io/v1alpha1 kind: HelmRepository metadata: name: my-private-helm-repo namespace: argocd spec: url: git@github.com:<your-organization>/<your-private-repo>.git type: git
Notes
Replace
<your-organization>
and<your-private-repo>
with your private repository details.Ensure your private repository has appropriate permissions for Argo CD to access it.
By following these steps, you can maintain your own copy of the HiveMQ Helm Charts and deploy them securely using Argo CD.