Skip to content

Commit

Permalink
move global configs out from application so that it can be consumed f…
Browse files Browse the repository at this point in the history
…rom root chart (#132)
  • Loading branch information
jagan-jaya authored Feb 7, 2025
1 parent 3b95a74 commit 93ea68f
Show file tree
Hide file tree
Showing 30 changed files with 2,338 additions and 2,340 deletions.
1,300 changes: 646 additions & 654 deletions charts/incubator/hyperswitch-app/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions charts/incubator/hyperswitch-app/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ By default card vault and its dependencies are installed, however you need to cr

# Update below values in hyperswitch-stack/values.yaml
# The public key for the locker from locker-public-key.pem
hyperswitch-app.application.server.secrets.kms_jwekey_vault_encryption_key: |
hyperswitch-app.server.secrets.kms_jwekey_vault_encryption_key: |
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
# The private key for the tenant from tenant-private-key.pem
hyperswitch-app.application.server.secrets.kms_jwekey_vault_private_key: |
hyperswitch-app.server.secrets.kms_jwekey_vault_private_key: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
Expand Down
Binary file not shown.
256 changes: 128 additions & 128 deletions charts/incubator/hyperswitch-app/configs/misc.toml

Large diffs are not rendered by default.

64 changes: 37 additions & 27 deletions charts/incubator/hyperswitch-app/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
1. Get the application URL by running these commands:
1. Get the Application URL:
- If Ingress is not available, use port-forwarding:
```shell
export ADDRESS_CREATED=$(kubectl get ingress -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
if [ -z "$ADDRESS_CREATED" ]; then
echo "Using port-forwarding to access the services."

export ADDRESS_CREATED=$(kubectl get ingress -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
if [ -z "$ADDRESS_CREATED" ]
then
kubectl port-forward deployment/hyperswitch-server-v1o112o0 8080:8080 -n {{ .Release.Namespace }} & \
kubectl port-forward deployment/hyperswitch-control-center-v1o30o0 9000:9000 -n {{ .Release.Namespace }} & \
echo "======================================================"
echo "** App server running on: http://localhost:8080 **"
echo "** Control center running on: http://localhost:9000 **"
echo "======================================================"
echo "\nRun this command to close exposed ports kill\n"
echo "kill \$( lsof -i:8080 -t ) && kill \$( lsof -i:9000 -t )"
echo "======================================================"
else
kubectl get ingress -n {{ .Release.Namespace }}
fi
========================================================
Clickhouse Setup
--------------------------------------------------------
# To run clickhouse init script after clickhouse is started
CKH_PASS=$(kubectl get secret clickhouse -n {{ .Release.Namespace }} -o jsonpath="{.data.admin-password}" | base64 --decode)
kubectl exec -it clickhouse-shard0-0 -n hyperswitch -- sh -c 'cat docker-entrypoint-initdb.d/*.sql | clickhouse-client --user default --password '${CKH_PASS}' --multiquery'
========================================================
Expose Mailhog for local email service
--------------------------------------------------------
kubectl expose deployment mailhog --type=LoadBalancer --name=mailhog-service -n {{ .Release.Namespace }}
you can see the email on http://localhost:8025/
# Port-forwarding commands
kubectl port-forward service/hyperswitch-server 8080:80 -n {{ .Release.Namespace }} > /dev/null 2>&1 & \
kubectl port-forward service/hyperswitch-control-center 9000:80 -n {{ .Release.Namespace }} > /dev/null 2>&1 & \
kubectl port-forward service/{{ .Release.Name }}-grafana 3000:80 -n {{ .Release.Namespace }} > /dev/null 2>&1 & \
kubectl port-forward service/{{ .Release.Name }}-vector 3103:3103 -n {{ .Release.Namespace }} > /dev/null 2>&1 & \
kubectl port-forward service/mailhog 8025:8025 -n {{ .Release.Namespace }} > /dev/null 2>&1 &

echo "======================================================"
echo " App server running on: http://localhost:8080 "
echo " Control center running on: http://localhost:9000 "
echo " Grafana running on http://localhost:3000 to view logs "
echo " Vector running on http://localhost:3103 to collect logs "
echo " Mailhog running on http://localhost:8025 to receive mails "
echo "\n Test Payment: https://docs.hyperswitch.io/hyperswitch-open-source/account-setup/test-a-payment"
echo "======================================================"

echo "\nTo close the exposed ports, run the following command:\n"
echo "lsof -i:8080,9000,3000,3103,8025 -t | xargs kill"
echo "======================================================"
else
echo "Ingress available. Access the services using the following command:"
kubectl get ingress -n {{ .Release.Namespace }}
fi
```

2. Clickhouse Setup:
- Run Clickhouse init script after Clickhouse is started:
```shell
CKH_PASS=$(kubectl get secret clickhouse -n {{ .Release.Namespace }} -o jsonpath="{.data.admin-password}" | base64 --decode)
kubectl exec -it clickhouse-shard0-0 -n {{ .Release.Namespace }} -- sh -c 'cat docker-entrypoint-initdb.d/*.sql | clickhouse-client --user default --password '${CKH_PASS}' --multiquery'
```
========================================================
4 changes: 2 additions & 2 deletions charts/incubator/hyperswitch-app/templates/_envs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
key: ROUTER__EMAIL__SENDER_EMAIL
name: hyperswitch-secrets
- name: ROUTER__EMAIL__ALLOWED_UNVERIFIED_DAYS
value: "{{ .Values.application.server.email.allowed_unverified_days }}"
value: "{{ .Values.server.email.allowed_unverified_days }}"
- name: ROUTER__EMAIL__AWS_REGION
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -177,5 +177,5 @@
key: ROUTER__EMAIL__AWS_SES__STS_ROLE_SESSION_NAME
name: hyperswitch-secrets
- name: RUN_ENV
value: {{ .Values.application.server.run_env }}
value: {{ .Values.server.run_env }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: consumer-cm-{{ .Release.Name }}
data:
consumer.toml: |
{{- if eq .Values.application.server.run_env "production" -}}
{{- if eq .Values.server.run_env "production" -}}
{{ .Files.Get "configs/producer.toml" | nindent 4 }}
{{ tpl (.Files.Get "configs/misc.toml") . | nindent 4 }}
{{ .Files.Get "configs/router-production.toml" | nindent 4 }}
Expand Down
22 changes: 11 additions & 11 deletions charts/incubator/hyperswitch-app/templates/consumer/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{- with (default .Values.application.global.annotations .Values.application.consumer.annotations) }}
{{- with (default .Values.global.annotations .Values.consumer.annotations) }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: hyperswitch-consumer-v1o112o0
namespace: {{ .Release.Namespace }}
spec:
progressDeadlineSeconds: {{ default .Values.application.global.progressDeadlineSeconds .Values.application.consumer.progressDeadlineSeconds }}
replicas: {{ default .Values.application.global.replicas .Values.application.consumer.replicas }}
progressDeadlineSeconds: {{ default .Values.global.progressDeadlineSeconds .Values.consumer.progressDeadlineSeconds }}
replicas: {{ default .Values.global.replicas .Values.consumer.replicas }}
revisionHistoryLimit: 10
selector:
matchLabels:
app: {{ .Values.application.consumer.labels.app }}
app: {{ .Values.consumer.labels.app }}
version: consumer-v1o112o0
strategy:
{{- with (default .Values.application.global.strategy .Values.application.consumer.strategy) }}
{{- with (default .Values.global.strategy .Values.consumer.strategy) }}
{{- toYaml . | nindent 4 }}
{{- end }}
template:
Expand All @@ -27,18 +27,18 @@ spec:
checksum/consumer-secret: {{ include (print $.Template.BasePath "/consumer/secret.yaml") . | sha256sum }}
checksum/misc-secrets: {{ include (print $.Template.BasePath "/misc/secrets.yaml") . | sha256sum }}
labels:
app: {{ .Values.application.consumer.labels.app }}
app: {{ .Values.consumer.labels.app }}
version: consumer-v1o112o0
spec:
{{- with (default .Values.application.global.tolerations .Values.application.consumer.tolerations) }}
{{- with (default .Values.global.tolerations .Values.consumer.tolerations) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.affinity .Values.application.consumer.affinity) }}
{{- with (default .Values.global.affinity .Values.consumer.affinity) }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.nodeSelector .Values.application.consumer.nodeSelector) }}
{{- with (default .Values.global.nodeSelector .Values.consumer.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -75,7 +75,7 @@ spec:
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
{{- if eq .Values.application.server.run_env "production" }}
{{- if eq .Values.server.run_env "production" }}
- mountPath: /local/config/production.toml
name: hyperswitch-config
subPath: consumer.toml
Expand All @@ -91,7 +91,7 @@ spec:
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: hyperswitch-router-role
terminationGracePeriodSeconds: {{ .Values.application.consumer.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.consumer.terminationGracePeriodSeconds }}
volumes:
- configMap:
defaultMode: 420
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ data:
ROUTER__REPLICA_DATABASE__USERNAME: {{ include "postgresqlreplica.username" . | b64enc }}
ROUTER__REDIS__HOST: {{ include "redis.host" . | b64enc }}
ROUTER__REDIS__PORT: {{ include "redis.port" . | toString | b64enc }}
ROUTER__LOCKER__REDIS_TEMP_LOCKER_ENCRYPTION_KEY: {{ .Values.application.server.secrets.redis_temp_locker_encryption_key | b64enc }}
ROUTER__PAYMENT_METHOD_AUTH__PM_AUTH_KEY: {{ .Values.application.server.secrets.pm_auth_key | b64enc }}
ROUTER__LOCKER__REDIS_TEMP_LOCKER_ENCRYPTION_KEY: {{ .Values.server.secrets.redis_temp_locker_encryption_key | b64enc }}
ROUTER__PAYMENT_METHOD_AUTH__PM_AUTH_KEY: {{ .Values.server.secrets.pm_auth_key | b64enc }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{- with (default .Values.application.global.annotations .Values.application.controlCenter.annotations) }}
{{- with (default .Values.global.annotations .Values.controlCenter.annotations) }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: hyperswitch-control-center-v1o34o2
namespace: {{ .Release.Namespace }}
spec:
progressDeadlineSeconds: {{ default .Values.application.global.progressDeadlineSeconds .Values.application.controlCenter.progressDeadlineSeconds }}
replicas: {{ default .Values.application.global.replicas .Values.application.controlCenter.replicas }}
progressDeadlineSeconds: {{ default .Values.global.progressDeadlineSeconds .Values.controlCenter.progressDeadlineSeconds }}
replicas: {{ default .Values.global.replicas .Values.controlCenter.replicas }}
revisionHistoryLimit: 10
selector:
matchLabels:
app: {{ .Values.application.controlCenter.labels.app }}
app: {{ .Values.controlCenter.labels.app }}
version: v1o34o2
strategy:
{{- with (default .Values.application.global.strategy .Values.application.controlCenter.strategy) }}
{{- with (default .Values.global.strategy .Values.controlCenter.strategy) }}
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
labels:
app: {{ .Values.application.controlCenter.labels.app }}
app: {{ .Values.controlCenter.labels.app }}
version: v1o34o2
spec:
{{- with (default .Values.application.global.tolerations .Values.application.controlCenter.tolerations) }}
{{- with (default .Values.global.tolerations .Values.controlCenter.tolerations) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.affinity .Values.application.controlCenter.affinity) }}
{{- with (default .Values.global.affinity .Values.controlCenter.affinity) }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.nodeSelector .Values.application.controlCenter.nodeSelector) }}
{{- with (default .Values.global.nodeSelector .Values.controlCenter.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -49,7 +49,7 @@ spec:
- -c
- pkill -15 node
env:
{{- range $key, $value := .Values.application.controlCenter.env }}
{{- range $key, $value := .Values.controlCenter.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
Expand Down Expand Up @@ -82,4 +82,4 @@ spec:
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: hyperswitch-router-role
terminationGracePeriodSeconds: {{ .Values.application.controlCenter.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.controlCenter.terminationGracePeriodSeconds }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ spec:
template:
spec:
restartPolicy: OnFailure
{{- with (default .Values.application.global.tolerations .Values.application.server.tolerations) }}
{{- with (default .Values.global.tolerations .Values.server.tolerations) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.affinity .Values.application.server.affinity) }}
{{- with (default .Values.global.affinity .Values.server.affinity) }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default .Values.application.global.nodeSelector .Values.application.server.nodeSelector) }}
{{- with (default .Values.global.nodeSelector .Values.server.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Loading

0 comments on commit 93ea68f

Please sign in to comment.