Skip to content

Commit 0e503d8

Browse files
authored
Merge pull request #101 from holaplex/mpw/nfts-polygon-chart
nfts polygon chart
2 parents 2349799 + 0ffeaa9 commit 0e503d8

File tree

10 files changed

+347
-0
lines changed

10 files changed

+347
-0
lines changed
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-polygon/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-polygon
3+
description: Helm chart for hub-nfts-polygon
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: "1.0.0"
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-polygon.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-polygon.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-polygon.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-polygon.labels" -}}
37+
helm.sh/chart: {{ include "hub-nfts-polygon.chart" . }}
38+
{{ include "hub-nfts-polygon.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-polygon.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "hub-nfts-polygon.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-polygon.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "hub-nfts-polygon.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "hub-nfts-polygon.fullname" . }}
5+
labels:
6+
{{- include "hub-nfts-polygon.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-polygon.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-polygon.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "hub-nfts-polygon.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 | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
envFrom:
37+
- configMapRef:
38+
name: {{ include "hub-nfts-polygon.fullname" . }}
39+
- secretRef:
40+
name: {{ include "hub-nfts-polygon.fullname" . }}
41+
resources:
42+
{{- toYaml .Values.resources | nindent 12 }}
43+
{{- with .Values.nodeSelector }}
44+
nodeSelector:
45+
{{- toYaml . | nindent 8 }}
46+
{{- end }}
47+
{{- with .Values.affinity }}
48+
affinity:
49+
{{- toYaml . | nindent 8 }}
50+
{{- end }}
51+
{{- with .Values.tolerations }}
52+
tolerations:
53+
{{- toYaml . | nindent 8 }}
54+
{{- end }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "hub-nfts-polygon.fullname" . }}
5+
data:
6+
{{- with .Values.environment }}
7+
POLYGON_EDITION_CONTRACT: {{ required "must set polygon edition contract address" .polygonEditionContractAddress | quote }}
8+
KAFKA_BROKERS: {{ required "must set kafka brokers" .kafkaBrokers | quote }}
9+
KAFKA_USERNAME: {{ required "must set kafka username" .kafkaUsername | quote }}
10+
KAFKA_SSL: {{ required "must set kafka ssl" .kafkaSsl | quote }}
11+
{{- end }}
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-polygon.fullname" . }}
6+
labels:
7+
{{- include "hub-nfts-polygon.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "hub-nfts-polygon.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-polygon.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-polygon.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-polygon.fullname" . }}
33+
key: DATABASE_URL
34+
optional: false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- with .Values.secrets }}
2+
{{- if .enabled }}
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ include "hub-nfts-polygon.fullname" $ }}
7+
annotations:
8+
"helm.sh/hook": pre-install
9+
type: Opaque
10+
data:
11+
DATABASE_URL: {{ required "must set databaseUrl" .entries.databaseUrl | b64enc }}
12+
KAFKA_PASSWORD: {{ .entries.kafkaPassword | b64enc }}
13+
POLYGON_RPC_ENDPOINT: {{ required "must set RPC endpoint .polygonEndpoint" .entries.polygonEndpoint | b64enc }}
14+
{{- end }}
15+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "hub-nfts-polygon.serviceAccountName" . }}
6+
labels:
7+
{{- include "hub-nfts-polygon.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Default values for hub-nfts-polygon.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
migrate:
8+
image:
9+
repository: holaplex/hub-nfts-polygon-migrations
10+
pullPolicy: IfNotPresent
11+
# Overrides the image tag whose default is the chart appVersion.
12+
tag: "latest"
13+
14+
image:
15+
repository: holaplex/hub-nfts-polygon
16+
pullPolicy: IfNotPresent
17+
# Overrides the image tag whose default is the chart appVersion.
18+
tag: "latest"
19+
20+
imagePullSecrets: []
21+
nameOverride: ""
22+
fullnameOverride: ""
23+
24+
serviceAccount:
25+
# Specifies whether a service account should be created
26+
create: true
27+
# Annotations to add to the service account
28+
annotations: {}
29+
# The name of the service account to use.
30+
# If not set and create is true, a name is generated using the fullname template
31+
name: ""
32+
33+
podAnnotations: {}
34+
35+
podSecurityContext: {}
36+
# fsGroup: 2000
37+
38+
securityContext:
39+
allowPrivilegeEscalation: false
40+
readOnlyRootFilesystem: true
41+
runAsNonRoot: true
42+
runAsUser: 10000
43+
runAsGroup: 10000
44+
45+
resources: {}
46+
# We usually recommend not to specify default resources and to leave this as a conscious
47+
# choice for the user. This also increases chances charts run on environments with little
48+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
49+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
50+
# limits:
51+
# cpu: 100m
52+
# memory: 128Mi
53+
# requests:
54+
# cpu: 100m
55+
# memory: 128Mi
56+
57+
autoscaling:
58+
enabled: false
59+
minReplicas: 1
60+
maxReplicas: 100
61+
targetCPUUtilizationPercentage: 80
62+
# targetMemoryUtilizationPercentage: 80
63+
64+
nodeSelector: {}
65+
66+
tolerations: []
67+
68+
affinity: {}
69+
70+
secrets:
71+
enabled: true
72+
entries:
73+
polygonEndpoint: ""
74+
kafkaPassword: ""
75+
databaseUrl: ""
76+
77+
environment:
78+
kafkaBrokers: "hub-eventbus-cluster-0.hub-eventbus-cluster.default.svc.cluster.local.:9093"
79+
kafkaUsername: ""
80+
kafkaSsl: false
81+
polygonEditionContractAddress: ""

0 commit comments

Comments
 (0)