diff --git a/.gitea/workflows/build-chart-excalidraw.yml b/.gitea/workflows/build-chart-excalidraw.yml new file mode 100644 index 0000000..8866c2c --- /dev/null +++ b/.gitea/workflows/build-chart-excalidraw.yml @@ -0,0 +1,42 @@ +name: "Build Helm Chart" +on: + push: + branches: + - main + paths: + - "charts/excalidraw/Chart.yaml" + +jobs: + helm-package: + runs-on: ubuntu-latest + env: + APP: charts/excalidraw + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set Helm Chart App Name and Version + id: get_version + run: | + APP_NAME=$(grep -oP '(?<=^name: ).*' ${{ env.APP }}/Chart.yaml) + echo "Helm Chart App Name: $APP_NAME" + echo "::set-output name=app::$APP_NAME" + + CHART_VERSION=$(grep -oP '(?<=^version: ).*' ${{ env.APP }}/Chart.yaml) + echo "Helm Chart version: $CHART_VERSION" + echo "::set-output name=tag::$CHART_VERSION" + + - name: Setup Helm + run: | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + helm version + + - name: Package Helm Chart + run: | + helm dependency update ${{ env.APP }} + helm lint ${{ env.APP }} + helm package ${{ env.APP }} + + - name: Upload Helm Package to repo + run: | + curl --user ${{ secrets.USER }}:${{ secrets.TOKEN }} -X POST --upload-file ./${{ steps.get_version.outputs.app }}-${{ steps.get_version.outputs.tag }}.tgz ${{ vars.HELMREGISTRY }}/api/packages/${{ vars.OWNER }}/helm/api/charts diff --git a/charts/excalidraw/.helmignore b/charts/excalidraw/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/excalidraw/.helmignore @@ -0,0 +1,23 @@ +# 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/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/excalidraw/Chart.yaml b/charts/excalidraw/Chart.yaml new file mode 100644 index 0000000..4860610 --- /dev/null +++ b/charts/excalidraw/Chart.yaml @@ -0,0 +1,17 @@ +name: excalidraw +maintainers: + - name: kubitodev + url: https://kubito.dev +apiVersion: v2 +appVersion: 0.17.6 +version: 1.0.0 +description: Kubito Excalidraw Helm Chart +home: https://github.com/kubitodev/helm/tree/main/charts/excalidraw +icon: https://kubito.dev/images/kubito.svg +keywords: + - kubernetes + - excalidraw + - diagrams + - design +sources: + - https://github.com/excalidraw/excalidraw diff --git a/charts/excalidraw/README.md b/charts/excalidraw/README.md new file mode 100644 index 0000000..810db43 --- /dev/null +++ b/charts/excalidraw/README.md @@ -0,0 +1,113 @@ +# Excalidraw + +Virtual whiteboard for sketching hand-drawn like diagrams. + +## TL;DR + +```console +helm repo add kubitodev https://charts.kubito.dev +helm install excalidraw kubitodev/excalidraw +``` + +## Introduction + +An open source virtual hand-drawn style whiteboard. Collaborative and end-to-end encrypted. + +## Prerequisites + +- Kubernetes 1.12+ +- Helm 3.2.0+ + +## Installing the Chart + +To install the chart with the release name `excalidraw`: + +```console +helm install excalidraw kubitodev/excalidraw +``` + +The command deploys excalidraw on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `excalidraw` deployment: + +```console +helm delete excalidraw +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Parameters + +### Excalidraw parameters + +| Name | Description | Value | +| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| `replicaCount` | The number of replicas to deploy. | `1` | +| `image.repository` | The Docker repository to pull the image from. For `arm64` platforms, use `peek1e/excalidraw-arm64` until they add support. | `excalidraw/excalidraw` | +| `image.tag` | The image tag to use. | `latest` | +| `image.pullPolicy` | The logic of image pulling. | `IfNotPresent` | +| `imagePullSecrets` | The image pull secrets to use. | `[]` | +| `deployment.strategy.type` | The deployment strategy to use. | `Recreate` | +| `serviceAccount.create` | Whether to create a service account. | `true` | +| `serviceAccount.annotations` | Additional 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 new service account will be created with a generated name. | `""` | +| `podAnnotations` | Additional annotations to add to the pod. | `{}` | +| `podSecurityContext` | The security context to use for the pod. | `{}` | +| `securityContext` | The security context to use for the container. | `{}` | +| `initContainers` | Additional init containers to add to the pod. | `[]` | +| `service.type` | The type of service to create. | `ClusterIP` | +| `service.port` | The port on which the service will run. | `8080` | +| `service.nodePort` | The nodePort to use for the service. Only used if service.type is NodePort. | `""` | +| `ingress.enabled` | Whether to create an ingress for the service. | `false` | +| `ingress.className` | The ingress class name to use. | `""` | +| `ingress.annotations` | Additional annotations to add to the ingress. | `{}` | +| `ingress.hosts[0].host` | The host to use for the ingress. | `chart-example.local` | +| `ingress.hosts[0].paths[0].path` | The path to use for the ingress. | `/` | +| `ingress.hosts[0].paths[0].pathType` | The path type to use for the ingress. | `ImplementationSpecific` | +| `ingress.tls` | The TLS configuration for the ingress. | `[]` | +| `resources` | The resources to use for the pod. | `{}` | +| `autoscaling.enabled` | Whether to enable autoscaling. | `false` | +| `autoscaling.minReplicas` | The minimum number of replicas to scale to. | `1` | +| `autoscaling.maxReplicas` | The maximum number of replicas to scale to. | `100` | +| `autoscaling.targetCPUUtilizationPercentage` | The target CPU utilization percentage to use for autoscaling. | `80` | +| `autoscaling.targetMemoryUtilizationPercentage` | The target memory utilization percentage to use for autoscaling. | `80` | +| `nodeSelector` | The node selector to use for the pod. | `{}` | +| `tolerations` | The tolerations to use for the pod. | `[]` | +| `affinity` | The affinity to use for the pod. | `{}` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +helm install example \ + --set user=example \ + --set password=example \ + kubitodev/example +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +helm install example -f values.yaml kubitodev/example +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## License + +Copyright © 2024 Kubito + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/charts/excalidraw/templates/deployment.yaml b/charts/excalidraw/templates/deployment.yaml new file mode 100644 index 0000000..fae0b97 --- /dev/null +++ b/charts/excalidraw/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: excalidraw + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + {{- .Values.deployment.strategy | toYaml | nindent 4 }} + selector: + matchLabels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ .Values.serviceAccount.name | default "excalidraw" }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.initContainers }} + initContainers: + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port | default 80 }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/excalidraw/templates/hpa.yaml b/charts/excalidraw/templates/hpa.yaml new file mode 100644 index 0000000..ff03f33 --- /dev/null +++ b/charts/excalidraw/templates/hpa.yaml @@ -0,0 +1,31 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: excalidraw + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: excalidraw + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/excalidraw/templates/ingress.yaml b/charts/excalidraw/templates/ingress.yaml new file mode 100644 index 0000000..59f7bc1 --- /dev/null +++ b/charts/excalidraw/templates/ingress.yaml @@ -0,0 +1,64 @@ +{{- if .Values.ingress.enabled }} +{{- $fullName := "excalidraw" -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/excalidraw/templates/service.yaml b/charts/excalidraw/templates/service.yaml new file mode 100644 index 0000000..1b44bfd --- /dev/null +++ b/charts/excalidraw/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: excalidraw + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} +spec: + type: {{ .Values.service.type | default "ClusterIP" }} + ports: + - port: {{ .Values.service.port | default 8080 }} + targetPort: http + protocol: TCP + name: http +{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} + nodePort: {{.Values.service.nodePort}} +{{ end }} + selector: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/excalidraw/templates/serviceaccount.yaml b/charts/excalidraw/templates/serviceaccount.yaml new file mode 100644 index 0000000..56fe95b --- /dev/null +++ b/charts/excalidraw/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: excalidraw + labels: + app.kubernetes.io/name: excalidraw + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/excalidraw/values.yaml b/charts/excalidraw/values.yaml new file mode 100644 index 0000000..04d24b1 --- /dev/null +++ b/charts/excalidraw/values.yaml @@ -0,0 +1,113 @@ +## @section Excalidraw parameters + +## @param replicaCount The number of replicas to deploy. +## @param image.repository The Docker repository to pull the image from. For `arm64` platforms, use `peek1e/excalidraw-arm64` until they add support. +## @param image.tag The image tag to use. +## @param image.pullPolicy The logic of image pulling. +## @param imagePullSecrets The image pull secrets to use. +## @param deployment.strategy.type The deployment strategy to use. +## @param serviceAccount.create Whether to create a service account. +## @param serviceAccount.annotations Additional annotations to add to the service account. +## @param serviceAccount.name The name of the service account to use. If not set and create is true, a new service account will be created with a generated name. +## @param podAnnotations Additional annotations to add to the pod. +## @param podSecurityContext The security context to use for the pod. +## @param securityContext The security context to use for the container. +## @param initContainers Additional init containers to add to the pod. +## @param service.type The type of service to create. +## @param service.port The port on which the service will run. +## @param service.nodePort The nodePort to use for the service. Only used if service.type is NodePort. +## @param ingress.enabled Whether to create an ingress for the service. +## @param ingress.className The ingress class name to use. +## @param ingress.annotations Additional annotations to add to the ingress. +## @param ingress.hosts[0].host The host to use for the ingress. +## @param ingress.hosts[0].paths[0].path The path to use for the ingress. +## @param ingress.hosts[0].paths[0].pathType The path type to use for the ingress. +## @param ingress.tls The TLS configuration for the ingress. +## @param resources The resources to use for the pod. +## @param autoscaling.enabled Whether to enable autoscaling. +## @param autoscaling.minReplicas The minimum number of replicas to scale to. +## @param autoscaling.maxReplicas The maximum number of replicas to scale to. +## @param autoscaling.targetCPUUtilizationPercentage The target CPU utilization percentage to use for autoscaling. +## @param autoscaling.targetMemoryUtilizationPercentage The target memory utilization percentage to use for autoscaling. +## @param nodeSelector The node selector to use for the pod. +## @param tolerations The tolerations to use for the pod. +## @param affinity The affinity to use for the pod. +## +replicaCount: 1 + +image: + repository: excalidraw/excalidraw + pullPolicy: IfNotPresent + tag: "latest" + +imagePullSecrets: [] + +deployment: + strategy: + type: Recreate + +serviceAccount: + create: true + annotations: {} + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# -- Init Containers +initContainers: [] + # - name: init-container + # image: busybox + # command: ['sh', '-c', 'echo "this is an init container"'] + +service: + type: ClusterIP + port: 8080 + nodePort: "" + +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: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}