Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helm chart #114

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,31 @@ map.json
*.log
*.swp
.idea

#########################
# helm related
#########################
# ignore secrets
gitrepo.yaml
variables.txt
*.secret.yaml

# ignore terraform files
terraform/.terraform
terraform/*.auto.tfvars
terraform/terraform.tfstate
terraform/terraform.tfstate.backup

# ignore downloaded chart fiels
helm/smile/charts/*
*charts/*
# values for deployment
helm/smile/values-clowder.yaml
helm/smile/values-smile.yaml

# idea folder
*.idea/

# secrets
*.secret.yaml
helm/smile/smile.secret.yaml
12 changes: 12 additions & 0 deletions helm/smile/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dependencies:
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 11.7.0
- name: minio
repository: https://charts.bitnami.com/bitnami
version: 12.1.3
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.6.0
digest: sha256:ef61ee3fc18af86bf276359adba62024af1cab89b4f87bffe57ef0e9e5221195
generated: "2023-02-01T14:00:21.4759023-06:00"
45 changes: 45 additions & 0 deletions helm/smile/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: v2
name: smile
icon:
home: https://github.com/ncsa/standalone-smm-smile
description: Smile
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.1.0

# 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.
appVersion: 0.1.0

# List of people that maintain this helm chart.
maintainers:
- name: Yong Wook Kim
email: [email protected]

# location of source code
sources:
- https://github.com/ncsa/standalone-smm-smile

# dependencies for the helm chart, use helm dep install to the install them.
dependencies:
- name: rabbitmq
version: ~11
repository: https://charts.bitnami.com/bitnami
- name: minio
version: ~12
repository: https://charts.bitnami.com/bitnami
- name: redis
version: ~17
repository: https://charts.bitnami.com/bitnami

# annotations for artifact.io
annotations:
artifacthub.io/links: |
- name: Helm Chart
url: https://git.ncsa.illinois.edu/isda/clusters/smm
artifacthub.io/changes: |
- Updated email functions in components
25 changes: 25 additions & 0 deletions helm/smile/smile.secret.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v1
kind: Secret
metadata:
name: smile-server
namespace: smile
stringData:
CILOGON_CLIENT_ID: ""
CILOGON_CLIENT_SECRET: ""
CLOWDER_GLOBAL_KEY: ""
GA_KEY: "" # Google Analytics Key
REDDIT_CLIENT_ID: ""
REDDIT_CLIENT_SECRET: ""
BOX_CLIENT_ID: ""
BOX_CLIENT_SECRET: ""
DROPBOX_CLIENT_ID: ""
DROPBOX_CLIENT_SECRET: ""
GOOGLE_CLIENT_ID: ""
GOOGLE_CLIENT_SECRET: ""
root-user: "" #AWS_ACCESSKEY
root-password: "" #AWS_ACCESSKEYSECRET
TWITTER_CONSUMER_KEY: ""
TWITTER_CONSUMER_SECRET: ""
TWITTER_V2_CLIENT_ID: ""
TWITTER_V2_CLIENT_SECRET: ""
107 changes: 107 additions & 0 deletions helm/smile/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "smile.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 "smile.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 "smile.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "smile.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "smile.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Add environment variables to talk to minio
*/}}
{{- define "smile.minio.connect" -}}
- name: MINIO_URL
value: {{ include "smile.fullname" . }}-minio
- name: MINIO_PUBLIC_ACCESS_URL
value: "https://{{ .Values.minio.apiIngress.hostname }}"
- name: AWS_ACCESSKEY
valueFrom:
secretKeyRef:
{{- if .Values.externalsecrets }}
name: {{ .Values.externalsecrets }}
{{- else }}
name: {{ include "smile.fullname" . }}-server
{{- end }}
key: root-user
- name: AWS_ACCESSKEYSECRET
valueFrom:
secretKeyRef:
{{- if .Values.externalsecrets }}
name: {{ .Values.externalsecrets }}
{{- else }}
name: {{ include "smile.fullname" . }}-server
{{- end }}
key: root-password
- name: BUCKET_NAME
value: {{ .Values.minio.defaultBuckets }}
{{- end }}

{{/*
Add environment variables to talk to minio
*/}}
{{- define "smile.email.connect" -}}
- name: EMAIL_HOST
value: "smtp.ncsa.illinois.edu"
- name: EMAIL_PORT
value: "25"
- name: EMAIL_FROM_ADDRESS
value: "[email protected]"
- name: EMAIL_PASSWORD
value: ""
{{- end }}
47 changes: 47 additions & 0 deletions helm/smile/templates/algorithm-autophrase/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "smile.fullname" . }}-autophrase
labels:
{{- include "smile.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.algorithm_autophrase.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "smile.name" . }}-autophrase
app.kubernetes.io/instance: {{ .Release.Name }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "smile.name" . }}-autophrase
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: autophrase
image: "{{ .Values.image.project }}/{{ .Values.algorithm_autophrase.image.repository }}:{{ .Values.algorithm_autophrase.image.tag }}"
imagePullPolicy: {{ .Values.algorithm_autophrase.image.pullPolicy | default .Values.image.pullPolicy }}
command: ["/usr/bin/python3"]
args: ["./rabbitmq_handler.py"]
env:
- name: RABBITMQ_HOST
value: "{{ include "smile.fullname" . }}-rabbitmq"
- name: QUEUE_NAME
value: autophrase
{{- include "smile.minio.connect" . | nindent 12 }}
{{- include "smile.email.connect" . | nindent 12 }}
resources:
{{- toYaml .Values.algorithm_autophrase.resources | nindent 12 }}
{{- with .Values.algorithm_autophrase.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_autophrase.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_autophrase.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "smile.fullname" . }}-cls-predict
labels:
{{- include "smile.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.algorithm_classification_predict.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "smile.name" . }}-cls-predict
app.kubernetes.io/instance: {{ .Release.Name }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "smile.name" . }}-cls-predict
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: cls-predict
image: "{{ .Values.image.project }}/{{ .Values.algorithm_classification_predict.image.repository }}:{{ .Values.algorithm_classification_predict.image.tag }}"
imagePullPolicy: {{ .Values.algorithm_classification_predict.image.pullPolicy | default .Values.image.pullPolicy }}
command: ["python"]
args: ["./rabbitmq_handler.py"]
env:
- name: RABBITMQ_HOST
value: "{{ include "smile.fullname" . }}-rabbitmq"
- name: QUEUE_NAME
value: classification_predict
{{- include "smile.minio.connect" . | nindent 12 }}
resources:
{{- toYaml .Values.algorithm_classification_predict.resources | nindent 12 }}
{{- with .Values.algorithm_classification_predict.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_classification_predict.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_classification_predict.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "smile.fullname" . }}-cls-split
labels:
{{- include "smile.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.algorithm_classification_split.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "smile.name" . }}-cls-split
app.kubernetes.io/instance: {{ .Release.Name }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "smile.name" . }}-cls-split
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: cls-split
image: "{{ .Values.image.project }}/{{ .Values.algorithm_classification_split.image.repository }}:{{ .Values.algorithm_classification_split.image.tag }}"
imagePullPolicy: {{ .Values.algorithm_classification_split.image.pullPolicy | default .Values.image.pullPolicy }}
command: ["python"]
args: ["./rabbitmq_handler.py"]
env:
- name: RABBITMQ_HOST
value: "{{ include "smile.fullname" . }}-rabbitmq"
- name: QUEUE_NAME
value: classification_split
{{- include "smile.minio.connect" . | nindent 12 }}
resources:
{{- toYaml .Values.algorithm_classification_split.resources | nindent 12 }}
{{- with .Values.algorithm_classification_split.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_classification_split.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.algorithm_classification_split.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading