Skip to content

Commit

Permalink
chore: add my-chart example
Browse files Browse the repository at this point in the history
  • Loading branch information
hagzag committed Dec 16, 2023
1 parent 967564c commit f5a8dd6
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# helm-charts

A helm chart repository - `./charts` folder will be used to store helm chart needed by the labs project
his functionality is in beta and is subject to change. The code is provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

## OCI Usage

Helm must be installed to use the charts. Please refer to Helm's documentation to get started.

Get the common chart (note that `/charts/common` doesn't have a ./templates folder)

```sh
git clone [email protected]:hagzag/helm-charts.git
cd helm-charts/charts/common
helm dep update --skip-refresh
```

Should yield:

```sh
Saving 1 charts
Downloading common from repo oci://ghcr.io/hagzag/charts
Pulled: ghcr.io/hagzag/charts/common:0.2.0
Digest: sha256:e3e1bd9ed3ade825f4e0911e18203cafcea23f236d5572d59124759981174099
Deleting outdated charts
```
You should see the `./charts` filder with `common-${version}.tgz`
If you don't try to ghcr login: `echo $GITHUB_TOKEN | docker login ghcr.io -u <GITHUB_USER> --password-stdin`
6 changes: 6 additions & 0 deletions charts/my-chart/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: oci://ghcr.io/hagzag/charts
version: 0.2.0
digest: sha256:d19f44effdf9771e74a6b1727f01ce4b9bf9e0fb7575595ca6fe2b6eee3985eb
generated: "2023-12-16T16:10:15.665747+02:00"
30 changes: 30 additions & 0 deletions charts/my-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: my-chart
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

dependencies:
- alias: my-chart
name: common
version: 0.2.0
repository: oci://ghcr.io/hagzag/charts
102 changes: 102 additions & 0 deletions charts/my-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# common

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

A Helm chart for Kubernetes
This is an exmaple of how we can use an application chart with the name my-chart as exmaple and still get a way with managing simpler use-cases ... -> so consider this warning before running to production with this ... ;)

## Usage

Get the common chart (note that `/charts/common` doesn't have a ./templates folder)

```sh
git clone [email protected]:hagzag/helm-charts.git
cd helm-charts/charts/common
helm dep update --skip-refresh
```


Should yield:


```sh
Saving 1 charts
Downloading common from repo oci://ghcr.io/hagzag/charts
Pulled: ghcr.io/hagzag/charts/common:0.2.0
Digest: sha256:e3e1bd9ed3ade825f4e0911e18203cafcea23f236d5572d59124759981174099
Deleting outdated charts
```
You should see the `./charts` filder with `common-${version}.tgz`
If you don't try to ghcr login: `echo $GITHUB_TOKEN | docker login ghcr.io -u <GITHUB_USER> --password-stdin`

## Requirements

- [ ] ghcr access basicallya `GITHUB_TOKEN`

| Repository | Name | Version |
|------------|------|---------|
| oci://ghcr.io/hagzag/charts | common(common) | 0.2.0 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| common.affinity | object | `{}` | |
| common.args[0] | string | `"poetry"` | |
| common.args[1] | string | `"run"` | |
| common.args[2] | string | `"uvicorn"` | |
| common.args[3] | string | `"src.api.main:app"` | |
| common.args[4] | string | `"--host"` | |
| common.args[5] | string | `"0.0.0.0"` | |
| common.args[6] | string | `"--port"` | |
| common.args[7] | int | `9000` | |
| common.autoscaling.enabled | bool | `false` | |
| common.autoscaling.maxReplicas | int | `100` | |
| common.autoscaling.minReplicas | int | `1` | |
| common.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| common.env | object | `{}` | |
| common.fullnameOverride | string | `""` | |
| common.image.pullPolicy | string | `"IfNotPresent"` | |
| common.image.repository | string | `"nginx"` | |
| common.image.tag | string | `""` | |
| common.imagePullSecrets | list | `[]` | |
| common.ingress.annotations | object | `{}` | |
| common.ingress.className | string | `""` | |
| common.ingress.enabled | bool | `false` | |
| common.ingress.hosts[0].host | string | `"chart-example.local"` | |
| common.ingress.hosts[0].paths[0].path | string | `"/"` | |
| common.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| common.ingress.tls | list | `[]` | |
| common.livenessProbe.enabled | bool | `false` | |
| common.livenessProbe.httpGet.path | string | `"/"` | |
| common.livenessProbe.httpGet.port | string | `"http"` | |
| common.livenessProbe.initialDelaySeconds | int | `10` | |
| common.livenessProbe.periodSeconds | int | `10` | |
| common.nameOverride | string | `""` | |
| common.nodeSelector | object | `{}` | |
| common.podAnnotations | object | `{}` | |
| common.podLabels | object | `{}` | |
| common.podSecurityContext | object | `{}` | |
| common.readinessProbe.enabled | bool | `false` | |
| common.readinessProbe.httpGet.path | string | `"/"` | |
| common.readinessProbe.httpGet.port | string | `"http"` | |
| common.readinessProbe.initialDelaySeconds | int | `10` | |
| common.readinessProbe.periodSeconds | int | `10` | |
| common.resources | object | `{}` | |
| common.securityContext | object | `{}` | |
| common.service.enabled | bool | `false` | |
| common.service.port | int | `80` | |
| common.service.type | string | `"ClusterIP"` | |
| common.serviceAccount.annotations | object | `{}` | |
| common.serviceAccount.automount | bool | `true` | |
| common.serviceAccount.create | bool | `true` | |
| common.serviceAccount.name | string | `""` | |
| common.tolerations | list | `[]` | |
| common.volumeMounts | list | `[]` | |
| common.volumes | list | `[]` | |
| global.image.repository | string | `""` | |
| global.image.tag | string | `""` | |
| replicaCount | int | `1` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.2](https://github.com/norwoodj/helm-docs/releases/v1.11.2)
137 changes: 137 additions & 0 deletions charts/my-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Default values for common.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
image:
repository: ""
tag: ""

replicaCount: 1

my-chart:
image:
repository: nginx
pullPolicy: IfNotPresent
tag: ""

env: {}
# - name: LOG_LEVEL
# value: "INFO"
# - name: SCALER_API_EP
# value: "http://api:9090/scale"

args:
- poetry
- run
- uvicorn
- src.api.main:app
- --host
- 0.0.0.0
- --port
- 9000

livenessProbe:
enabled: false
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 10

readinessProbe:
enabled: false
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 10


imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
enabled: false
type: ClusterIP
port: 80

ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit f5a8dd6

Please sign in to comment.