Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
xom4ek committed Jun 4, 2024
1 parent 99dbf2a commit 9db3c33
Show file tree
Hide file tree
Showing 30 changed files with 1,770 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.13.0

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.x

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

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release Chart
on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<p align="center">
<img width="400px" height=auto src="https://raw.githubusercontent.com/p2p-org/eigenlayer-operator/main/logo.png" />
</p>

<p align="center">
<a href="https://x.com/P2Pvalidator"><img src="https://badgen.net/badge/twitter/@P2Pvalidator/1DA1F2?icon&label" /></a>
<a href="https://github.com/p2p-org/avs-helm-charts"><img src="https://badgen.net/github/stars/p2p-org/avs-helm-charts?icon=github" /></a>
<a href="https://github.com/p2p-org/avs-helm-charts"><img src="https://badgen.net/github/forks/p2p-org/avs-helm-charts?icon=github" /></a>
</p>

## P2P Helm Charts for Kubernetes

This repository offers a selection of carefully curated P2P Helm charts, which are stored in individual folders. Each chart has its own `values.yaml` file defining the configuration parameters.

## Getting Started

To use these Helm charts, you first need to add the P2P repository to your local Helm client:

```bash
helm repo add p2p-avs https://p2p-org.github.io/avs-helm-charts/
```

Once the repository is added, you can deploy a specific chart with the following command:

```bash
helm install my-release p2p-avs/<chart-name>
```

**Note:** Make sure to replace `<chart-name>` with the name of the actual chart you intend to install.

## Requirements

Before you can use these Helm charts, ensure you have the following:

* Kubernetes 1.20 or higher
* Helm 3
* PV provisioner support in the underlying infrastructure (required for some charts)

## Using Helm

After installing the Helm client and adding the P2P repository, Helm is your tool of choice to manage packages on your Kubernetes cluster. For detailed guidance on using Helm, see the [official documentation](https://helm.sh/docs/intro/using_helm/).

Here's a selection of helpful Helm commands to kickstart your journey:

* Install a chart: `helm install my-release p2p-avs/<chart-name>`
* Upgrade your application: `helm upgrade my-release p2p-avs/<chart-name>`

## Contribute

We welcome contributions to improve our Helm charts. If you discover any bugs, have issues, or ideas for enhancements, feel free to open an issue or submit a pull request. Every feedback, bug report, or feature request is invaluable to us, and we appreciate the community's involvement in making P2P's Helm charts better.

Feel free to explore the repository and experiment with the Helm charts to suit your specific needs. P2P's Helm charts aim to make application deployment on Kubernetes an effortless experience.
1 change: 1 addition & 0 deletions charts/langrange/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secret.yaml
6 changes: 6 additions & 0 deletions charts/langrange/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
appVersion: 0.1.0
description: A Helm chart for Kubernetes
name: langrange
type: application
version: 0.1.0
147 changes: 147 additions & 0 deletions charts/langrange/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# README

This Helm chart is used to deploy a Kubernetes application. The following documentation provides details on the configurable values and their default settings.

## Table of Contents

- [README](#readme)
- [Table of Contents](#table-of-contents)
- [Parameters](#parameters)
- [Global Parameters](#global-parameters)
- [Service Parameters](#service-parameters)
- [Ingress Parameters](#ingress-parameters)
- [Configuration Parameters](#configuration-parameters)
- [Register Container Parameters](#register-container-parameters)
- [Node Container Parameters](#node-container-parameters)
- [Pod Parameters](#pod-parameters)
- [Service Account Parameters](#service-account-parameters)
- [VM Pod Scrape Parameters](#vm-pod-scrape-parameters)
- [Example](#example)

## Parameters

### Global Parameters

| Parameter | Description | Default |
|--------------------|--------------------------------------|---------|
| `nameOverride` | Optionally override the name of the chart | `""` |
| `fullnameOverride` | Optionally override the full name of the chart | `""` |
| `replicaCount` | Number of replicas to deploy | `1` |
| `labels` | Additional labels to add to resources | `{}` |
| `imagePullSecrets` | Secrets for pulling images from a private registry | `[]` |

### Service Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `service.annotations` | Annotations to add to the service | `{}` |
| `service.type` | Type of service to create | `ClusterIP` |
| `service.ports` | List of ports to expose from the service | `[]` |

### Ingress Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `ingress.annotations` | Annotations to add to the ingress | `{}` |
| `ingress.enabled` | Enable or disable the ingress | `false` |
| `ingress.host` | Hostname for the ingress | `example.com` |

### Configuration Parameters

| Parameter | Description | Default |
|-----------------------------|--------------------------------------|---------------|
| `configs.operator.yaml` | Configuration file for the operator | `# some configs via file` |

### Register Container Parameters

| Parameter | Description | Default |
|-----------------------------------|--------------------------------------|---------------|
| `register.enabled` | Enable or disable the register container | `true` |
| `register.image.repository` | Image registry for the register container | `<IMAGE_REGISTRY>` |
| `register.image.pullPolicy` | Image pull policy for the register container | `Always` |
| `register.image.tag` | Image tag for the register container | `<IMAGE_TAG>` |
| `register.args` | Arguments to pass to the register container | `["--config=/app/config/operator.yaml", "register-operator-with-avs"]` |

### Node Container Parameters

| Parameter | Description | Default |
|-----------------------------------|--------------------------------------|---------------|
| `node.volumeMounts` | Volume mounts for the node container | `[]` |
| `node.image.repository` | Image registry for the node container | `<IMAGE_REGISTRY>` |
| `node.image.pullPolicy` | Image pull policy for the node container | `Always` |
| `node.image.tag` | Image tag for the node container | `<IMAGE_TAG>` |
| `node.ports` | Ports to expose from the node container | `[]` |
| `node.resources` | Resource limits and requests for the node container | `{}` |
| `node.env` | Environment variables for the node container | `[]` |
| `node.args` | Arguments to pass to the node container | `[]` |
| `node.readinessProbe` | Readiness probe for the node container | `{}` |
| `node.livenessProbe` | Liveness probe for the node container | `{}` |

### Pod Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `nodeSelector` | Node selector for the pod | `{}` |
| `tolerations` | Tolerations for the pod | `[]` |
| `affinity` | Affinity rules for the pod | `{}` |
| `podAnnotations` | Annotations to add to the pod | `{}` |
| `podSecurityContext` | Security context for the pod | `{}` |
| `securityContext` | Security context for the container | `{}` |
| `volumes` | Volumes for the pod | `[]` |

### Service Account Parameters

| Parameter | Description | Default |
|------------------------------|--------------------------------------|---------------|
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `""` |

### VM Pod Scrape Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `vmPodScrape.enabled` | Enable or disable VM Pod Scraping | `true` |

## Example

To deploy the chart with custom values, create a `values.yaml` file:

```yaml
replicaCount: 2

service:
type: LoadBalancer
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080

ingress:
enabled: true
host: myapp.example.com

register:
image:
repository: my-registry/my-register
tag: latest

node:
image:
repository: my-registry/my-node
tag: stable
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 1
memory: 1Gi
```
Then install the chart using the Helm CLI:
```sh
helm install my-release -f values.yaml .
```
68 changes: 68 additions & 0 deletions charts/langrange/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "langrange.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "langrange.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "langrange.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "langrange.labels" -}}
helm.sh/chart: {{ include "langrange.chart" . }}
{{ include "langrange.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "langrangeRegister.labels" -}}
helm.sh/chart: {{ include "langrange.chart" . }}
{{ include "langrangeRegister.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "langrange.selectorLabels" -}}
app.kubernetes.io/name: {{ include "langrange.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "langrangeRegister.selectorLabels" -}}
app.kubernetes.io/name: {{ include "langrange.name" . }}-register
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/langrange/templates/configmap.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "langrange.fullname" . }}-config
labels:
{{- include "langrange.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
data:
{{- if .Values.configs }}
{{- toYaml .Values.configs | nindent 2 }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/langrange/templates/ingress.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "langrange.fullname" . }}
labels:
{{- include "langrange.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end}}
spec:
ingressClassName: nginx
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "langrange.fullname" . }}
port:
name: node-api
{{- end }}
Loading

0 comments on commit 9db3c33

Please sign in to comment.