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

hub-uploads chart, gateway routes update #153

Merged
merged 5 commits into from
Oct 4, 2023
Merged
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
2 changes: 1 addition & 1 deletion charts/hub-gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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.24.0
version: 0.24.1

# 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
Expand Down
25 changes: 25 additions & 0 deletions charts/hub-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ routes:
paths:
- /invites/*

- name: ui-private-uploads
subdomain: hub
serviceName: hub-uploads
servicePort: 80
session:
enabled: true
sessionRedirect:
enabled: true
redirectTo: true
methods:
- POST
paths:
- /uploads

- name: ui-public
subdomain: hub
serviceName: hub-ui
Expand Down Expand Up @@ -230,6 +244,17 @@ routes:
- "^/id/(.*)"
- "/api/.ory/${1}"

- name: api-uploads
serviceName: hub-uploads
servicePort: 80
subdomain: api
paths:
- /uploads
methods:
- POST
oauth2:
enabled: true

apisixPlugins:
session:
serviceName: kratos-public
Expand Down
23 changes: 23 additions & 0 deletions charts/hub-uploads/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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/
27 changes: 27 additions & 0 deletions charts/hub-uploads/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: hub-uploads
description: Helm chart for hub-uploads
maintainers:
- name: Holaplex Engineering
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.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.
# It is recommended to use it with quotes.
appVersion: 0.1.0
Empty file.
62 changes: 62 additions & 0 deletions charts/hub-uploads/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "hub-uploads.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 "hub-uploads.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 "hub-uploads.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "hub-uploads.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "hub-uploads.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
66 changes: 66 additions & 0 deletions charts/hub-uploads/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hub-uploads.fullname" . }}
labels:
{{- include "hub-uploads.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "hub-uploads.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "hub-uploads.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "hub-uploads.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "hub-uploads.fullname" . }}
- secretRef:
name: {{ include "hub-uploads.fullname" . }}
ports:
- name: http
containerPort: {{ .Values.environment.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http
readinessProbe:
httpGet:
path: /health
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/hub-uploads/templates/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hub-uploads.fullname" . }}
data:
{{- with .Values.environment }}
PORT: {{ .port | quote }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/hub-uploads/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 "hub-uploads.fullname" . }}
labels:
{{- include "hub-uploads.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "hub-uploads.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 }}
72 changes: 72 additions & 0 deletions charts/hub-uploads/templates/netpol.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{{- if .Values.networkPolicies.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "hub-uploads.fullname" . }}
labels:
{{- include "hub-uploads.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "hub-uploads.selectorLabels" . | nindent 8 }}
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 192.168.0.0/16
- 172.16.0.0/20
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: node-local-dns
ports:
- port: 53
protocol: UDP
{{- if .Values.networkPolicies.extraEgress }}
{{ toYaml .Values.networkPolicies.extraEgress | indent 4 }}
{{- end }}
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-apisix
podSelector:
matchLabels:
app.kubernetes.io/name: apisix
ports:
- port: {{ .Values.environment.port }}
protocol: TCP
- from:
- podSelector:
matchLabels:
app.kubernetes.io/instance: hub-nfts
ports:
- port: {{ .Values.environment.port }}
protocol: TCP
- from:
- podSelector:
matchLabels:
app.kubernetes.io/instance: hub-ui
ports:
- port: {{ .Values.environment.port }}
protocol: TCP
{{- if .Values.networkPolicies.extraIngress }}
{{ toYaml .Values.networkPolicies.extraIngress | indent 4 }}
{{- end }}
policyTypes:
- Ingress
- Egress
{{- end }}
14 changes: 14 additions & 0 deletions charts/hub-uploads/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- with .Values.secrets }}
{{- if .enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "hub-uploads.fullname" $ }}
annotations:
"helm.sh/hook": pre-install
type: Opaque
data:
WEB3_UP_KEY: {{ .entries.web3UpKey | b64enc }}
WEB3_UP_PROOF: {{ .entries.web3UpProof | b64enc }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/hub-uploads/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "hub-uploads.fullname" . }}
labels:
{{- include "hub-uploads.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "hub-uploads.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/hub-uploads/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "hub-uploads.serviceAccountName" . }}
labels:
{{- include "hub-uploads.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading