Compare commits

...

15 Commits

Author SHA1 Message Date
sharvarikhamkar1304 fe8cec4075
feat : Added helm chart for ingress management (#285)
* Add ingress-management

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Update values.yaml

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Move ingress-management chart under charts directory

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Create README.md

* Update README.md

* Update README.md

* Update README.md

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Fix: Update Chart.yaml metadata with repo and maintainer info

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Fix maintainer name

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* update

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Delete charts/ingress-management/etc directory

* Delete charts/ingress-management/LICENSE

* Update README.md

* Update README.md

* fix: update helm chart for ingress-management

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Update values.yaml

* Update values.yaml

* Update values.yaml

* Fix: update values.yaml

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>

* Update values.yaml

* Update httproute.yaml

* Update values.yaml

* Update httproute.yaml

* Update values.yaml

* Update values.yaml

* Update values.yaml

* Update httproute.yaml

* Update values.yaml

* Update values.yaml

* Update values.yaml

* Update values.yaml

---------

Signed-off-by: sharvarikhamkar1304 <sharvari.khamkar@mygurukulam.co>
2025-08-05 13:41:19 +05:30
Abhishek Dubey 22a3df98c8
[COE][Add] Added helm chart for worker based deployment (#281)
* Added helm chart for worker based deployment

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

* Added helm chart for worker based deployment

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

* Added helm chart for worker based deployment

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

---------

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
2025-07-04 00:52:37 +05:30
Prashantdev780 9a6b440441
Helm fix for liveliness probe and readiness probe (#279) 2025-06-30 20:07:40 +05:30
Sandeep Rawat 6306426bed
Merge pull request #278 from OT-CONTAINER-KIT/helm_fix
Fixed secrets block in deployment.yml of microservice
2025-06-30 18:34:38 +05:30
Prashantdev780 ff645ddecd
Update Chart.yaml 2025-06-30 18:32:37 +05:30
Prashant Sharma 3619d89003 Fixed secrets block in deployment.yml of microservice 2025-06-30 17:13:05 +05:30
Abhishek Dubey 7706b2da4f
Added helm chart for web service deployment (#271)
Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
2025-02-10 16:51:35 +05:30
hiteshmakol1 eaa6fc3aa6
Karpenter 0.3.0 Modifications (#270)
* Added new code for Karpenter 0.3.0 including new chart version, interruptionQueue parameter, modified README, modified template yaml

Signed-off-by: Hitesh Makol <hitesh.makol@opstree.com>

* Fixed Linting for Chart.yaml

Signed-off-by: Hitesh Makol <hitesh.makol@opstree.com>

* Fixed CI steps for testing chart

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

* Fixed CI steps for testing chart

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

---------

Signed-off-by: Hitesh Makol <hitesh.makol@opstree.com>
Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
Co-authored-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
2025-01-14 12:08:56 +05:30
Abhishek Dubey d03ba9f362
Added base helm chart for k8s (#269)
Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
2025-01-13 13:10:37 +05:30
Abhishek Dubey 57fbc499a4
Fixed CI steps for testing chart (#268)
* Fixed CI steps for testing chart

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

* Fixed CI steps for testing chart

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

* Fixed CI steps for testing chart

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>

---------

Signed-off-by: Abhishek Dubey <abhishekbhardwaj510@gmail.com>
2025-01-13 12:31:44 +05:30
hiteshmakol1 d50ec64e5c
Karpenter 0.2.0 Modifications (#266)
* Added Comment in Chart, Changed example.yaml file , Added comments in values file

* Incorporated Review Comments
2025-01-08 11:55:00 +05:30
Abhishek Dubey 92971b2ab9
Update release.yaml 2025-01-07 15:44:49 +05:30
Abhishek Dubey d491b314b2
Update release.yaml 2025-01-07 15:42:45 +05:30
Abhishek Dubey c8fac9acd1
Update ct.yaml 2025-01-07 15:40:48 +05:30
hiteshmakol1 021f437068
Enhanced README for the Karpenter Helm chart (#264)
* Modifie README for karpenter helm chart

* Incorporated Review Comments
2025-01-07 15:12:15 +05:30
43 changed files with 1198 additions and 220 deletions

View File

@ -8,14 +8,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.5.4
version: v3.16.2
- uses: actions/setup-python@v4
with:

View File

@ -25,3 +25,4 @@ jobs:
VALIDATE_YAML: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: .*(README\.md|NOTES.txt).*

View File

@ -25,7 +25,7 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.5.4
version: v3.16.2
- uses: actions/setup-python@v4
with:
@ -42,8 +42,8 @@ jobs:
- name: Update Helm Repositories
run: helm repo update
- name: Update Chart Dependencies for redis-operator
run: helm dependency update charts/redis-operator
- name: Update Chart Dependencies for karpenter
run: helm dependency update charts/karpenter
- name: List Changed Charts
id: list-changed

View File

@ -8,34 +8,30 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.5.4
version: v3.16.2
- name: Install yq
run: |
sudo snap install yq
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.0
- name: Install and test Redis Related Helm charts
- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true
- name: Install and test Helm charts
run: |
kubectl cluster-info --context kind-kind
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel")
for dir in "${chart_dirs[@]}"
do
if [[ -f ./charts/$dir/Chart.yaml ]]; then
helm dependency update ./charts/$dir/
fi
chart_version=$(yq e .version ./charts/$dir/Chart.yaml)
echo "Installing $dir chart with version $chart_version..."
helm install $dir ./charts/$dir/
helm test $dir
done
echo "Listing installed Helm charts..."
changed=$(ct list-changed --config ct.yaml)
ct install --config ct.yaml || true

View File

@ -14,14 +14,6 @@ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts
You can then run `helm search repo ot-helm` to see the charts.
### Helm Charts List
Currently supported helm charts are:-
- [Redis Operator](./charts/redis-operator)
- [Redis Standalone](./charts/redis)
- [Redis Cluster](./charts/redis-cluster)
- [K8s Vault Webhook](./charts/k8s-vault-webhook)
### Pre-Requisities

21
charts/base/Chart.yaml Normal file
View File

@ -0,0 +1,21 @@
---
apiVersion: v1
description: A base helm chart which will be used by different helm charts
engine: gotpl
maintainers:
- name: iamabhishek-dubey
email: "abhishek.dubey@opstree.com"
url: https://github.com/iamabhishek-dubey
name: base
sources:
- https://github.com/ot-container-kit/helm-charts
version: 0.1.0
appVersion: "0.1.0"
home: https://github.com/ot-container-kit/helm-charts
keywords:
- deployment
- base
- opstree
- kubernetes
- openshift
icon: https://raw.githubusercontent.com/OT-CONTAINER-KIT/helm-charts/main/static/helm-chart-logo.svg

28
charts/base/README.md Normal file
View File

@ -0,0 +1,28 @@
# base
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
A base helm chart which will be used by different helm charts.
**Homepage:** <https://github.com/ot-container-kit/helm-charts>
## Maintainers
| Name | Email | Url |
|-------------------|----------------------------|----------------------------------------|
| iamabhishek-dubey | abhishek.dubey@opstree.com | <https://github.com/iamabhishek-dubey> |
## Source Code
* <https://github.com/ot-container-kit/helm-charts>
## Values
| Key | Type | Default | Description |
|----------------------------|--------|---------|--------------------------------------------------------------------------------|
| config | object | `{}` | ConfigMap key value pair to create configs |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

View File

@ -0,0 +1,13 @@
{{- define "configmap" -}}
{{- if .Values.base.config -}}
{{- $top := . -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
data:
{{- toYaml .Values.base.config | nindent 2 -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,42 @@
{{/*
Create a default fully qualified app name.
We truncate service name aka .Release.Name at 59 chars because some Kubernetes name fields are limited to 63 (by the DNS naming spec).
We append 4 characters for chart type at the end which is -web or -crn or -wrk or -job or -sts.
*/}}
{{- define "base.fullname" -}}
{{- $name := .Release.Name | trunc 59 | trimSuffix "-" }}
{{- printf "%s-%s" $name .Chart.Name }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "base.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "base.labels" -}}
helm.sh/chart: {{ include "base.chart" . }}
{{ include "base.selectorLabels" . }}
{{- if .Release.Revision }}
app.kubernetes.io/version: {{ .Release.Revision | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "base.selectorLabels" -}}
app.kubernetes.io/name: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "base.serviceAccountName" -}}
{{- default (include "base.fullname" .) .Values.base.serviceAccount.name }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{- define "serviceAccount" -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "base.serviceAccountName" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
{{- with .Values.base.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

13
charts/base/values.yaml Normal file
View File

@ -0,0 +1,13 @@
# Default values for base template.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
serviceAccount:
# -- 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: ""
# -- ConfigMap key value pair to create configs
config: {}

View File

@ -0,0 +1,16 @@
apiVersion: v2
name: ingress-management
description: A Helm chart to manage Ingress traffic
version: 0.1.0
appVersion: "1.0"
home: https://github.com/ot-container-kit/helm-charts
maintainers:
- name: sharvarikhamkar1304
keywords:
- ingress
- kong
- httpRoute
- kubernetes
icon: https://raw.githubusercontent.com/OT-CONTAINER-KIT/helm-charts/main/static/helm-chart-logo.svg
sources:
- https://github.com/ot-container-kit/helm-charts

View File

@ -0,0 +1,49 @@
# Ingress Management Helm Chart
A simple and reusable Helm chart to manage Kubernetes Gateway API HTTPRoutes for routing traffic to backend services.
This chart helps manage HTTPRoute resources to expose services using the Kubernetes Gateway API. You can customize host, path, service, and namespace via values.
## Homepage
[https://github.com/ot-container-kit/helm-charts](https://github.com/ot-container-kit/helm-charts)
## Maintainers
| Name | URL |
| ---------------- | --------------------------------------------- |
| sharvari-khamkar | [GitHub](https://github.com/sharvari-khamkar) |
## Source Code
[GitHub - ot-container-kit/helm-charts](https://github.com/ot-container-kit/helm-charts)
## Requirements
| Repository | Name | Version |
| ------------------------------------------------------------------------------------------------ | ---- | ------- |
| [https://ot-container-kit.github.io/helm-charts](https://ot-container-kit.github.io/helm-charts) | base | 0.1.0 |
## Values
| **Attribute** | **Scope** | **Example** | **Description** | **Default** |
|------------------|------------------|------------------------|------------------------------------------------------------------------|--------------|
| <br> `name` <br> <br> | <br> Global <br> <br> | <br> `"my-app"` <br> <br> | <br> Name of the HTTPRoute and backend service (the app name)<br><br> | `""` |
| <br> `namespace` <br> <br> | <br> Global <br> <br> | <br> `"default"` <br> <br> | <br> Kubernetes namespace where resources like HTTPRoute will be deployed<br><br> | `""` |
| <br> `host` <br> <br> | Routing | `"app.example.com"` | Hostname to expose the app<br><br> | `""` |
| <br>`path` <br> <br> | Routing | `"/api"` | Path under the host<br><br> | `""` |
| <br>`service.name` <br> <br> | Service Config | `"my-backend-svc"` | Name of the backend service to which traffic will be routed<br><br> | `""` |
| <br>`service.kind` <br> <br> | Service Config | `"Service"` | Kind of backend resource (Service by default)<br><br> | `"Service"` |
| <br>`service.port` <br> <br> | Service Config | `80` | Port on which the backend service listens<br><br> | `80` |

View File

@ -0,0 +1,46 @@
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ required "A valid 'name' is required!" .Values.name }}
{{- if .Values.labels }}
labels:
{{ toYaml .Values.labels | indent 4 }}
{{- end }}
{{- if .Values.annotations }}
annotations:
{{ toYaml .Values.annotations | indent 4 }}
{{- end }}
spec:
{{- if .Values.parentRefs }}
parentRefs:
{{- range .Values.parentRefs }}
- name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.hostnames }}
hostnames:
{{- range .Values.hostnames }}
- "{{ . }}"
{{- end }}
{{- end }}
rules:
{{- range .Values.rules }}
- matches:
{{- range .matches }}
- path:
type: {{ .path.type }}
value: {{ .path.value | quote }}
{{- end }}
backendRefs:
{{- range .backendRefs }}
- name: {{ .name }}
kind: {{ .kind | default "Service" }}
port: {{ .port }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,60 @@
---
# charts/ingress-management/values.yaml
# -- Name of the HTTPRoute and backend service (typically the app name)
name: ""
# -- Labels to apply to the HTTPRoute metadata
labels:
app: ""
# -- Optional annotations to apply to the HTTPRoute resource
annotations: {}
# -- Reference to the Gateway (parentRefs)
parentRefs:
- name: ""
namespace: ""
# -- Hostnames to be matched in the HTTPRoute
hostnames:
- ""
# -- Routing rules for HTTPRoute
rules:
- matches:
- path:
type: PathPrefix
value: ""
backendRefs:
- name: ""
kind: Service
port: 80
# -----------------------------------------------------
# Example values.yaml File
# -----------------------------------------------------
# name: open-webui
# labels:
# app: open-webui
# annotations:
# konghq.com/protocols: https
# konghq.com/https-redirect-status-code: "301"
# parentRefs:
# - name: kong
# namespace: default
# hostnames:
# - bp-ai.opstree.dev
# rules:
# - matches:
# - path:
# type: PathPrefix
# value: /
# backendRefs:
# - name: open-webui
# kind: Service
# port: 80

View File

@ -1,6 +1,8 @@
apiVersion: v2
name: ot-karpenter
version: 0.1.0
version: 0.3.0
maintainers:
- name: opstree
dependencies:
- name: karpenter
version: 1.1.1

View File

@ -7,21 +7,36 @@ To install Karpenter, use the following commands:
```shell
$ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
$ helm install karpenter ot-helm/karpenter --namespace kube-system
$ helm install karpenter ot-helm/karpenter --namespace <namespace> --dependency-update --create-namespace
```
Adds the ot-helm repository to Helm, which contains the Karpenter Helm chart.
Installs the Karpenter chart from the ot-helm repository.
To upgrade the setup:
```shell
$ helm upgrade karpenter ot-helm/karpenter --install --namespace kube-system
$ helm upgrade karpenter ot-helm/karpenter --install --namespace <namespace> --create-namespace
```
Upgrades an existing Karpenter release or installs it if it doesn't exist.
To uninstall the chart:
```shell
$ helm delete karpenter --namespace kube-system
$ helm delete karpenter --namespace <namespace>
```
Deletes the Karpenter release from the specified namespace.
Replace <namespace> with the namespace where Karpenter is installed.
### Pre-Requisites
- Kubernetes => 1.18+

View File

@ -1,67 +1,82 @@
# Custom values for chart
clusterName: test-cluster
awsPartition: aws
awsAccountId: 384961113000
karpenterVersion: 1.1.1
#This example below has 2 nodepools for reference
# Custom values for your chart
clusterName: "" # Name of the EKS cluster (for identification in the chart and Karpenter)
awsPartition: "" # AWS partition, default is 'aws' (used in multi-region or partitioned environments)
awsAccountId: 3333 # AWS account ID where the resources will be provisioned
# Karpenter chart overrides
karpenter:
settings:
clusterName: test-cluster
clusterName: "" # Cluster name for the Karpenter controller to identify and manage nodes in this cluster
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::384961113000:role/KarpenterControllerRole-test-cluster
eks.amazonaws.com/role-arn: arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks # IAM role for Karpenter controller's access to AWS services
controller:
resources:
requests:
cpu: "1"
memory: "1Gi"
limits:
cpu: "1"
memory: "1Gi"
cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated)
memory: "1Gi" # Memory resource request for the Karpenter controller
limits:
cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume)
memory: "1Gi" # Memory resource limit for the Karpenter controller
# NodePools define groups of nodes with specific requirements
nodePools:
- name: default
requirements:
- key: kubernetes.io/arch
operator: In
values:
- "amd64"
- key: kubernetes.io/os
operator: In
values:
- "linux"
- key: karpenter.sh/capacity-type
operator: In
values:
- "on-demand"
- key: karpenter.k8s.aws/instance-category
operator: In
values:
- "t"
- "m"
- "r"
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values:
- "2"
nodeClass:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default # Name of the ec2nodeclass
expireAfter: 720h
limits:
- name: default # Name of the node pool, used for identification
limits: # Required Field
cpu: "1000"
disruption:
memory: "1000Gi"
disruption: # Required Field
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
annotations:
example.com/owner: "my-team"
example.com/maintainer: "admin@company.com"
# taints:
# - key: "example.com/special-taint"
# value: "special-value"
# effect: "NoExecute"
labels:
environment: production
team: "engineering"
requirements: # Node pool requirements for instance types and other properties
- key: kubernetes.io/arch
operator: In # Specifies the architecture for nodes
values:
- "amd64"
- key: kubernetes.io/os
operator: In # Specifies the OS type for nodes
values:
- "linux" # The node pool requires Linux OS
- key: karpenter.sh/capacity-type
operator: In # Specifies the capacity type for nodes
values:
- "on-demand"
- key: karpenter.k8s.aws/instance-category
operator: In # Specifies allowed EC2 instance categories
values:
- "t" # Instance category t (e.g., T2, T3)
- "m"
- "r"
minValues: 2 # Minimum number of instances of each category
- key: karpenter.k8s.aws/instance-family
operator: Exists # Specifies that instances in the family must exist (e.g., m5, r5)
minValues: 5 # Minimum number of instances in the specified family
- key: karpenter.k8s.aws/instance-family
operator: In # Specifies that the instance family must match one of the listed values
values:
- "m5"
- "m5d"
- "c5"
- "c5d"
- "c4"
- "r4"
minValues: 3 # Minimum number of instances from these families
- key: node.kubernetes.io/instance-type
operator: Exists # Ensures that the node pool has specific instance types
minValues: 10 # Minimum number of instances of the specified types
- key: karpenter.k8s.aws/instance-generation
operator: Gt # Specifies that the instance generation must be greater than a particular value
values:
- "2" # Instance generation must be greater than 2 (i.e., newer generation)
nodeClass:
group: karpenter.k8s.aws # Node class group for Karpenter
kind: EC2NodeClass # Kind of node class, EC2NodeClass indicates AWS EC2 instances
name: default # The name of the node class (default for this pool)

View File

@ -0,0 +1,33 @@
{{- range .Values.ec2NodeClasses }}
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: {{ .name }}
spec:
amiFamily: {{ .amiFamily | default "AL2" }}
role: {{ .role }}
{{- if .detailedMonitoring }}
detailedMonitoring: {{ .detailedMonitoring }}
{{- end }}
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: "{{ $.Values.clusterName }}"
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: "{{ $.Values.clusterName }}"
amiSelectorTerms:
- id: "{{ .amiSelector.arm }}"
- id: "{{ .amiSelector.amd }}"
{{- if .amiSelector.gpu }}
- id: "{{ .amiSelector.gpu }}"
{{- end }}
{{- if .amiSelector.name }}
- name: "{{ .amiSelector.name }}"
{{- end }}
{{- if .tags }}
tags:
{{- range $key, $value := .tags }}
{{ $key }}: "{{ $value }}"
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,146 +1,110 @@
# Custom values for your chart
clusterName: "" # Name of the EKS cluster (for identification in the chart and Karpenter)
awsPartition: "" # AWS partition, default is 'aws' (used in multi-region or partitioned environments)
awsAccountId: 3333 # AWS account ID where the resources will be provisioned
karpenterVersion: 1.1.1 # Version of Karpenter to be installed
# Name of the EKS cluster (for identification in the chart and Karpenter)
clusterName: ""
# AWS partition, default is 'aws' (used in multi-region or partitioned environments)
awsPartition: ""
# AWS account ID where the resources will be provisioned
awsAccountId: 3333
# Karpenter chart overrides
karpenter:
settings:
clusterName: "" # Cluster name for the Karpenter controller to identify and manage nodes in this cluster
# Cluster name for the Karpenter controller to identify and manage nodes in this cluster
clusterName: ""
# Name of SQS queue for handling EC2 instance interruptions
# interruptionQueue: ""
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks # IAM role for Karpenter controller's access to AWS services
# IAM role ARN for Karpenter controller's access to AWS services
eks.amazonaws.com/role-arn: arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks
controller:
resources:
requests:
cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated)
memory: "1Gi" # Memory resource request for the Karpenter controller
limits:
cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume)
memory: "1Gi" # Memory resource limit for the Karpenter controller
# Karpenter controller resources can be customized in this section below
# controller:
# resources:
# requests:
# cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated)
# memory: "1Gi" # Memory resource request for the Karpenter controller
# limits:
# cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume)
# memory: "1Gi" # Memory resource limit for the Karpenter controller
# EC2NodeClasses define the EC2 instance classes that Karpenter can use
ec2NodeClasses:
- name: default
# Amazon Linux 2 AMI family
amiFamily: AL2
# "KarpenterNodeRole-my-eks-cluster" # Name of karpenter Node Role ( NOT THE ARN )
role:
amiSelector:
# To get the AMI ID, run the commands below in the AWS CLI and replace the AMI ID in the values.yaml file
# ARM_AMI_ID="$(aws ssm get-parameter --name /aws/service/eks/optimized-ami/${K8S_VERSION}/amazon-linux-2-arm64/recommended/image_id --query Parameter.Value --output text)"
arm:
# AMD_AMI_ID="$(aws ssm get-parameter --name /aws/service/eks/optimized-ami/${K8S_VERSION}/amazon-linux-2/recommended/image_id --query Parameter.Value --output text)"
amd:
# GPU_AMI_ID="$(aws ssm get-parameter --name /aws/service/eks/optimized-ami/${K8S_VERSION}/amazon-linux-2-gpu/recommended/image_id --query Parameter.Value --output text)"
# gpu: ami-gpu-id
# amazon-eks-node-1.27-* # Optional: EKS Node AMI Name
# name:
# Optional, propagates tags to underlying EC2 resources
# tags:
# environment: production
# team: "engineering"
# owner: "admin@company.com"
# Enable detailed monitoring for the EC2 instance
# detailedMonitoring: true
# NodePools define groups of nodes with specific requirements
nodePools:
- name: default # Name of the node pool, used for identification
limits: # Required Field
cpu: "1000"
memory: "1000Gi"
disruption: # Required Field
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
requirements: # Node pool requirements for instance types and other properties
- key: kubernetes.io/arch
operator: In # Specifies the architecture for nodes
- name: default # Name of the node pool, preset here is set to default nodepool
requirements: # List of node requirements for scheduling
- key: kubernetes.io/arch # Architecture requirement (e.g., amd64, arm64)
operator: In # Only nodes with the specified architecture will be selected
values:
- "amd64"
- key: kubernetes.io/os
operator: In # Specifies the OS type for nodes
- "amd64" # Specifies that the node should have an amd64 architecture
- key: kubernetes.io/os # OS requirement (e.g., linux, windows)
operator: In # Only nodes with the specified OS will be selected
values:
- "linux" # The node pool requires Linux OS
- key: karpenter.sh/capacity-type
operator: In # Specifies the capacity type for nodes
- "linux" # Specifies that the node should run Linux
- key: karpenter.sh/capacity-type # Defines the instance's capacity type
operator: In # Only nodes with the specified capacity type will be selected
values:
- "on-demand"
- key: karpenter.k8s.aws/instance-category
operator: In # Specifies allowed EC2 instance categories
- "on-demand" # Specifies that the node should be an on-demand instance, can be "spot" as well
- key: karpenter.k8s.aws/instance-category # Defines the instance category (e.g., t, m, r)
operator: In # Only nodes with the specified instance category will be selected
values:
- "t" # Instance category t (e.g., T2, T3)
- "m"
- "r"
minValues: 2 # Minimum number of instances of each category
- key: karpenter.k8s.aws/instance-family
operator: Exists # Specifies that instances in the family must exist (e.g., m5, r5)
minValues: 5 # Minimum number of instances in the specified family
- key: karpenter.k8s.aws/instance-family
operator: In # Specifies that the instance family must match one of the listed values
values:
- "m5"
- "m5d"
- "c5"
- "c5d"
- "c4"
- "r4"
minValues: 3 # Minimum number of instances from these families
- key: node.kubernetes.io/instance-type
operator: Exists # Ensures that the node pool has specific instance types
minValues: 10 # Minimum number of instances of the specified types
- key: karpenter.k8s.aws/instance-generation
operator: Gt # Specifies that the instance generation must be greater than a particular value
values:
- "2" # Instance generation must be greater than 2 (i.e., newer generation)
nodeClass:
group: karpenter.k8s.aws # Node class group for Karpenter
kind: EC2NodeClass # Kind of node class, EC2NodeClass indicates AWS EC2 instances
name: default # The name of the node class (default for this pool)
- name: default1
expireAfter: 720h
labels:
billing-team: my-team
environment: production
annotations:
example.com/owner: "my-team"
example.com/maintainer: "admin@company.com"
limits:
cpu: "1000"
memory: "1000Gi"
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
nodeClass:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default
taints:
- key: "example.com/special-taint"
value: "my-value"
effect: "NoSchedule"
- key: "example.com/another-taint"
effect: "NoExecute"
requirements:
- key: kubernetes.io/arch
operator: In
values:
- "amd64"
- key: kubernetes.io/os
operator: In
values:
- "linux"
- key: karpenter.sh/capacity-type
operator: In
values:
- "on-demand"
- key: karpenter.k8s.aws/instance-category
operator: In
values:
- "t"
- "t" # These can be customized as per need
- "m"
- "r"
minValues: 2
- key: karpenter.k8s.aws/instance-family
operator: Exists
minValues: 5
- key: karpenter.k8s.aws/instance-family
operator: In
# - key: karpenter.k8s.aws/instance-family # Uncomment to define the instance family (e.g., t3, m5, r5)
# operator: In
# values:
# - "t3a"
- key: karpenter.k8s.aws/instance-generation # Instance generation requirement
operator: Gt # Greater than the specified value
values:
- "m5"
- "m5d"
- "c5"
- "c5d"
- "c4"
- "r4"
minValues: 3
- key: node.kubernetes.io/instance-type
operator: Exists
minValues: 10
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values:
- "2"
- "2" # Specifies that only instance generations greater than 2 are allowed
nodeClass: # Defines the node class, which is linked to EC2NodeClass
group: karpenter.k8s.aws # Group of the EC2NodeClass
kind: EC2NodeClass # Type of node class, which is EC2NodeClass in this case
name: default # Name of the EC2NodeClass to use for the node pool (name of the EC2 instance class)
expireAfter: 720h # Maximum lifetime of the node pool before it expires (720 hours = 30 days)
limits: # Resource limits for the node pool
cpu: "1000" # Maximum CPU limit for the node pool
memory: "1Gi"
disruption: # Policy for handling disruption in the node pool
consolidationPolicy: WhenEmptyOrUnderutilized # Consolidate nodes when they are empty or underutilized
consolidateAfter: 1m # Time after which consolidation will occur, in this case, 1 minute
# Uncomment Below annotations key ( next 3 Lines ) if you want to use annotations
# annotations: # Annotations are key-value pairs that provide additional metadata for the node pool
# example.com/owner: "my-team" # An example annotation that associates the node pool with a team
# example.com/maintainer: "admin@company.com" # Example annotation for the maintainer's contact information
# Uncomment below taint key ( next 4 Lines ) if you want to use taints
# taints: # Taints are used to control which pods can be scheduled on the node pool
# - key: "example.com/special-taint" # Taint key that identifies the taint
# value: "special-value" # Value associated with the taint
# effect: "NoExecute" # Effect of the taint. In this case, NoExecute means pods won't be scheduled on tainted nodes
# Comment Labels Key below if you dont want to use Labels
labels: # Labels are key-value pairs used for categorizing the node pool
environment: production # Label indicating that this node pool is for production use
team: "engineering" # Label associating the node pool with the engineering team

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: microservice
description: Basic helm chart for deploying microservices on kubernetes with best practices
type: application
version: 0.1.6
version: 0.1.8
appVersion: "0.1.2"
maintainers:
- name: ashwani-opstree

View File

@ -33,7 +33,7 @@ spec:
{{- end }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
@ -67,11 +67,11 @@ spec:
value: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if and .Values.deployment.healthProbes.enabled .Values.deployment.livenessProbe }}
{{- if and .Values.deployment.healthProbes.enabled .Values.deployment.livenessProbe.httpGet }}
livenessProbe:
{{- toYaml .Values.deployment.livenessProbe | nindent 12 }}
{{- end }}
{{- if and .Values.deployment.healthProbes.enabled .Values.deployment.readinessProbe }}
{{- if and .Values.deployment.healthProbes.enabled .Values.deployment.readinessProbe.httpGet }}
readinessProbe:
{{- toYaml .Values.deployment.readinessProbe | nindent 12 }}
{{- end }}

26
charts/web/Chart.yaml Normal file
View File

@ -0,0 +1,26 @@
---
apiVersion: v2
description: A deployment helm chart which will be used to deploy any type of stateless application
maintainers:
- name: iamabhishek-dubey
email: "abhishek.dubey@opstree.com"
url: https://github.com/iamabhishek-dubey
name: web
sources:
- https://github.com/ot-container-kit/helm-charts
dependencies:
- name: base
version: 0.1.0
repository: https://ot-container-kit.github.io/helm-charts
version: 0.1.0
appVersion: "0.1.0"
home: https://github.com/ot-container-kit/helm-charts
keywords:
- deployment
- base
- opstree
- kubernetes
- openshift
- microservice
- stateless
icon: https://raw.githubusercontent.com/OT-CONTAINER-KIT/helm-charts/main/static/helm-chart-logo.svg

46
charts/web/README.md Normal file
View File

@ -0,0 +1,46 @@
# Web Deployment Helm Chart
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
A deployment helm chart which will be used to deploy any type of stateless application
**Homepage:** <https://github.com/ot-container-kit/helm-charts>
## Maintainers
| Name | Email | Url |
|-------------------|------------------------------|----------------------------------------|
| iamabhishek-dubey | <abhishek.dubey@opstree.com> | <https://github.com/iamabhishek-dubey> |
## Source Code
* <https://github.com/ot-container-kit/helm-charts>
## Requirements
| Repository | Name | Version |
|------------------------------------------------|------|---------|
| https://ot-container-kit.github.io/helm-charts | base | 0.1.0 |
## Values
| Key | Type | Default | Description |
|------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| autoscaling | object | `{"enabled":false,"maxReplicas":50,"minReplicas":10,"targetCPUUtilizationPercentage":65,"targetMemoryUtilizationPercentage":65}` | Autoscaling properties with target CPU and Memory details |
| base | object | `{"image":{"command":[],"pullPolicy":"IfNotPresent","pullSecrets":"","repository":"nginx","tag":"latest"}}` | Base block to define the inputs for image, secret and configmap env |
| base.image | object | `{"command":[],"pullPolicy":"IfNotPresent","pullSecrets":"","repository":"nginx","tag":"latest"}` | Image block with all image details |
| base.image.command | list | `[]` | Additional command arguments which needs to be passed |
| base.image.pullPolicy | string | `"IfNotPresent"` | Default image pull policy |
| base.image.pullSecrets | string | `""` | Image pull secrets for private repository authentication |
| base.image.repository | string | `"nginx"` | Default image repository |
| base.image.tag | string | `"latest"` | Default image tag |
| healthcheck | object | `{"enabled":true,"statusPath":"/"}` | Healthcheck details for readiness and liveness probe |
| healthcheck.enabled | bool | `true` | Healthcheck is enabled or not |
| healthcheck.statusPath | string | `"/"` | Healthcheck status path on status will be checked |
| ingress | object | `{"annotations":{"ingress.gcp.kubernetes.io/pre-shared-cert":"global-sign-opstree-com-2024","kubernetes.io/ingress.allow-http":"false"},"class":"nginx","enabled":false}` | Ingress details with class, annotations and rules |
| internalIngress | object | `{"annotations":{"kubernetes.io/ingress.allow-http":"true"},"class":"nginx-internal","enabled":false}` | Internal ingress details with class, annotations and rules |
| replicaCount | int | `2` | Number of replicas for deployment, it will be overridden in case autoscaling is enabled |
| resources | object | `{}` | Kubernetes resource in terms of requests and limits |
| service | object | `{"port":80,"type":"ClusterIP"}` | Service specification details with port and type |
| service.type | string | `"ClusterIP"` | Prometheus metrics to expose metrics on path with port metrics: path: /v1/metrics port: 8081 |
| volumes | string | `nil` | Kubernetes volumes definition which needs to be mounted |

View File

@ -0,0 +1,4 @@
{{ include "configmap" . }}
---
{{ include "serviceAccount" . }}
---

View File

@ -0,0 +1,18 @@
{{- if .Values.volumes }}
{{- if .Values.volumes.configMaps }}
{{ range $cm := .Values.volumes.configMaps}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $cm.name }}
labels:
{{- include "base.labels" $ | nindent 4 }}
data:
{{- range $filename, $content := $cm.data }}
{{ $filename }}: |-
{{ $content | toString | indent 4}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,87 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
{{- with .Values.replicaCount }}
replicas: {{ . }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "base.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "base.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.base.image.pullSecrets }}
imagePullSecrets:
- name: {{ .Values.base.image.pullSecrets }}
{{- end }}
serviceAccountName: {{ include "base.serviceAccountName" . }}
terminationGracePeriodSeconds: 120
containers:
- name: {{ include "base.fullname" . }}
image: "{{ .Values.base.image.repository }}:{{ .Values.base.image.tag }}"
imagePullPolicy: {{ .Values.base.image.pullPolicy }}
{{- if .Values.base.image.command }}
command:
{{- toYaml .Values.base.image.command | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
livenessProbe:
httpGet:
path: {{ .Values.healthcheck.statusPath }}
port: http
initialDelaySeconds: 30
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: {{ .Values.healthcheck.statusPath }}
port: http
initialDelaySeconds: 30
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
failureThreshold: 3
{{- if .Values.base.config }}
envFrom:
- configMapRef:
name: {{ include "base.fullname" . }}
{{- end }}
{{- if .Values.base.secret }}
- secretRef:
name: {{ include "base.fullname" . }}
{{- end }}
{{- if .Values.volumes }}
volumeMounts:
{{- if .Values.volumes.configMaps }}
{{- range $conf := .Values.volumes.configMaps }}
- mountPath: {{ $conf.mountPath }}
name: {{ $conf.name }}-volume
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.volumes }}
volumes:
{{- if .Values.volumes.configMaps }}
{{- range $conf := .Values.volumes.configMaps }}
- name: {{ $conf.name }}-volume
configMap:
name: {{ $conf.name }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,33 @@
{{- if .Values.autoscaling.enabled }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "base.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,39 @@
---
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.class }}
labels:
{{- include "base.labels" . | nindent 4 }}
name: {{ include "base.fullname" . }}-external-ing
spec:
ingressClassName: {{ .Values.ingress.class }}
rules:
{{- range $rule := .Values.ingress.rules }}
- host: {{ $rule.hostname }}
http:
paths:
{{- if (kindIs "slice" $rule.path) }}
{{- range $path := $rule.path }}
- path: {{ $path }}
pathType: Prefix
backend:
service:
name: {{ include "base.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- if (kindIs "string" $rule.path) }}
- path: {{ $rule.path }}
pathType: Prefix
backend:
service:
name: {{ include "base.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,41 @@
{{- if .Values.internalIngress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "base.fullname" . }}-internal-ing
annotations:
kubernetes.io/ingress.class: {{ .Values.internalIngress.class }}
{{- if .Values.internalIngress.annotations }}
{{ toYaml .Values.internalIngress.annotations | nindent 4 }}
{{- end }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
ingressClassName: {{ .Values.internalIngress.class }}
rules:
{{- range $rule := .Values.internalIngress.rules }}
- host: {{ $rule.hostname }}
http:
paths:
{{- if (kindIs "slice" $rule.path) }}
{{- range $path := $rule.path }}
- path: {{ $path }}
pathType: Prefix
backend:
service:
name: {{ include "base.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- if (kindIs "string" $rule.path) }}
- path: {{ $rule.path }}
pathType: Prefix
backend:
service:
name: {{ include "base.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{- if .Values.base.secret -}}
{{- $top := . -}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
stringData:
{{- toYaml .Values.base.secret | nindent 2 -}}
{{- end -}}

View File

@ -0,0 +1,22 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "base.fullname" . }}
annotations:
{{- if .Values.service.metrics }}
prometheus.io/path: "{{ .Values.service.metrics.path }}"
prometheus.io/port: "{{ .Values.service.metrics.port }}"
prometheus.io/scrape: "true"
{{- end }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "base.selectorLabels" . | nindent 4 }}

91
charts/web/values.yaml Normal file
View File

@ -0,0 +1,91 @@
# -- Base block to define the inputs for image, secret and configmap env
base:
# -- Image block with all image details
image:
# -- Default image pull policy
pullPolicy: "IfNotPresent"
# -- Additional command arguments which needs to be passed
command: []
# -- Default image repository
repository: nginx
# -- Default image tag
tag: latest
# -- Image pull secrets for private repository authentication
pullSecrets: ""
# secret:
# FOO_SECRET: BAR
# config:
# FOO_CONFIG: BAR
# -- Healthcheck details for readiness and liveness probe
healthcheck:
# -- Healthcheck is enabled or not
enabled: true
# -- Healthcheck status path on status will be checked
statusPath: /
# -- Autoscaling properties with target CPU and Memory details
autoscaling:
enabled: false
targetCPUUtilizationPercentage: 65
targetMemoryUtilizationPercentage: 65
minReplicas: 10
maxReplicas: 50
# -- Service specification details with port and type
service:
port: 80
# -- Prometheus metrics to expose metrics on path with port
# metrics:
# path: /v1/metrics
# port: 8081
type: ClusterIP
# -- Kubernetes resource in terms of requests and limits
resources: {}
# -- Number of replicas for deployment, it will be overridden in case autoscaling is enabled
replicaCount: 2
# -- Kubernetes volumes definition which needs to be mounted
volumes:
# -- List of configmaps with mount path and data
# configMaps:
# - name: web
# mountPath: /test
# data:
# test.txt: |-
# Dummy text
# -- Ingress details with class, annotations and rules
ingress:
enabled: false
class: nginx
annotations:
ingress.gcp.kubernetes.io/pre-shared-cert: global-sign-opstree-com-2024
kubernetes.io/ingress.allow-http: "false"
# rules:
# - hostname: origin-sample-service.opstree.com
# path: /api/sample
# - hostname: origin-sample-service.opstree.com
# path:
# - /api
# - /api2
# - hostname: sample-service.opstree.com
# path: /api/sample
# -- Internal ingress details with class, annotations and rules
internalIngress:
enabled: false
class: nginx-internal
annotations:
kubernetes.io/ingress.allow-http: "true"
# rules:
# - hostname: origin-sample-service.opstree.in
# path: /api/sample
# - hostname: origin-sample-service.opstree.in
# path:
# - /api
# - /api2
# - hostname: sample-service.opstree.in
# path: /api/sample

26
charts/worker/Chart.yaml Normal file
View File

@ -0,0 +1,26 @@
---
apiVersion: v2
description: A deployment helm chart which will be used to deploy any type of stateless application
maintainers:
- name: iamabhishek-dubey
email: "abhishek.dubey@opstree.com"
url: https://github.com/iamabhishek-dubey
name: worker
sources:
- https://github.com/ot-container-kit/helm-charts
dependencies:
- name: base
version: 0.1.0
repository: https://ot-container-kit.github.io/helm-charts
version: 0.1.0
appVersion: "0.1.0"
home: https://github.com/ot-container-kit/helm-charts
keywords:
- deployment
- base
- opstree
- kubernetes
- openshift
- microservice
- stateless
icon: https://raw.githubusercontent.com/OT-CONTAINER-KIT/helm-charts/main/static/helm-chart-logo.svg

39
charts/worker/README.md Normal file
View File

@ -0,0 +1,39 @@
# Worker Deployment Helm Chart
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
A deployment helm chart which will be used to deploy any type of stateless application
**Homepage:** <https://github.com/ot-container-kit/helm-charts>
## Maintainers
| Name | Email | Url |
|-------------------|------------------------------|----------------------------------------|
| iamabhishek-dubey | <abhishek.dubey@opstree.com> | <https://github.com/iamabhishek-dubey> |
## Source Code
* <https://github.com/ot-container-kit/helm-charts>
## Requirements
| Repository | Name | Version |
|------------------------------------------------|------|---------|
| https://ot-container-kit.github.io/helm-charts | base | 0.1.0 |
## Values
| Key | Type | Default | Description |
|------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| autoscaling | object | `{"enabled":false,"maxReplicas":50,"minReplicas":10,"targetCPUUtilizationPercentage":65,"targetMemoryUtilizationPercentage":65}` | Autoscaling properties with target CPU and Memory details |
| base | object | `{"image":{"command":[],"pullPolicy":"IfNotPresent","pullSecrets":"","repository":"nginx","tag":"latest"}}` | Base block to define the inputs for image, secret and configmap env |
| base.image | object | `{"command":[],"pullPolicy":"IfNotPresent","pullSecrets":"","repository":"nginx","tag":"latest"}` | Image block with all image details |
| base.image.command | list | `[]` | Additional command arguments which needs to be passed |
| base.image.pullPolicy | string | `"IfNotPresent"` | Default image pull policy |
| base.image.pullSecrets | string | `""` | Image pull secrets for private repository authentication |
| base.image.repository | string | `"nginx"` | Default image repository |
| base.image.tag | string | `"latest"` | Default image tag |
| replicaCount | int | `2` | Number of replicas for deployment, it will be overridden in case autoscaling is enabled |
| resources | object | `{}` | Kubernetes resource in terms of requests and limits |
| volumes | string | `nil` | Kubernetes volumes definition which needs to be mounted |

View File

@ -0,0 +1,4 @@
{{ include "configmap" . }}
---
{{ include "serviceAccount" . }}
---

View File

@ -0,0 +1,18 @@
{{- if .Values.volumes }}
{{- if .Values.volumes.configMaps }}
{{ range $cm := .Values.volumes.configMaps}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $cm.name }}
labels:
{{- include "base.labels" $ | nindent 4 }}
data:
{{- range $filename, $content := $cm.data }}
{{ $filename }}: |-
{{ $content | toString | indent 4}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,65 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
{{- with .Values.replicaCount }}
replicas: {{ . }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "base.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "base.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.base.image.pullSecrets }}
imagePullSecrets:
- name: {{ .Values.base.image.pullSecrets }}
{{- end }}
serviceAccountName: {{ include "base.serviceAccountName" . }}
terminationGracePeriodSeconds: 120
containers:
- name: {{ include "base.fullname" . }}
image: "{{ .Values.base.image.repository }}:{{ .Values.base.image.tag }}"
imagePullPolicy: {{ .Values.base.image.pullPolicy }}
{{- if .Values.base.image.command }}
command:
{{- toYaml .Values.base.image.command | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.base.config }}
envFrom:
- configMapRef:
name: {{ include "base.fullname" . }}
{{- end }}
{{- if .Values.base.secret }}
- secretRef:
name: {{ include "base.fullname" . }}
{{- end }}
{{- if .Values.volumes }}
volumeMounts:
{{- if .Values.volumes.configMaps }}
{{- range $conf := .Values.volumes.configMaps }}
- mountPath: {{ $conf.mountPath }}
name: {{ $conf.name }}-volume
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.volumes }}
volumes:
{{- if .Values.volumes.configMaps }}
{{- range $conf := .Values.volumes.configMaps }}
- name: {{ $conf.name }}-volume
configMap:
name: {{ $conf.name }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,33 @@
{{- if .Values.autoscaling.enabled }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "base.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{- if .Values.base.secret -}}
{{- $top := . -}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "base.fullname" . }}
labels:
{{- include "base.labels" . | nindent 4 }}
stringData:
{{- toYaml .Values.base.secret | nindent 2 -}}
{{- end -}}

43
charts/worker/values.yaml Normal file
View File

@ -0,0 +1,43 @@
# -- Base block to define the inputs for image, secret and configmap env
base:
# -- Image block with all image details
image:
# -- Default image pull policy
pullPolicy: "IfNotPresent"
# -- Additional command arguments which needs to be passed
command: []
# -- Default image repository
repository: nginx
# -- Default image tag
tag: latest
# -- Image pull secrets for private repository authentication
pullSecrets: ""
# secret:
# FOO_SECRET: BAR
# config:
# FOO_CONFIG: BAR
# -- Autoscaling properties with target CPU and Memory details
autoscaling:
enabled: false
targetCPUUtilizationPercentage: 65
targetMemoryUtilizationPercentage: 65
minReplicas: 10
maxReplicas: 50
# -- Kubernetes resource in terms of requests and limits
resources: {}
# -- Number of replicas for deployment, it will be overridden in case autoscaling is enabled
replicaCount: 2
# -- Kubernetes volumes definition which needs to be mounted
volumes:
# -- List of configmaps with mount path and data
# configMaps:
# - name: web
# mountPath: /test
# data:
# test.txt: |-
# Dummy text

View File

@ -8,3 +8,4 @@ chart-repos:
excluded-charts:
- mysql
- pga
- redis-operator