Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Chart Testing GitHub Action, to Lint and Install Chart on PR #7

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 179 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Test Charts

on:
workflow_dispatch:
pull_request:
paths:
- "charts/**"

permissions:
contents: read

env:
HELM_DOCS_VERSION: "1.13.1"

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.6.3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.7

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

- name: Run chart-testing (lint)
run: ct lint --config charts/ct-lint.yaml

lint-docs:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
needs: lint-chart
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: install helm-docs
run: |
cd /tmp
wget https://github.com/norwoodj/helm-docs/releases/download/v${{env.HELM_DOCS_VERSION}}/helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
tar -xvf helm-docs_${{env.HELM_DOCS_VERSION}}_Linux_x86_64.tar.gz
sudo mv helm-docs /usr/local/sbin

- name: Run helm-docs
run: |
helm-docs -t README.md.gotmpl -o README.md -b for-the-badge

kubeval-chart:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
needs:
- lint-chart
- lint-docs
strategy:
matrix:
k8s:
# from https://github.com/yannh/kubernetes-json-schema
- v1.27.6
- v1.28.3
- v1.29.2
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.6.3

- name: Run helm-template
run: |
mkdir manifests

for dir in charts/*/
do
helm template "${dir}" > "manifests/$(basename $dir).yaml"
done
- name: Run kubeval
uses: instrumenta/kubeval-action@master
with:
files: "manifests"
version: ${{ matrix.k8s }}

install-chart:
name: install-chart
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
needs:
- lint-chart
- lint-docs
- kubeval-chart
strategy:
matrix:
k8s:
# from https://hub.docker.com/r/kindest/node/tags
- v1.27.3 # renovate: kindest
- v1.28.0 # renovate: kindest
- v1.29.2 # renovate: kindest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.k8s }}
version: v0.20.0

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

- name: Run chart install
run: ct install --config charts/ct-lint.yaml

# Catch-all required check for test matrix
test-success:
needs:
- lint-chart
- lint-docs
- kubeval-chart
- install-chart
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
timeout-minutes: 1
if: always()
steps:
- name: Fail for failed or cancelled lint-chart
if: |
needs.lint-chart.result == 'failure' ||
needs.lint-chart.result == 'cancelled'
run: exit 1
- name: Fail for failed or cancelled lint-docs
if: |
needs.lint-docs.result == 'failure' ||
needs.lint-docs.result == 'cancelled'
run: exit 1
- name: Fail for failed or cancelled kubeval-chart
if: |
needs.kubeval-chart.result == 'failure' ||
needs.kubeval-chart.result == 'cancelled'
run: exit 1
- name: Fail for failed or cancelled install-chart
if: |
needs.install-chart.result == 'failure' ||
needs.install-chart.result == 'cancelled'
run: exit 1
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

Repository containing the SurrealDB Helm Charts

# Usage
Read the Kubernetes Deployment guides in https://surrealdb.com/docs/deployment

# Documentation
You can find documentation about the chart [here](https://github.com/surrealdb/helm-charts/blob/main/charts/surrealdb/README.md).
13 changes: 13 additions & 0 deletions charts/ct-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
# Don't add the 'debug' attribute, otherwise the workflow won't work anymore
# Only Used for the CT Lint Stage
remote: origin
target-branch: main
chart-dirs:
- charts
validate-chart-schema: true
validate-chart-values: true
validate-maintainers: true
validate-yaml: true
exclude-deprecated: true
excluded-charts: []
8 changes: 6 additions & 2 deletions charts/surrealdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: surrealdb
type: application
version: 0.3.2
version: 0.3.3
appVersion: 1.0.0
description: SurrealDB is the ultimate cloud database for tomorrow's applications.
keywords:
Expand All @@ -12,4 +12,8 @@ keywords:
- cloud
- tikv
home: https://github.com/surrealdb/surrealdb
logoUrl: https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/icon.png
icon: https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/icon.png

maintainers:
- name: surrealdb
url: https://github.com/surrealdb
89 changes: 89 additions & 0 deletions charts/surrealdb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# SurrealDB Helm Chart

![Version: 0.3.3](https://img.shields.io/badge/Version-0.3.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

SurrealDB is the ultimate cloud database for tomorrow's applications.

## Introduction

This chart facilitates the deployment of [SurrealDB](https://surrealdb.com/docs/surrealdb/) on Kubernetes clusters.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| surrealdb | | <https://github.com/surrealdb> |

## Usage

Read the Kubernetes Deployment guides in https://surrealdb.com/docs/deployment

## Overrides

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| fullnameOverride | string | `""` | String to fully override `"surrealdb"` |
| nameOverride | string | `""` | Provide a name in place of `surrealdb` |

## General parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Assign custom [affinity] rules to the deployment |
| args | list | `["start"]` | Command line arguments to pass to SurrealDB |
| nodeSelector | object | `{}` | [Node selector] |
| podAnnotations | object | `{}` | Annotations to be added to SurrealDB pods |
| podSecurityContext | object | `{}` (See [values.yaml]) | Toggle and define pod-level security context. |
| replicaCount | int | `1` | The number of SurrealDB pods to run |
| resources | object | `{}` | Resource limits and requests |
| securityContext | object | `{}` (See [values.yaml]) | SurrealDB container-level security context |
| tolerations | list | `[]` | [Tolerations] for use with node taints |

## SurrealDB parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| surrealdb.auth | string | `"true"` | Authentication enabled |
| surrealdb.log | string | `"info"` | Log configuration |
| surrealdb.path | string | `"memory"` | path: tikv://tikv-pd:2379 |
| surrealdb.port | int | `8000` | SurrealDB container port |

## Image parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy for SurrealDB |
| image.repository | string | `"surrealdb/surrealdb"` | Repository to use for SurrealDB |
| image.tag | string | `""` (defaults to chart appVersion) | Tag to use for SurrealDB |
| imagePullSecrets | list | `[]` | Secrets with credentials to pull images from a private registry |

## Service parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| service.annotations | object | `{}` | Service annotations |
| service.port | int | `8000` | Service port |
| service.targetPort | string | `"http"` | Target container port |
| service.type | string | `"ClusterIP"` | Service type |

## Service account parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` (defaults to the fullname template) | The name of the service account to use. |

## Ingress parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| ingress.annotations | object | `{}` | Additional ingress annotations |
| ingress.className | string | `""` | Defines which ingress controller will implement the resource |
| ingress.defaultBackend | bool | `true` | Create default backend |
| ingress.enabled | bool | `false` | Enable an ingress resource |
| ingress.hosts | list | `[]` (See [values.yaml]) | List of hosts to be covered by ingress record |
| ingress.tls | list | `[]` (See [values.yaml]) | List of TLS configuration |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)
Loading
Loading