Skip to content

Commit

Permalink
Merge pull request #171 from hashgraph/chart-updates-for-upstream-images
Browse files Browse the repository at this point in the history
feat: Update chart to support upstream images
  • Loading branch information
beeradb authored Jun 6, 2024
2 parents c8caf95 + 8aba5f4 commit c070e31
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 47 deletions.
25 changes: 14 additions & 11 deletions charts/templates/server-repository/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ metadata:
{{- if .Values.serverRepository.annotations }}
annotations:
{{ toYaml .Values.serverRepository.annotations | indent 4 }}
{{- end }}
{{- end }}
data:
REPOSITORY_PATH: {{ .Values.serverRepository.config.REPOSITORY_PATH }}
SERVER_URL: {{ .Values.serverRepository.config.SERVER_URL }}
REPOSITORY_SERVER_URL: {{ .Values.serverRepository.config.REPOSITORY_SERVER_URL }}
SERVER_PORT: {{ .Values.serverRepository.service.server.port | quote }}
SERVER_EXTERNAL_PORT: {{ .Values.serverRepository.service.server.port | quote }}
REPOSITORY_SERVER_PORT: {{ .Values.serverRepository.service.repository.port | quote }}
REPOSITORY_SERVER_EXTERNAL_PORT: {{ .Values.serverRepository.service.repository.port | quote }}
TESTING: {{ .Values.serverRepository.config.TESTING | quote }}
NODE_ENV: {{ .Values.serverRepository.config.NODE_ENV | default "development" }}
UI_DOMAIN_NAME: {{ .Values.serverRepository.config.UI_DOMAIN_NAME }}

SOURCIFY_SERVER: "http://{{ template "sourcify.name" . }}-server:5555"
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -34,5 +27,15 @@ metadata:
{{ toYaml .Values.serverRepository.annotations | indent 4 }}
{{- end }}
data:
config.json: |-
{{- .Values.serverRepository.config.repository | toJson | nindent 4 }}
servers.yaml: |-
{{- .Values.serverRepository.config.servers | toYaml | nindent 4 }}
sourcify-chains.json: |-
{{- .Values.serverRepository.config.sourcifyChains | toJson | nindent 4 }}
local.js: |
module.exports = {
repositoryV1: { path: "/data", },
corsAllowedOrigins: [
/^https?:\/\/(?:.+\.)?hedera-devops.com$/, // swirldslabs-devops
/^https?:\/\/(?:.+\.)?hashscan.io$/, // hashscan
],
};
34 changes: 20 additions & 14 deletions charts/templates/server-repository/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- if .Values.serverRepository.annotations }}
annotations:
{{ toYaml .Values.serverRepository.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.serverRepository.autoscaling.enabled }}
replicas: {{ .Values.serverRepository.replicaCount }}
Expand All @@ -34,12 +34,12 @@ spec:
{{- if .Values.serverRepository.podSecurityContext }}
securityContext:
{{- toYaml .Values.serverRepository.podSecurityContext | nindent 8 }}
{{- end }}
containers:
{{- end }}
containers:
- name: {{ printf "%s-%s" .Chart.Name "server" }}
securityContext:
{{- toYaml .Values.serverRepository.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.serverRepository.image.server.tag | default "server-latest" }}"
image: "{{ .Values.serverRepository.image.server.repository }}:{{ .Values.serverRepository.image.server.tag | default "server-latest" }}"
imagePullPolicy: {{ .Values.serverRepository.image.pullPolicy }}
envFrom:
- configMapRef:
Expand All @@ -58,22 +58,31 @@ spec:
path: /health
port: serverport
periodSeconds: 10
failureThreshold: 6
failureThreshold: 6
{{- if .Values.serverRepository.server.resources }}
resources:
{{- toYaml .Values.serverRepository.server.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ .Chart.Name }}
mountPath: /data
- name: {{ printf "%s-%s" .Chart.Name "repository" }}
mountPath: /home/app/services/server/dist/config/local.js
subPath: local.js
- name: {{ printf "%s-%s" .Chart.Name "repository" }}
mountPath: /home/app/services/server/dist/sourcify-chains.json
subPath: sourcify-chains.json
- name: {{ printf "%s-%s" .Chart.Name "repository" }}
mountPath: /home/app/services/server/dist/servers.yaml
subPath: servers.yaml
- name: {{ printf "%s-%s" .Chart.Name "repository" }}
securityContext:
{{- toYaml .Values.serverRepository.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.serverRepository.image.repository.tag | default "repository-latest" }}"
image: "{{ .Values.serverRepository.image.repository.repository }}:{{ .Values.serverRepository.image.repository.tag | default "repository-latest" }}"
imagePullPolicy: {{ .Values.serverRepository.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ template "sourcify.name" . }}
name: {{ template "sourcify.name" . }}
ports:
- name: repositoryport
containerPort: {{ .Values.serverRepository.service.repository.port }}
Expand All @@ -87,7 +96,7 @@ spec:
httpGet:
path: /select-contract/health
port: repositoryport
periodSeconds: 10
periodSeconds: 10
{{- if .Values.serverRepository.repository.resources }}
resources:
{{- toYaml .Values.serverRepository.repository.resources | nindent 12 }}
Expand All @@ -96,9 +105,6 @@ spec:
- name: {{ .Chart.Name }}
mountPath: /data
readOnly: true
- name: {{ printf "%s-%s" .Chart.Name "repository" }}
mountPath: /redirects/config.json
subPath: config.json
{{- if .Values.serverRepository.nodeSelector }}
nodeSelector:
{{- toYaml .Values.serverRepository.nodeSelector | nindent 8 }}
Expand All @@ -117,11 +123,11 @@ spec:
persistentVolumeClaim:
claimName: {{ template "sourcify.name" . }}-pvc
{{- else }}
volumes:
volumes:
- name: {{ .Chart.Name }}
emptyDir: {}
{{- end }}
- configMap:
name: {{ printf "%s-%s" .Chart.Name "repository" }}
name: {{ printf "%s-%s" .Chart.Name "repository" }}
{{- end -}}
name: {{ printf "%s-%s" .Chart.Name "repository" }}
{{- end -}}
10 changes: 5 additions & 5 deletions charts/templates/ui/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- if .Values.ui.annotations }}
annotations:
{{ toYaml .Values.ui.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.ui.autoscaling.enabled }}
replicas: {{ .Values.ui.replicaCount }}
Expand All @@ -34,15 +34,15 @@ spec:
{{- if .Values.ui.podSecurityContext}}
securityContext:
{{- toYaml .Values.ui.podSecurityContext | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-ui
env:
- name: UI_DOMAIN_NAME
value: {{ .Values.ui.env.UI_DOMAIN_NAME }}
securityContext:
{{- toYaml .Values.ui.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.ui.image.tag | default "ui-latest" }}"
image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag | default "ui-latest" }}"
imagePullPolicy: {{ .Values.ui.image.pullPolicy }}
ports:
- name: http
Expand All @@ -59,7 +59,7 @@ spec:
volumes:
- configMap:
name: {{ printf "%s-%s" .Chart.Name "ui" }}
name: {{ printf "%s-%s" .Chart.Name "ui" }}
name: {{ printf "%s-%s" .Chart.Name "ui" }}
{{- if .Values.ui.nodeSelector }}
nodeSelector:
{{- toYaml .Values.ui.nodeSelector | nindent 8 }}
Expand All @@ -72,4 +72,4 @@ spec:
tolerations:
{{- toYaml .Values.ui.tolerations | nindent 8 }}
{{- end }}
{{- end -}}
{{- end -}}
60 changes: 43 additions & 17 deletions charts/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
nameoOverride: ""
fullnameOverride: ""
imagePullSecrets: []
image:
repository: "ghcr.io/hashgraph/hedera-sourcify"

serverRepository:
## Deploy sourcify server-repository
Expand All @@ -29,6 +27,18 @@ serverRepository:
podAnnotations: {}
podSecurityContext: {}

## server-repository resources configuration
repository:
resources:
requests:
cpu: 500m
memory: 512Mi
server:
resources:
requests:
cpu: 500m
memory: 1024Mi

## server-repository service configuration
service:
server:
Expand All @@ -41,9 +51,11 @@ serverRepository:
## server-repository image configuration, image repository is defined in the global image section above
image:
server:
tag: "server-latest"
repository: ghcr.io/hashgraph/hedera-sourcify/server
tag: "main"
repository:
tag: "repository-latest"
repository: ghcr.io/hashgraph/hedera-sourcify/repository
tag: "main"
pullPolicy: "IfNotPresent"

## server-repository serviceAccount creation and configuration
Expand Down Expand Up @@ -74,19 +86,33 @@ serverRepository:

## Configurations for the server-repository containers
config:
REPOSITORY_PATH: "/data"
SERVER_URL: "http://127.0.0.1:5555"
REPOSITORY_SERVER_URL: "http://127.0.0.1:10000"
TESTING: true
NODE_ENV: "development"
UI_DOMAIN_NAME: verify.example.com
repository:
NODE_ENV: "production"
servers:
- description: The current REST API server
url: ""
- description: The production REST API server
url: "https://server-verify.hashscan.io"
- description: The staging REST API server
url: "https://server-sourcify.hedera-devops.com"
- description: Local development server address on default port 5555
url: "http://localhost:5555"
sourcifyChains:
{
"SERVER_URL": "http://127.0.0.1:5555",
"REPOSITORY_SERVER_URL": "http://127.0.0.1:10000",
"EXPLORER_URL": "http://127.0.0.1:8080",
"295": {
"sourcifyName": "Hedera Mainnet",
"supported": true
},
"296": {
"sourcifyName": "Hedera Testnet",
"supported": true
},
"297": {
"sourcifyName": "Hedera Previewnet",
"supported": true
}
}

ui:
## Deploy sourcify ui
enabled: true
Expand Down Expand Up @@ -119,7 +145,8 @@ ui:

## UI image configuration, image repository is defined in the global image section above
image:
tag: "ui-latest"
repository: ghcr.io/hashgraph/hedera-sourcify/ui
tag: "main"
pullPolicy: "IfNotPresent"

## UI serviceAccount creation and configuration
Expand Down Expand Up @@ -152,14 +179,13 @@ ui:

reset:
## Previewnet reset job, default is to disable
previewnet_reset:
previewnet_reset:
enabled: false
## Testnet reset job, default is to disable
testnet_reset:
enabled: false
enabled: false
## Set default immage repository, tag, and pull policy
image:
repository: "bitnami/kubectl"
tag: "1.28.7"
pullPolicy: "IfNotPresent"

0 comments on commit c070e31

Please sign in to comment.