Skip to content

Commit

Permalink
[autoscout] Adding frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
nzenchik committed Jul 24, 2024
1 parent a319c9d commit e31780b
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/autoscout/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ 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.1
version: 0.2.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.1"
appVersion: "0.1.2"
3 changes: 3 additions & 0 deletions charts/autoscout/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ kind: Deployment
metadata:
name: {{ include "autoscout.fullname" . }}
labels:
app: {{ include "autoscout.fullname" . }}
{{- include "autoscout.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "autoscout.fullname" . }}
{{- include "autoscout.selectorLabels" . | nindent 6 }}
template:
metadata:
Expand All @@ -20,6 +22,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ include "autoscout.fullname" . }}
{{- include "autoscout.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
Expand Down
66 changes: 66 additions & 0 deletions charts/autoscout/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{- if .Values.frontend.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "autoscout.fullname" . }}-frontend
labels:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- if eq .Values.frontend.image.pullPolicy "Always" }}
rollme: {{ randAlphaNum 5 | quote }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "autoscout.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.frontend.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-frontend
securityContext:
{{- toYaml .Values.frontend.securityContext | nindent 12 }}
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.frontend.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.frontend.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.frontend.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.frontend.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 }}
{{- end }}
64 changes: 64 additions & 0 deletions charts/autoscout/templates/frontend-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if .Values.frontend.enabled }}
{{- if .Values.frontend.ingress.enabled -}}
{{- $fullName := include "autoscout.fullname" . -}}
{{- $svcPort := .Values.frontend.service.port -}}
{{- if and .Values.frontend.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.frontend.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.frontend.ingress.annotations "kubernetes.io/ingress.class" .Values.frontend.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-frontend
labels:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.labels" . | nindent 4 }}
{{- with .Values.frontend.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.frontend.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.frontend.ingress.className }}
{{- end }}
{{- if .Values.frontend.ingress.tls }}
tls:
{{- range .Values.frontend.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.frontend.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-frontend
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-frontend
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/autoscout/templates/frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.frontend.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "autoscout.fullname" . }}-frontend
labels:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.labels" . | nindent 4 }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ include "autoscout.fullname" . }}-frontend
{{- include "autoscout.selectorLabels" . | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/autoscout/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
name: {{ include "autoscout.fullname" . }}
labels:
app: {{ include "autoscout.fullname" . }}
{{- include "autoscout.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
Expand All @@ -12,4 +13,5 @@ spec:
protocol: TCP
name: http
selector:
app: {{ include "autoscout.fullname" . }}
{{- include "autoscout.selectorLabels" . | nindent 4 }}
51 changes: 51 additions & 0 deletions charts/autoscout/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,57 @@ readinessProbe:
path: /health
port: http

frontend:
enabled: false
image:
repository: ghcr.io/blockscout/autoscout-frontend
pullPolicy: IfNotPresent
tag: "latest"
replicaCount: 1
podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 3000
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
livenessProbe:
httpGet:
path: /healthz
port: http
readinessProbe:
httpGet:
path: /healthz
port: http
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
Expand Down

0 comments on commit e31780b

Please sign in to comment.