-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new chart for Scalar Admin for Kubernetes (#246)
- Loading branch information
1 parent
4f0eb08
commit 1c49df4
Showing
19 changed files
with
637 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: scalar-admin-for-kubernetes | ||
description: Scalar Admin for Kubernetes | ||
type: application | ||
version: 1.0.0-SNAPSHOT | ||
appVersion: 1.2.0 | ||
deprecated: false | ||
icon: https://scalar-labs.com/wp-content/themes/scalar/assets/img/logo_scalar.svg | ||
keywords: | ||
- scalardb | ||
- scalardb-cluster | ||
- scalardl-ledger | ||
- scalardl-auditor | ||
- scalar-admin-for-kubernetes | ||
home: https://scalar-labs.com/ | ||
sources: | ||
- https://github.com/scalar-labs/scalar-admin-for-kubernetes | ||
maintainers: | ||
- name: Takanori Yokoyama | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# scalar-admin-for-kubernetes | ||
|
||
Scalar Admin for Kubernetes | ||
Current chart version is `1.0.0-SNAPSHOT`. | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| fullnameOverride | string | `""` | String to fully override scalar-admin-for-kubernetes.fullname template. | | ||
| nameOverride | string | `""` | String to partially override scalar-admin-for-kubernetes.fullname template (will maintain the release name). | | ||
| scalarAdminForKubernetes.affinity | object | `{}` | The affinity/anti-affinity feature greatly expands the types of constraints you can express. | | ||
| scalarAdminForKubernetes.commandArgs | list | `[]` | Arguments of Scalar Admin for Kubernetes. You can specify several args as an array. | | ||
| scalarAdminForKubernetes.cronJob.schedule | string | `"0 0 * * *"` | Schedule for a CronJob. | | ||
| scalarAdminForKubernetes.cronJob.timeZone | string | `"Etc/UTC"` | A time zone for a CronJob. | | ||
| scalarAdminForKubernetes.image.pullPolicy | string | `"IfNotPresent"` | Specify an image-pulling policy. | | ||
| scalarAdminForKubernetes.image.repository | string | `"ghcr.io/scalar-labs/scalar-admin-for-kubernetes"` | Docker image repository of Scalar Admin for Kubernetes. | | ||
| scalarAdminForKubernetes.image.tag | string | `""` | Override the image tag with a default that is the chart appVersion. | | ||
| scalarAdminForKubernetes.imagePullSecrets | list | `[{"name":"reg-docker-secrets"}]` | Optionally specify an array of imagePullSecrets. Secrets must be manually created in the namespace. | | ||
| scalarAdminForKubernetes.jobType | string | `"job"` | Resource which you deploy. Specify "job" or "cronjob". By default deploy scalar-admin-for-kubernetes as a Job resource. If you specify "cronjob", you can create a CronJob resource instead of a Job. | | ||
| scalarAdminForKubernetes.nodeSelector | object | `{}` | nodeSelector is a form of node selection constraint. | | ||
| scalarAdminForKubernetes.podAnnotations | object | `{}` | Pod annotations for the scalar-admin-for-kubernetes pod. | | ||
| scalarAdminForKubernetes.podSecurityContext | object | `{"seccompProfile":{"type":"RuntimeDefault"}}` | PodSecurityContext holds pod-level security attributes and common container settings. | | ||
| scalarAdminForKubernetes.resources | object | `{}` | Resources allowed to the pod. | | ||
| scalarAdminForKubernetes.securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"runAsNonRoot":true}` | Setting security context at the pod applies those settings to all containers in the pod. | | ||
| scalarAdminForKubernetes.securityContext.allowPrivilegeEscalation | bool | `false` | AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. | | ||
| scalarAdminForKubernetes.securityContext.capabilities | object | `{"drop":["ALL"]}` | Capabilities (specifically, Linux capabilities), are used for permission management in Linux. Some capabilities are enabled by default. | | ||
| scalarAdminForKubernetes.securityContext.runAsNonRoot | bool | `true` | Containers should be run as a non-root user with the minimum required permissions (principle of least privilege). | | ||
| scalarAdminForKubernetes.serviceAccount.automountServiceAccountToken | bool | `true` | Specify whether to mount a service account token or not. | | ||
| scalarAdminForKubernetes.serviceAccount.serviceAccountName | string | `""` | Name of the existing service account resource. | | ||
| scalarAdminForKubernetes.tolerations | list | `[]` | Tolerations are applied to pods and allow (but do not require) the pods to schedule onto nodes with matching taints. | | ||
| scalarAdminForKubernetes.ttlSecondsAfterFinished | int | `0` | ttlSecondsAfterFinished value for the job resource. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ template "chart.header" . }} | ||
|
||
{{ template "chart.description" . }} | ||
Current chart version is `{{ template "chart.version" . }}`. | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
{{ template "chart.valuesSection" . }} |
13 changes: 13 additions & 0 deletions
13
charts/scalar-admin-for-kubernetes/ci/scalar-admin-for-kubernetes-ct-values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
scalarAdminForKubernetes: | ||
|
||
commandArgs: | ||
- -r | ||
- scalardb-cluster-for-scalar-admin-for-kubernetes | ||
- -n | ||
- default | ||
- -d | ||
- "1000" | ||
- -z | ||
- "Etc/UTC" | ||
- -w | ||
- "1000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CHART NAME: {{ .Chart.Name }} | ||
CHART VERSION: {{ .Chart.Version }} | ||
APP VERSION: {{ .Chart.AppVersion }} | ||
RELEASE NAME: {{ .Release.Name }} | ||
{{ if eq .Values.scalarAdminForKubernetes.jobType "job" }} | ||
The Job resource {{ include "scalar-admin-for-kubernetes.fullname" . }} that runs Scalar Admin for Kubernetes is created. | ||
{{ else if eq .Values.scalarAdminForKubernetes.jobType "cronjob" }} | ||
The CronJob resource {{ include "scalar-admin-for-kubernetes.fullname" . }} that runs Scalar Admin for Kubernetes periodically is created. | ||
|
||
If you want to test the Job definition that will created by this CronJob, you can run the actual Job by running the following command: | ||
|
||
kubectl create job "{{ .Release.Name }}-test-$(date +%s)" --from cronjob/{{ include "scalar-admin-for-kubernetes.fullname" . }} -n {{ .Release.Namespace }} | ||
|
||
NOTE: This command creates an actual Job and runs the Scalar Admin for Kubernetes. It pauses your ScalarDB or ScalarDL. In other words, it pauses transactions in your system. | ||
{{ end }} | ||
You can see the "pause duration" as a command result that is output into the stdout of a container by running the following command: | ||
|
||
kubectl logs -l app.kubernetes.io/app=scalar-admin-for-kubernetes,app.kubernetes.io/instance={{ .Release.Name }} -n {{ .Release.Namespace }} |
116 changes: 116 additions & 0 deletions
116
charts/scalar-admin-for-kubernetes/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "scalar-admin-for-kubernetes.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-admin-for-kubernetes.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-admin-for-kubernetes.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "scalar-admin-for-kubernetes.labels" -}} | ||
helm.sh/chart: {{ include "scalar-admin-for-kubernetes.chart" . }} | ||
{{ include "scalar-admin-for-kubernetes.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "scalar-admin-for-kubernetes.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "scalar-admin-for-kubernetes.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/app: scalar-admin-for-kubernetes | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use. | ||
*/}} | ||
{{- define "scalar-admin-for-kubernetes.serviceAccountName" -}} | ||
{{- if .Values.scalarAdminForKubernetes.serviceAccount.serviceAccountName }} | ||
{{- .Values.scalarAdminForKubernetes.serviceAccount.serviceAccountName }} | ||
{{- else }} | ||
{{- print (include "scalar-admin-for-kubernetes.fullname" .) "-sa" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Job template for "Job" and "CronJob" resources | ||
*/}} | ||
{{- define "job-spec" -}} | ||
backoffLimit: 0 | ||
{{- if .Values.scalarAdminForKubernetes.ttlSecondsAfterFinished }} | ||
ttlSecondsAfterFinished: {{ .Values.scalarAdminForKubernetes.ttlSecondsAfterFinished }} | ||
{{- end }} | ||
template: | ||
metadata: | ||
{{- if .Values.scalarAdminForKubernetes.podAnnotations }} | ||
annotations: | ||
{{- toYaml .Values.scalarAdminForKubernetes.podAnnotations | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "scalar-admin-for-kubernetes.selectorLabels" . | nindent 8 }} | ||
spec: | ||
restartPolicy: Never | ||
serviceAccountName: {{ include "scalar-admin-for-kubernetes.serviceAccountName" . }} | ||
automountServiceAccountToken: {{ .Values.scalarAdminForKubernetes.serviceAccount.automountServiceAccountToken }} | ||
{{- with .Values.scalarAdminForKubernetes.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml .Values.scalarAdminForKubernetes.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.scalarAdminForKubernetes.securityContext | nindent 12 }} | ||
image: "{{ .Values.scalarAdminForKubernetes.image.repository }}:{{ .Values.scalarAdminForKubernetes.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.scalarAdminForKubernetes.image.pullPolicy }} | ||
resources: | ||
{{- toYaml .Values.scalarAdminForKubernetes.resources | nindent 12 }} | ||
args: | ||
{{- range .Values.scalarAdminForKubernetes.commandArgs }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
{{- with .Values.scalarAdminForKubernetes.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.scalarAdminForKubernetes.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.scalarAdminForKubernetes.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
15 changes: 15 additions & 0 deletions
15
charts/scalar-admin-for-kubernetes/templates/scalar-admin-for-kubernetes/cronjob.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if eq .Values.scalarAdminForKubernetes.jobType "cronjob" }} | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ include "scalar-admin-for-kubernetes.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "scalar-admin-for-kubernetes.labels" . | nindent 4 }} | ||
spec: | ||
timeZone: "{{ .Values.scalarAdminForKubernetes.cronJob.timeZone }}" | ||
schedule: "{{ .Values.scalarAdminForKubernetes.cronJob.schedule }}" | ||
jobTemplate: | ||
spec: | ||
{{- include "job-spec" . | nindent 6 }} | ||
{{- end }} |
11 changes: 11 additions & 0 deletions
11
charts/scalar-admin-for-kubernetes/templates/scalar-admin-for-kubernetes/job.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if eq .Values.scalarAdminForKubernetes.jobType "job" }} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "scalar-admin-for-kubernetes.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "scalar-admin-for-kubernetes.labels" . | nindent 4 }} | ||
spec: | ||
{{- include "job-spec" . | nindent 2 }} | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
charts/scalar-admin-for-kubernetes/templates/scalar-admin-for-kubernetes/role.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ include "scalar-admin-for-kubernetes.fullname" . }}-role | ||
namespace: {{ .Release.Namespace }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods", "services"] | ||
verbs: ["get", "list"] | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
verbs: ["get", "list"] |
12 changes: 12 additions & 0 deletions
12
charts/scalar-admin-for-kubernetes/templates/scalar-admin-for-kubernetes/rolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ include "scalar-admin-for-kubernetes.fullname" . }}-rolebinding | ||
namespace: {{ .Release.Namespace }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "scalar-admin-for-kubernetes.serviceAccountName" . }} | ||
roleRef: | ||
kind: Role | ||
name: {{ include "scalar-admin-for-kubernetes.fullname" . }}-role | ||
apiGroup: rbac.authorization.k8s.io |
9 changes: 9 additions & 0 deletions
9
charts/scalar-admin-for-kubernetes/templates/scalar-admin-for-kubernetes/serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{- if not .Values.scalarAdminForKubernetes.serviceAccount.serviceAccountName }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "scalar-admin-for-kubernetes.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "scalar-admin-for-kubernetes.labels" . | nindent 4 }} | ||
{{- end }} |
Oops, something went wrong.