Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vasiliy-t committed Oct 6, 2020
1 parent 0350f92 commit 8a69000
Show file tree
Hide file tree
Showing 25 changed files with 249 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package = 'crud'
package = 'crud-storage'
version = 'scm-1'
source = {
url = '/dev/null',
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions crud-storage/helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Tarantool CRUD
name: crud-storage
version: 0.0.1
45 changes: 45 additions & 0 deletions crud-storage/helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "tarantool.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 "tarantool.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 "tarantool.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "tarantool.labels" -}}
app.kubernetes.io/name: {{ include "tarantool.name" . }}
helm.sh/chart: {{ include "tarantool.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
149 changes: 149 additions & 0 deletions crud-storage/helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
apiVersion: tarantool.io/v1alpha1
kind: Cluster
metadata:
name: {{ .Values.ClusterName }}
namespace: {{ .Values.namespace }}
spec:
selector:
matchLabels:
tarantool.io/cluster-id: {{ .Values.ClusterName }}
---
{{- range .Values.RoleConfig }}
{{- $r := .RolesToAssign | toJson | quote }}
apiVersion: tarantool.io/v1alpha1
kind: Role
metadata:
name: {{ .RoleName | replace "_" "" }}
namespace: {{ $.Values.namespace }}
labels:
tarantool.io/cluster-id: {{ $.Values.ClusterName }}
tarantool.io/role: {{ .RoleName }}
annotations:
tarantool.io/rolesToAssign: {{ $r }}
spec:
selector:
matchLabels:
tarantool.io/replicaset-template: "{{ .RoleName }}-template"
numReplicasets: {{ .ReplicaSetCount }}
---
apiVersion: tarantool.io/v1alpha1
kind: ReplicasetTemplate
metadata:
name: "{{ .RoleName | replace "_" "" }}-template"
namespace: {{ $.Values.namespace }}
labels:
tarantool.io/cluster-id: {{ $.Values.ClusterName }}
tarantool.io/replicaset-template: "{{ .RoleName }}-template"
tarantool.io/role: {{ .RoleName }}
tarantool.io/useVshardGroups: "0"
annotations:
tarantool.io/rolesToAssign: {{ $r }}
spec:
replicas: {{ .ReplicaCount }}
serviceName: {{ .RoleName }}
selector:
matchLabels:
tarantool.io/pod-template: "{{ .RoleName }}-pod-template"
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: {{ .DiskSize }}
template:
metadata:
labels:
tarantool.io/cluster-id: {{ $.Values.ClusterName }}
tarantool.io/pod-template: "{{ .RoleName }}-pod-template"
tarantool.io/useVshardGroups: "0"
environment: "{{ $.Values.ClusterEnv }}"
annotations:
tarantool.io/rolesToAssign: {{ $r }}
prometheus.io/path: "{{ $.Values.Prometheus.path }}"
prometheus.io/port: "{{ $.Values.Prometheus.port}}"
prometheus.io/scrape: "true"
spec:
terminationGracePeriodSeconds: 10
dnsConfig:
options:
- name: ndots
value: "1"
updateStrategy:
type: OnDelete
securityContext:
fsGroup: 1000
capabilities:
add: ["SYS_ADMIN"]
containers:
- name: pim-storage
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
volumeMounts:
- name: www
mountPath: "/data"
resources:
requests:
cpu: "{{ .CPUallocation }}"
memory: "{{ .MemtxMemoryMB }}M"
limits:
cpu: "{{ .CPUallocation }}"
memory: "{{ .MemtxMemoryMB }}M"
ports:
- containerPort: 3301
protocol: TCP
name: app
- containerPort: 3301
protocol: UDP
name: app-udp
- containerPort: 8081
protocol: TCP
name: http
env:
- name: ENVIRONMENT
value: "{{ $.Values.ClusterEnv }}"
- name: TARANTOOL_INSTANCE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: TARANTOOL_MEMTX_MEMORY
value: "{{ mul .MemtxMemoryMB 1048576 }}"
- name: TARANTOOL_BUCKET_COUNT
value: "30000"
- name: TARANTOOL_ADVERTISE_TMP
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: TARANTOOL_ADVERTISE_HOST
value: "$(TARANTOOL_ADVERTISE_TMP).{{ $.Values.ClusterName }}.{{ $.Values.namespace }}.svc.cluster.local"
- name: TARANTOOL_ADVERTISE_URI
value: "$(TARANTOOL_ADVERTISE_HOST):3301"
- name: TARANTOOL_PROBE_URI_TIMEOUT
value: "60"
- name: TARANTOOL_HTTP_PORT
value: "8081"
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 15
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: {{ .RoleName }}
namespace: {{ $.Values.namespace }}
labels:
tarantool.io/role: {{ .RoleName }}
spec:
ports:
- port: 8081
name: web
protocol: TCP
- port: 3301
name: app
protocol: TCP
selector:
tarantool.io/role: {{ .RoleName }}
---
{{- end }}
18 changes: 18 additions & 0 deletions crud-storage/helm-chart/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
{{- range .Values.RoleConfig }}
apiVersion: v1
kind: Pod
metadata:
name: "{{.RoleName}}-test-connection"
annotations:
helm.sh/hook: test-success
helm.sh/hook-delete-policy: hook-succeeded
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ["{{.RoleName}}:{{ $.Values.service.port }}"]
restartPolicy: Never
---
{{- end }}
31 changes: 31 additions & 0 deletions crud-storage/helm-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Declare variables to be passed into your templates.

ClusterEnv: dev
ClusterName: tarantool-crud

namespace: tarantool

image:
repository: vasiliyt/tarantool-crud
tag: 0.0.2
pullPolicy: IfNotPresent

service:
type: ClusterIP
port: 8081

Prometheus:
port: 8081
path: /metrics

RoleConfig:
- RoleName: storage
ReplicaCount: 1
ReplicaSetCount: 3
DiskSize: 1Gi
CPUallocation: 0.25
MemtxMemoryMB: 256
RolesToAssign:
- crud-storage
- vshard-router
- metrics
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8a69000

Please sign in to comment.