Skip to content

Commit 1d8079c

Browse files
authored
Merge pull request #29 from holaplex/mpw/nfts-chart
Mpw/nfts chart
2 parents ed2df39 + 6e4fb52 commit 1d8079c

File tree

12 files changed

+405
-0
lines changed

12 files changed

+405
-0
lines changed

charts/hub-nfts/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/hub-nfts/Chart.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v2
2+
name: hub-nfts
3+
description: Helm chart for hub-nfts
4+
maintainers:
5+
- name: Holaplex Engineering
6+
7+
8+
# A chart can be either an 'application' or a 'library' chart.
9+
#
10+
# Application charts are a collection of templates that can be packaged into versioned archives
11+
# to be deployed.
12+
#
13+
# Library charts provide useful utilities or functions for the chart developer. They're included as
14+
# a dependency of application charts to inject those utilities and functions into the rendering
15+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
16+
type: application
17+
18+
# This is the chart version. This version number should be incremented each time you make changes
19+
# to the chart and its templates, including the app version.
20+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21+
version: 0.1.0
22+
23+
# This is the version number of the application being deployed. This version number should be
24+
# incremented each time you make changes to the application. Versions are not expected to
25+
# follow Semantic Versioning. They should reflect the version the application is using.
26+
# It is recommended to use it with quotes.
27+
appVersion: "0.1.0"

charts/hub-nfts/templates/NOTES.txt

Whitespace-only changes.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "hub-nfts.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "hub-nfts.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "hub-nfts.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "hub-nfts.labels" -}}
37+
helm.sh/chart: {{ include "hub-nfts.chart" . }}
38+
{{ include "hub-nfts.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "hub-nfts.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "hub-nfts.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "hub-nfts.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "hub-nfts.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "hub-nfts.fullname" . }}
5+
labels:
6+
{{- include "hub-nfts.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "hub-nfts.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "hub-nfts.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "hub-nfts.serviceAccountName" . }}
28+
securityContext:
29+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
securityContext:
33+
{{- toYaml .Values.securityContext | nindent 12 }}
34+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
envFrom:
37+
- configMapRef:
38+
name: {{ include "hub-nfts.fullname" . }}
39+
- secretRef:
40+
name: {{ include "hub-nfts.fullname" . }}
41+
ports:
42+
- name: http
43+
containerPort: {{ .Values.service.port }}
44+
protocol: TCP
45+
volumeMounts:
46+
- name: solana-keypair
47+
mountPath: /app/keypair.json
48+
subPath: keypair.json
49+
readOnly: true
50+
livenessProbe:
51+
httpGet:
52+
path: /health
53+
port: http
54+
readinessProbe:
55+
httpGet:
56+
path: /health
57+
port: http
58+
resources:
59+
{{- toYaml .Values.resources | nindent 12 }}
60+
volumes:
61+
- name: solana-keypair
62+
secret:
63+
secretName: {{ print (include "hub-nfts.fullname" .) "-keypair" }}
64+
optional: false
65+
{{- with .Values.nodeSelector }}
66+
nodeSelector:
67+
{{- toYaml . | nindent 8 }}
68+
{{- end }}
69+
{{- with .Values.affinity }}
70+
affinity:
71+
{{- toYaml . | nindent 8 }}
72+
{{- end }}
73+
{{- with .Values.tolerations }}
74+
tolerations:
75+
{{- toYaml . | nindent 8 }}
76+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "hub-nfts.fullname" . }}
5+
data:
6+
{{- with .Values.environment }}
7+
PORT: {{ .port | quote }}
8+
KAFKA_BROKERS: {{ required "must set kafka brokers" .kafkaBrokers | quote }}
9+
SOLANA_ENDPOINT: {{ required "must set solana endpoint" .solanaEndpoint | quote }}
10+
KEYPAIR_PATH: {{ required "must set key pair path" .keyPairPath | quote }}
11+
KAFKA_USERNAME: {{ required "must set kafka username" .kafkaUsername | quote }}
12+
KAFKA_SSL: {{ required "must set kafka ssl" .kafkaSsl | quote }}
13+
{{- end }}

charts/hub-nfts/templates/hpa.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "hub-nfts.fullname" . }}
6+
labels:
7+
{{- include "hub-nfts.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "hub-nfts.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: "{{ .Release.Name }}-migrate-db"
5+
labels:
6+
{{- include "hub-nfts.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: migrations
8+
annotations:
9+
"helm.sh/hook": pre-install,pre-upgrade
10+
"helm.sh/hook-delete-policy": hook-succeeded
11+
spec:
12+
template:
13+
metadata:
14+
name: "{{ .Release.Name }}-migrate-db"
15+
labels:
16+
{{- include "hub-nfts.labels" . | nindent 8 }}
17+
app.kubernetes.io/component: migrations
18+
spec:
19+
restartPolicy: Never
20+
containers:
21+
- name: migrate
22+
{{- with .Values.migrate.image }}
23+
imagePullPolicy: {{ .pullPolicy }}
24+
image: "{{ .repository }}:{{ .tag }}"
25+
{{- end }}
26+
command: ["bin/migration"]
27+
args: ["-u", "$(DATABASE_URL)"]
28+
env:
29+
- name: DATABASE_URL
30+
valueFrom:
31+
secretKeyRef:
32+
name: {{ include "hub-nfts.fullname" . }}
33+
key: DATABASE_URL
34+
optional: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- with .Values.secrets }}
2+
{{- if .enabled }}
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ include "hub-nfts.fullname" $ }}
7+
annotations:
8+
"helm.sh/hook": pre-install
9+
type: Opaque
10+
data:
11+
DATABASE_URL: {{ .entries.databaseUrl | b64enc }}
12+
KAFKA_PASSWORD: {{ .entries.kafkaPassword | b64enc }}
13+
---
14+
apiVersion: v1
15+
kind: Secret
16+
metadata:
17+
name: {{ print (include "hub-nfts.fullname" $) "-keypair" }}
18+
annotations:
19+
"helm.sh/hook": pre-install
20+
type: Opaque
21+
data:
22+
keypair.json: |-
23+
{{ required "must set secrets.solanaKeyPair" .entries.solanaKeyPair | b64enc }}
24+
{{- end }}
25+
{{- end }}
26+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "hub-nfts.fullname" . }}
5+
labels:
6+
{{- include "hub-nfts.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "hub-nfts.selectorLabels" . | nindent 4 }}

0 commit comments

Comments
 (0)