Skip to content

Commit

Permalink
Merge pull request #3 from stefanaz/vibspecdb-chart
Browse files Browse the repository at this point in the history
Adding vibspecdb helm chart.
  • Loading branch information
NishaSharma14 authored Jan 24, 2022
2 parents 3b4fd8e + aedcd78 commit 6f964d7
Show file tree
Hide file tree
Showing 24 changed files with 684 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/ct-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ chart-dirs:
- charts/
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
- meilisearch=https://meilisearch.github.io/meilisearch-kubernetes
check-version-increment: true
debug: true
remote: origin
target-branch: main
validate-chart-schema: true
validate-maintainers: true
validate-maintainers: false
validate-yaml: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
values-dev.yaml
values-prod.yaml
nmrxiv-app*.tgz
nmrxiv-app*.tgz
vibspecdb*.tgz
24 changes: 24 additions & 0 deletions charts/vibspecdb/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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/
vibspecdb*.tgz
15 changes: 15 additions & 0 deletions charts/vibspecdb/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.13.11
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 15.6.3
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 8.24.12
- name: meilisearch
repository: https://meilisearch.github.io/meilisearch-kubernetes
version: 0.1.22
digest: sha256:9db237d706687d61b988168ade3b46ff4527fe9e93ecdc83e18b125d918a3375
generated: "2021-12-22T14:39:56.8233639+01:00"
47 changes: 47 additions & 0 deletions charts/vibspecdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: v2
name: vibspecdb
description: A Helm chart of Vibspec-Laravel Application for K8S
home: https://vibspecdb.k8s.photonicdata.science
maintainers:
- name: Nazar Stefaniuk
email: [email protected]
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.13

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"

# icon: A URL to an SVG or PNG image to be used as an icon (optional).

dependencies:
- name: postgresql
version: "10.13.11"
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
- name: redis
version: "15.6.3"
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: rabbitmq
version: "8.24.12"
repository: https://charts.bitnami.com/bitnami
condition: rabbitmq.enabled
- name: meilisearch
version: "0.1.22"
repository: https://meilisearch.github.io/meilisearch-kubernetes
condition: meilisearch.enabled
1 change: 1 addition & 0 deletions charts/vibspecdb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vibspecdb
Binary file added charts/vibspecdb/charts/meilisearch-0.1.22.tgz
Binary file not shown.
Binary file not shown.
Binary file added charts/vibspecdb/charts/rabbitmq-8.24.12.tgz
Binary file not shown.
Binary file added charts/vibspecdb/charts/redis-15.6.3.tgz
Binary file not shown.
22 changes: 22 additions & 0 deletions charts/vibspecdb/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "vibspecdb.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "vibspecdb.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "vibspecdb.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "vibspecdb.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/vibspecdb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vibspecdb.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 "vibspecdb.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 "vibspecdb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "vibspecdb.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vibspecdb.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
54 changes: 54 additions & 0 deletions charts/vibspecdb/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.EnvConfigMapRef.name }}
namespace: {{ .Release.Namespace }}
data:
APP_NAME: {{ .Values.name }}
APP_ENV: "production"
APP_DEBUG: "true"
APP_PORT: "80"
APP_URL: "https://vibspecdb.k8s.photonicdata.science/"
ASSET_URL: "https://vibspecdb.k8s.photonicdata.science/"
LOG_CHANNEL: "stdout"
DB_USERNAME: {{ .Values.postgresql.postgresqlUsername }}
DB_CONNECTION: "pgsql"
DB_HOST: {{ .Values.postgresql.host }}
DB_PORT: "{{ .Values.postgresql.port }}"
DB_DATABASE: {{ .Values.postgresql.postgresqlDatabase }}
BROADCAST_DRIVER: "log"
FILESYSTEM_DRIVER: "local"
QUEUE_CONNECTION: "rabbitmq"
RABBITMQ_HOST: {{ .Values.rabbitmq.host }}
RABBITMQ_PORT: "{{ .Values.rabbitmq.port }}"
RABBITMQ_USER: {{ .Values.rabbitmq.auth.username }}
RABBITMQ_QUEUE: jobs
SCOUT_DRIVER: meilisearch
MEILISEARCH_HOST: {{ .Values.meilisearch.host }}
SESSION_DRIVER: "redis"
CACHE_DRIVER: "redis"
REDIS_CLIENT: "predis"
SESSION_LIFETIME: "120"
MEMCACHED_HOST: "memcached"
REDIS_HOST: {{ .Values.redis.host }}
REDIS_PORT: "{{ .Values.redis.port }}"
PUSHER_APP_ID: "null"
PUSHER_APP_CLUSTER: "mt1"
MIX_PUSHER_APP_KEY: "${PUSHER_APP_KEY}"
MAIL_MAILER: "smtp"
MAIL_HOST: {{ .Values.smtp.host }}
MAIL_PORT: "{{ .Values.smtp.port }}"
MAIL_ENCRYPTION: "null"
MAIL_FROM_ADDRESS: {{ .Values.smtp.from }}
MAIL_FROM_NAME: "VibspecDB"
AWS_DEFAULT_REGION: "us-east-1"
AWS_BUCKET: "null"
AWS_ENDPOINT: {{ .Values.minio.endpoint }}
AWS_URL: {{ .Values.minio.baseUrl }}
AWS_USE_PATH_STYLE_ENDPOINT: "false"
GITLAB_REDIRECT_URI: {{ .Values.gitlab.redirectUrl }}
GITLAB_BASE_URL: {{ .Values.gitlab.baseUrl }}
KEYCLOAK_REDIRECT_URI: {{ .Values.keycloak.redirectUrl }}
KEYCLOAK_BASE_URL: {{ .Values.keycloak.baseUrl }}
KEYCLOAK_REALM: {{ .Values.keycloak.realm }}
APP_KEY: {{ .Values.app.key }}
90 changes: 90 additions & 0 deletions charts/vibspecdb/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vibspecdb.fullname" . }}
labels:
{{- include "vibspecdb.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "vibspecdb.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "vibspecdb.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "vibspecdb.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.persistence.enabled }}
initContainers:
- name: storage-permissions
image: busybox
command: ["sh", "-c", "chmod 777 /storage"]
volumeMounts:
- name: storage
mountPath: /storage
{{- 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 }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- mountPath: {{ .Values.directory }}/{{ .Values.persistence.path }}
name: storage
{{- end }}
envFrom:
- configMapRef:
name: {{ .Values.EnvConfigMapRef.name }}
- secretRef:
name: {{ .Values.EnvSecretRef.name }}
- secretRef:
name: {{ .Values.EnvSecretRefServices.name }}
ports:
- name: http
containerPort: 80
protocol: TCP
{{- if not .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
{{- if .Values.persistence.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (printf "%s-storage" (include "vibspecdb.fullname" .)) }}
{{- 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 }}
28 changes: 28 additions & 0 deletions charts/vibspecdb/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "vibspecdb.fullname" . }}
labels:
{{- include "vibspecdb.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "vibspecdb.fullname" . }}
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 }}
14 changes: 14 additions & 0 deletions charts/vibspecdb/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "vibspecdb.fullname" . }}-app-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: vibspec-app-ip-address
networking.gke.io/managed-certificates: vibspec-app-dev-certificate
kubernetes.io/ingress.class: "gce"
spec:
defaultBackend:
service:
name: {{ include "vibspecdb.fullname" . }}
port:
number: {{ .Values.service.port }}
Loading

0 comments on commit 6f964d7

Please sign in to comment.