Skip to content

Commit

Permalink
Create new Helm chart for Scalar Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
supl committed Apr 17, 2024
1 parent 7ef77d4 commit 2fdc5a7
Show file tree
Hide file tree
Showing 13 changed files with 575 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/scalar-manager/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
23 changes: 23 additions & 0 deletions charts/scalar-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: scalar-manager
description: Scalar Manager
type: application
version: 1.0.0-SNAPSHOT
appVersion: 1.0.0-SNAPSHOT
deprecated: false
icon: https://scalar-labs.com/wp-content/themes/scalar/assets/img/logo_scalar.svg
keywords:
- scalar-manager
- scalardb-cluster
- scalardl-ledger
- scalardl-auditor
- scalar-admin-for-kubernetes
home: https://scalar-labs.com/
sources:
- https://github.com/scalar-labs/scalar-manager-api
- https://github.com/scalar-labs/scalar-manager-web
maintainers:
- name: Takanori Yokoyama
email: [email protected]
- name: Plenty Su
email: [email protected]
50 changes: 50 additions & 0 deletions charts/scalar-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# scalar-manager

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

Scalar Manager
Current chart version is `1.0.0-SNAPSHOT`

**Homepage:** <https://scalar-labs.com/>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| api.grafanaKubernetesServiceLabelName | string | `"app.kubernetes.io/name"` | |
| api.grafanaKubernetesServiceLabelValue | string | `"grafana"` | |
| api.grafanaKubernetesServicePortName | string | `"http-web"` | |
| api.helmScalarAdminForKubernetesChartName | string | `"scalar-admin-for-kubernetes"` | |
| api.helmScalarAdminForKubernetesChartVersion | string | `"1.0.0"` | |
| api.helmScalarRepositoryName | string | `"scalar-labs"` | |
| api.helmScalarRepositoryUrl | string | `"https://scalar-labs.github.io/helm-charts"` | |
| api.image.pullPolicy | string | `"IfNotPresent"` | |
| api.image.repository | string | `"ghcr.io/scalar-labs/scalar-manager-api"` | |
| api.image.tag | string | `""` | |
| api.lokiKubernetesServiceLabelName | string | `"app"` | |
| api.lokiKubernetesServiceLabelValue | string | `"loki"` | |
| api.lokiKubernetesServicePortName | string | `"http-metrics"` | |
| api.pausedStateRetentionMaxNumber | string | `"100"` | |
| api.pausedStateRetentionStorage | string | `"configmap"` | |
| api.prometheusKubernetesServiceLabelName | string | `"app"` | |
| api.prometheusKubernetesServiceLabelValue | string | `"kube-prometheus-stack-prometheus"` | |
| api.prometheusKubernetesServicePortName | string | `"http-web"` | |
| fullnameOverride | string | `""` | |
| imagePullSecrets[0].name | string | `"reg-docker-secrets"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `80` | |
| service.type | string | `"LoadBalancer"` | |
| serviceAccount.automount | bool | `true` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| tolerations | list | `[]` | |
| web.image.pullPolicy | string | `"IfNotPresent"` | |
| web.image.repository | string | `"ghcr.io/scalar-labs/scalar-manager-web"` | |
| web.image.tag | string | `""` | |
12 changes: 12 additions & 0 deletions charts/scalar-manager/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ template "chart.header" . }}

{{ template "chart.versionBadge" . }} {{ template "chart.typeBadge" . }} {{ template "chart.appVersionBadge" . }}

{{ template "chart.description" . }}
Current chart version is `{{ template "chart.version" . }}`

**Homepage:** <https://scalar-labs.com/>

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}
62 changes: 62 additions & 0 deletions charts/scalar-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "scalar-manager.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 "scalar-manager.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 "scalar-manager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "scalar-manager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "scalar-manager.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/scalar-manager/templates/scalar-manager/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "scalar-manager.fullname" . }}
labels:
{{- include "scalar-manager.labels" . | nindent 4 }}
rules:
- apiGroups: ["", "apps", "batch", "rbac.authorization.k8s.io"]
resources: ["pods", "deployments", "services", "namespaces", "configmaps", "secrets", "cronjobs", "serviceaccounts", "roles", "rolebindings", "jobs"]
verbs: ["get", "list", "create", "patch", "delete", "update"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "scalar-manager.fullname" . }}
labels:
{{- include "scalar-manager.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "scalar-manager.fullname" . }}
namespace: {{ .Release.Namespace }}
apiGroup: ""
roleRef:
kind: ClusterRole
name: {{ include "scalar-manager.fullname" . }}
apiGroup: rbac.authorization.k8s.io
12 changes: 12 additions & 0 deletions charts/scalar-manager/templates/scalar-manager/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "scalar-manager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/app: {{ include "scalar-manager.fullname" . }}
{{- include "scalar-manager.labels" . | nindent 4 }}
data:
managed-clusters: "[]"
paused-states: "[]"
paused-states-updated-at: "0"
101 changes: 101 additions & 0 deletions charts/scalar-manager/templates/scalar-manager/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "scalar-manager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "scalar-manager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "scalar-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/scalar-manager/configmap.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
labels:
{{- include "scalar-manager.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
restartPolicy: Always
serviceAccountName: {{ include "scalar-manager.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
terminationGracePeriodSeconds: 90
containers:
- name: {{ .Chart.Name }}-api
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}"
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: 8080
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
env:
- name: GRAFANA_KUBERNETES_SERVICE_LABEL_NAME
value: {{ .Values.api.grafanaKubernetesServiceLabelName | quote }}
- name: GRAFANA_KUBERNETES_SERVICE_LABEL_VALUE
value: {{ .Values.api.grafanaKubernetesServiceLabelValue | quote }}
- name: GRAFANA_KUBERNETES_SERVICE_PORT_NAME
value: {{ .Values.api.grafanaKubernetesServicePortName | quote }}
- name: PROMETHEUS_KUBERNETES_SERVICE_LABEL_NAME
value: {{ .Values.api.prometheusKubernetesServiceLabelName | quote }}
- name: PROMETHEUS_KUBERNETES_SERVICE_LABEL_VALUE
value: {{ .Values.api.prometheusKubernetesServiceLabelValue | quote }}
- name: PROMETHEUS_KUBERNETES_SERVICE_PORT_NAME
value: {{ .Values.api.prometheusKubernetesServicePortName | quote }}
- name: LOKI_KUBERNETES_SERVICE_LABEL_NAME
value: {{ .Values.api.lokiKubernetesServiceLabelName | quote }}
- name: LOKI_KUBERNETES_SERVICE_LABEL_VALUE
value: {{ .Values.api.lokiKubernetesServiceLabelValue | quote }}
- name: LOKI_KUBERNETES_SERVICE_PORT_NAME
value: {{ .Values.api.lokiKubernetesServicePortName | quote }}
- name: HELM_SCALAR_REPOSITORY_NAME
value: {{ .Values.api.helmScalarRepositoryName | quote }}
- name: HELM_SCALAR_REPOSITORY_URL
value: {{ .Values.api.helmScalarRepositoryUrl | quote }}
- name: HELM_SCALAR_ADMIN_FOR_KUBERNETES_CHART_NAME
value: {{ .Values.api.helmScalarAdminForKubernetesChartName | quote }}
- name : HELM_SCALAR_ADMIN_FOR_KUBERNETES_CHART_VERSION
value: {{ .Values.api.helmScalarAdminForKubernetesChartVersion | quote }}
- name: CONFIG_MAP_LABEL_NAME
value: "app.kubernetes.io/app"
- name: CONFIG_MAP_LABEL_VALUE
value: {{ include "scalar-manager.fullname" . | quote }}
- name: PAUSED_STATE_RETENTION_STORAGE
value: {{ .Values.api.pausedStateRetentionStorage | quote }}
- name: PAUSED_STATE_RETENTION_MAX_NUMBER
value: {{ .Values.api.pausedStateRetentionMaxNumber | quote }}
- name: {{ .Chart.Name }}-web
image: "{{ .Values.web.image.repository }}:{{ .Values.web.image.tag | default .Chart.AppVersion }}"
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: 3000
imagePullPolicy: {{ .Values.web.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/scalar-manager/templates/scalar-manager/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "scalar-manager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "scalar-manager.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- protocol: TCP
name: web
port: {{ .Values.service.port }}
targetPort: 3000
selector:
{{- include "scalar-manager.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "scalar-manager.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "scalar-manager.labels" . | nindent 4 }}
Loading

0 comments on commit 2fdc5a7

Please sign in to comment.