Skip to content

Commit

Permalink
add helm test and publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
eljohnson92 committed Feb 14, 2024
1 parent 8470afb commit 8748227
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 11 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Helm

on:
push:
branches:
- main
paths:
- 'deploy/chart/**'
pull_request:
paths:
- 'deploy/chart/**'
workflow_dispatch: {}

permissions:
contents: read

jobs:
helm-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Version
run: |
TAG=$(git describe --tags --abbrev=0)
sed -ie "s/appVersion: \"latest\"/appVersion: ${TAG}/g" deploy/chart/Chart.yaml
sed -ie "s/version: 0.0.0/version: ${TAG}/g" deploy/chart/Chart.yaml
- name: Set up Helm
uses: azure/setup-helm@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: ct lint --check-version-increment=false --chart-dirs deploy --target-branch ${{ github.event.repository.default_branch }}

# we cannot test a helm install without a valid linode
# - name: Create kind cluster
# uses: helm/[email protected]

#- name: Run chart-testing (install)
# run: ct install --chart-dirs helm-chart --namespace kube-system --helm-extra-set-args "--set=apiToken=test --set=region=us-east" --target-branch ${{ github.event.repository.default_branch }}

helm-release:
if: github.ref == 'refs/heads/main'
needs: helm-test
permissions:
contents: write # for helm/chart-releaser-action to push chart release and create a release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Version
run: |
TAG=$(git describe --tags --abbrev=0)
sed -ie "s/appVersion: \"latest\"/appVersion: ${TAG}/g" deploy/chart/Chart.yaml
sed -ie "s/version: 0.0.0/version: ${TAG}/g" deploy/chart/Chart.yaml
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/setup-helm@v3

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: "{{ .Version }}"
with:
charts_dir: deploy
skip_existing: true
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,28 @@ This will create a file `ccm-linode.yaml` which you can use to deploy the CCM.
Note: Your kubelets, controller-manager, and apiserver must be started with `--cloud-provider=external` as noted in the following documentation.

## Deployment Through Helm Chart
Use the helm chart located under './deploy/chart'. This dir has the manifest for Linode CCM. There are two arguments required.
LINODE_API_TOKEN must be a Linode APIv4 [Personal Access Token](https://cloud.linode.com/profile/tokens) with all permissions.

The first argument must be a Linode APIv4 [Personal Access Token](https://cloud.linode.com/profile/tokens) with all permissions.
REGION must be a Linode [region](https://api.linode.com/v4/regions).
### Install the ccm-linode repo
```shell
helm repo add ccm-linode https://linode.github.io/linode-cloud-controller-manager/
helm repo update ccm-linode
```

The second argument must be a Linode [region](https://api.linode.com/v4/regions).
### To deploy ccm-linode. Run the following command:

### To deploy CCM run the following helm command once you are in the ccm root dir:
```sh
export VERSION=v0.3.22
export LINODE_API_TOKEN=<linodeapitoken>
export REGION=<linoderegion>
helm install linode-ccm --set apiToken=$LINODE_API_TOKEN,region=$REGION https://github.com/linode/linode-cloud-controller-manager/releases/download/$VERSION/helm-chart-$VERSION.tgz
helm install ccm-linode --set apiToken=$LINODE_API_TOKEN,region=$REGION ccm-linode/ccm-linode
```
_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

### To uninstall linode-ccm from kubernetes cluster. Run the following command:
### To uninstall ccm-linode from kubernetes cluster. Run the following command:
```sh
helm uninstall linode-ccm
helm uninstall ccm-linode
```
_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

Expand All @@ -282,7 +286,7 @@ export VERSION=v0.3.22
export LINODE_API_TOKEN=<linodeapitoken>
export REGION=<linoderegion>
helm upgrade linode-ccm --install --set apiToken=$LINODE_API_TOKEN,region=$REGION https://github.com/linode/linode-cloud-controller-manager/releases/download/$VERSION/helm-chart-$VERSION.tgz
helm upgrade ccm-linode --install --set apiToken=$LINODE_API_TOKEN,region=$REGION ccm-linode/ccm-linode
```
_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

Expand Down
4 changes: 3 additions & 1 deletion deploy/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ apiVersion: v2
name: ccm-linode
description: The Linode Cloud Controller Manager (CCM) provides a way for Kubernetes clusters to access additional Linode services. Linode's CCM will automatically provision a Linode NodeBalancer for Kubernetes Services of type "LoadBalancer".
type: application
version: 1.0.0
version: 0.0.0
appVersion: "latest"
maintainers:
- name: linode
4 changes: 2 additions & 2 deletions deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nodeSelector:
# The pullPolicy is set to Always but can be changed when it is not required to always pull the new image
image:
repository: linode/linode-cloud-controller-manager
tag: latest
tag: # only set if required, defaults to .Chart.AppVersion set during release or "latest" by default
pullPolicy: Always

# Default namespace is "kube-system" but it can be set to another namespace
Expand Down Expand Up @@ -48,4 +48,4 @@ tolerations:
# LINODE_HOSTNAME_ONLY_INGRESS type bool is supported
# env:
# - name: EXAMPLE_ENV_VAR
# value: "true"
# value: "true"

0 comments on commit 8748227

Please sign in to comment.