Skip to content

Commit

Permalink
feat(charts): [kubernetes-manifests] add the first version
Browse files Browse the repository at this point in the history
  • Loading branch information
apetrovYa committed Jan 23, 2025
1 parent c7740a8 commit 1e61cd3
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 0 deletions.
61 changes: 61 additions & 0 deletions charts/kubernetes-manifests/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Remove release files
release.json
# Remove ignore files
.gitignore
.helmignore

# Remove all shell scripts
*.sh

# Remove all resulting packages
./*.tgz
./.
./..
.cache
# Just in case if someone forgets to remove their local.properties file
*.properties

# Internal cluster values
values/

# Rendered templates
rendered/

# Got it from the Internet
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
.helm-docs
.helm_output
*.md
.env
Makefile
*.lock
examples/
unittests/
tests/
values.schema.json
schema.values.json
# Docs related
#README.md
LICENSE

ct.yaml
16 changes: 16 additions & 0 deletions charts/kubernetes-manifests/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: kubernetes-manifests
description: A Generic Helm chart for packaging Kubernetes manifests
type: application
version: 1.0.0
appVersion: 1.0.0
icon: https://avatars.githubusercontent.com/u/878437?s=200&v=4
home: https://jetbrains.com/
annotations:
category: Infrastructure
keywords:
- jetbrains
- template
maintainers:
- name: JetBrains
url: https://www.jetbrains.com/support
3 changes: 3 additions & 0 deletions charts/kubernetes-manifests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include ../../lib/Makefiles/Helm.mk


48 changes: 48 additions & 0 deletions charts/kubernetes-manifests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Kubernetes Manifests

`kubernetes-manifests` is a generic Helm chart to use for the packaging of ad-hoc Kubernetes manifests in one bundle.

## Use Cases

Use this chart to package Kubernetes manifests that are not part of a Helm chart during a Helm to deploy in Kubernetes,
and the main application chart does not include a parameter in the values.yaml for passing custom Kubernetes manifests.

## How to use this chart

This chart is formatted as an OCI package. Include it as a dependency from `https://public.jetbrains.space/p/helm/packages/container/library`.

Add it to your Chart.yaml file of your Helm package.

```yaml
dependencies:
- name: kubernetes-manifests
repository: oci://public.registry.jetbrains.space/p/helm/library
version: 1.x.x
alias: app
```
## Repository
Checkout the [release.json](release.json) for details about where the chart is hosted.
## Prerequisites
- Kubernetes 1.24+;
- Helm 3+.
## Parameters
### Global parameters
| Name | Description | Value |
| --------- | ----------------------------------------------------------- | ------ |
| `global` | Provide a map of global values to be used in the templates | `{}` |
| `include` | Includes/Excludes the manifests packaged by this Helm chart | `true` |

### Manifests to package

| Name | Description | Value |
| ----------------------------------- | ------------------------------------------------------- | ----- |
| `kubernetesYamlResources` | Kubernetes objects to add to the package | `[]` |
| `additionalKubernetesYamlResources` | Add additional Kubernetes objects to add to the package | `[]` |
19 changes: 19 additions & 0 deletions charts/kubernetes-manifests/release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"metadata": {
"name": "kubernetes-manifests",
"description": "Find more details about this chart in its Chart.yaml file."
},
"spec": {
"repositories": [
{
"name": "helm-library",
"description": "Repository for Kubernetes charts",
"url": "public.registry.jetbrains.space/p/helm/library",
"type": "oci",
"env": {
"nameSelector": "HELM_CHARTS_REGISTRY"
}
}
]
}
}
4 changes: 4 additions & 0 deletions charts/kubernetes-manifests/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kubernetes-manifests
====================
Chart Version: {{ .Chart.Version }}
Support contact: it is outlined in the Chart.yaml file
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if .Values.include -}}
{{- $kubernetesResources := concat .Values.kubernetesYamlResources .Values.additionalKubernetesYamlResources -}}
{{- if $kubernetesResources -}}
apiVersion: v1
kind: List
items:
{{- tpl ($kubernetesResources | toYaml) $ | nindent 4 }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
suite: app kubernetes resources
templates:
- kubernetesresources/manifest.yaml
tests:
- it: should not be created by default
asserts:
- hasDocuments:
count: 0
- it: should not be generated when include is set to false
set:
include: false
kubernetesYamlResources:
- apiVersion: v1
kind: Nameapp
metadata:
name: kong
labels:
app: kong
asserts:
- hasDocuments:
count: 0
- it: should allow to compose a set of custom YAML objects
set:
kubernetesYamlResources:
- apiVersion: v1
kind: Nameapp
metadata:
name: kong
labels:
app: kong
- apiVersion: v1
kind: ServiceAccount
metadata:
nameapp: kong
name: kong
labels:
app: kong
additionalKubernetesYamlResources:
- apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: kong-apigateway-weu-dev-ha
nameapp: kong
labels:
app: kong
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: kong-apigateway-weu-dev
minReplicas: 1
maxReplicas: 7
targetCPUUtilizationPercentage: 71
asserts:
- equal:
path: items
value:
- apiVersion: v1
kind: Nameapp
metadata:
labels:
app: kong
name: kong
- apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: kong
name: kong
nameapp: kong
- apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
labels:
app: kong
name: kong-apigateway-weu-dev-ha
nameapp: kong
spec:
maxReplicas: 7
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: kong-apigateway-weu-dev
targetCPUUtilizationPercentage: 71
28 changes: 28 additions & 0 deletions charts/kubernetes-manifests/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Chart Values",
"type": "object",
"properties": {
"global": {
"type": "object",
"description": "Provide a map of global values to be used in the templates",
"default": {}
},
"include": {
"type": "boolean",
"description": "Includes/Excludes the manifests packaged by this Helm chart",
"default": true
},
"kubernetesYamlResources": {
"type": "array",
"description": "Kubernetes objects to add to the package",
"default": [],
"items": {}
},
"additionalKubernetesYamlResources": {
"type": "array",
"description": "Add additional Kubernetes objects to add to the package",
"default": [],
"items": {}
}
}
}
46 changes: 46 additions & 0 deletions charts/kubernetes-manifests/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
##
## This is a YAML-formatted file.
##

## @section Global parameters
##
## @param global Provide a map of global values to be used in the templates
global: {}


## @param include Includes/Excludes the manifests packaged by this Helm chart
##
include: true
## @section Manifests to package
##
## @param kubernetesYamlResources Kubernetes objects to add to the package
##
## Example:
## - apiVersion: v1
## kind: ServiceAccount
## metadata:
## namespace: '{{ .Release.namespace }}'
## name: '{{ include "lib.appName" . }}'-newsa
## labels:
## app.kubernetes.io/component: '{{ include "lib.componentName" . }}'
## '{{- include "lib.labels" . | nindent 4 }}'
##
kubernetesYamlResources: []
## @param additionalKubernetesYamlResources Add additional Kubernetes objects to add to the package
##
## Example:
## - apiVersion: v1
## kind: ResourceQuota
## metadata:
## name: '{{ include "lib.appName" $ }}'
## namespace: '{{ include "lib.namespace" $ }}'
## labels:
## app.kubernetes.io/component: '{{ include "lib.componentName" $ }}'
## spec:
## hard:
## requests.cpu: "4"
## requests.memory: 4Gi
## limits.cpu: "4"
## limits.memory: 4Gi
##
additionalKubernetesYamlResources: []

0 comments on commit 1e61cd3

Please sign in to comment.