Skip to content

Commit

Permalink
Implementing releases for the harmony Helm Chart (#40)
Browse files Browse the repository at this point in the history
* feat: moving harmony chart to charts folder

* feat: adding github Workflow to release harmony charts

* feat: adding step to add Helm dependency repos

* test: check a Harmony Helm release in the PR

* chore: updating documentation with Helm installation instructions

* Revert "test: check a Harmony Helm release in the PR"
  • Loading branch information
jfavellar90 authored Jun 27, 2023
1 parent ac53842 commit 7f68330
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 15 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Charts

on:
push:
branches:
- main

jobs:
release:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v3

- name: Add dependency repositories
run: |
for dir in $(ls -d charts/*/); do
helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
done
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Chart dependencies
/charts/*/charts
.DS_Store
infra-*/kubeconfig
infra-*/terraform.tfstate
infra-*/terraform.tfstate*
infra-*/.terraform*
infra-*/secrets.auto.tfvars
my-notes
values.yaml
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Supporting one really large instance is not a core design goal, but it should wo

This helm chart uses [ingress-nginx](https://kubernetes.github.io/ingress-nginx/) as a load balancer alongside [cert-manager](https://cert-manager.io/) to provide automatic SSL certificates. Because of how Helm works, the cert-manager sub-chart will be installed into the same namespace as the parent harmony chart. But if you already have cert-manager on your cluster, this will create a conflict. You should take special care not to install cert-manager twice due to it installing several non-namespaced resources. If you already installed cert-manager by different means, make sure set `cert-manager.enabled: false` for this chart.

In addition, [the cert-manager Helm charts do not install the required CRDs used by cert-manager](https://cert-manager.io/docs/installation/upgrading/#crds-managed-separately), so you will need to manually install and upgrade them to the correct version as described in the instructions below. This is due to the some limitations in the management of CRDs by Helm.
In addition, [the cert-manager Helm charts do not install the required CRDs used by cert-manager](https://cert-manager.io/docs/installation/upgrading/#crds-managed-separately), so you will need to manually install and upgrade them to the correct version as described in the instructions below. This is due to the some limitations in the management of CRDs by Helm.

### How the autoscaling capabilities are implemented in this project?

Expand All @@ -76,7 +76,7 @@ are guaranteed to schedule new incoming workloads. Tools worth mentioning in thi
[Karpenter](https://karpenter.sh/).

For the scope of this project, the focus will be in the **pod-based scaling** mechanisms since Node-based scaling tools
require configuration which is external to the cluster, which is out of the scope for this Helm chart for now.
require configuration which is external to the cluster and this is out of the scope for this Helm chart for now.

The approach will be to use pod autoscaling on each environment separately (assuming there are installations on different
namespaces) following the steps below:
Expand Down Expand Up @@ -104,24 +104,30 @@ memory** (that's enough to test 2 Open edX instances).

1. Make sure you can access the cluster from your machine: run `kubectl cluster-info` and make sure it displays some
information about the cluster (e.g. two URLs).
2. Copy `values-example.yaml` to `values.yaml` and edit it to put in your email address and customize other settings.
The email address is required for Lets Encrypt to issue HTTPS certificates. It is not shared with anyone else.
2. Copy `values-example.yaml` to a new `values.yaml` file and edit it to put in your email address and customize
other settings. The email address is required for Lets Encrypt to issue HTTPS certificates. It is not shared
with anyone else. For a full configuration reference, see the `charts/harmony-chart/values.yaml` file.
3. Install [Helm](https://helm.sh/) if you don't have it already.
4. Install the cert-manager CRDs if using cert-manager:
4. Add the Harmony Helm repository:
```
helm repo add openedx-harmony https://openedx.github.io/openedx-k8s-harmony
helm repo update
```
5. Install the cert-manager CRDs if using cert-manager:
```
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.crds.yaml --namespace=harmony
```
You can check the version of cert-manager that is going to be installed by the chart by running
`helm dependency list` or by checking the corresponding line in the `harmony-chart/Chart.yaml` file.
5. Run:
You can check the version of cert-manager that is going to be installed by the chart by checking the corresponding
line in the `charts/harmony-chart/Chart.yaml` file.
6. Install the Harmony chart by running:
```
helm install --namespace harmony --create-namespace -f values.yaml harmony ./harmony-chart
helm install harmony --namespace harmony --create-namespace -f values.yaml openedx-harmony/harmony-chart
```

Note: in the future, if you make any changes to `values.yaml`, then run this command to update the deployment:
Note: in the future, if you apply changes to `values.yaml`, please run this command to update the deployment of the chart:

```
helm upgrade --namespace harmony -f values.yaml harmony ./harmony-chart
helm upgrade harmony --namespace harmony -f values.yaml openedx-harmony/harmony-chart
```

#### Option 1b: Setting up Harmony Chart locally on Minikube
Expand All @@ -132,8 +138,12 @@ HTTPS and is more complicated due to the need to use tunnelling.*

1. First, [install `minikube`](https://minikube.sigs.k8s.io/docs/start/) if you don't have it already.
2. Run `minikube start` (you can also use `minikube dashboard` to access the Kubernetes dashboard).
3. Run\
`helm install --namespace harmony --create-namespace -f values-minikube.yaml harmony ./harmony-chart`
3. Add the Helm repository and install the Harmony chart using the `values-minikube.yaml` file as configuration:
```
helm repo add openedx-harmony https://openedx.github.io/openedx-k8s-harmony
helm repo update
helm install harmony --namespace harmony --create-namespace -f values-minikube.yaml openedx-harmony/harmony-chart
```
4. Run `minikube tunnel` (you may need to enter a password), and then you should be able to access the cluster (see
"External IP" below). If this approach is not working, an alternative is to run\
`minikube service harmony-ingress-nginx-controller -n harmony`\
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ An NGINX load balancer routes all HTTP/HTTPS traffic into the cluster to each
Open edX instance. Even before you deploy any Open edX instances, you can test
that the load balancer is working. First, get its external IP using

kubectl get svc -n harmony harmony-ingress-nginx-controller
kubectl get svc -n {{ .Release.Namespace }} harmony-ingress-nginx-controller

Next, go to http://the.external.ip.shown/cluster-echo-test and make sure you get
a JSON response.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed harmony-chart/charts/cert-manager-v1.11.0.tgz
Binary file not shown.
Binary file removed harmony-chart/charts/elasticsearch-7.17.3.tgz
Binary file not shown.
Binary file removed harmony-chart/charts/ingress-nginx-4.4.2.tgz
Binary file not shown.
Binary file removed harmony-chart/charts/metrics-server-3.8.4.tgz
Binary file not shown.
Binary file not shown.

0 comments on commit 7f68330

Please sign in to comment.