Skip to content

Commit 832ef43

Browse files
authored
Merge pull request #155 from jacekn/archive
Improve history archive handling in the core chart
2 parents 9870c99 + a51046c commit 832ef43

4 files changed

Lines changed: 100 additions & 7 deletions

File tree

charts/core/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
name: core
33
description: This chart will deploy Stellar Core node
4-
version: 0.4.0
4+
version: 0.5.0
55
appVersion: "25.2.0-3058.bb195c49d.jammy"
66
maintainers:
77
- name: Stellar Development Foundation

charts/core/templates/core-sts.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ spec:
5252
- /config/stellar-core.cfg
5353
- --console
5454
imagePullPolicy: {{ .Values.global.image.core.pullPolicy }}
55-
ports:
56-
- containerPort: 11626
57-
name: core
5855
{{- if (.Values.core).resources }}
5956
resources:
6057
{{ toYaml .Values.core.resources | indent 10 }}
@@ -158,10 +155,16 @@ metadata:
158155
release: {{ .Release.Name }}
159156
heritage: {{ .Release.Service }}
160157
spec:
161-
type: ClusterIP
158+
clusterIP: None
159+
publishNotReadyAddresses: true
162160
ports:
163161
- name: core
164162
port: 11626
165163
targetPort: 11626
164+
{{- if (.Values.core.historyProxy).enabled }}
165+
- name: http
166+
port: 80
167+
targetPort: 80
168+
{{- end }}
166169
selector:
167170
app: {{ template "common.fullname" . }}

charts/core/templates/history-proxy.yaml

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,91 @@ data:
3131
}
3232
---
3333
apiVersion: v1
34+
kind: ConfigMap
35+
metadata:
36+
name: {{ template "common.fullname" . }}-history-router-nginx
37+
{{- if .Release.Namespace }}
38+
namespace: {{ .Release.Namespace }}
39+
{{- end }}
40+
labels:
41+
app: {{ template "common.fullname" . }}-history
42+
chart: {{ template "common.chart" . }}
43+
release: {{ .Release.Name }}
44+
heritage: {{ .Release.Service }}
45+
data:
46+
default.conf: |
47+
server {
48+
listen 80;
49+
server_name _;
50+
resolver kube-dns.kube-system.svc.cluster.local valid=10s;
51+
resolver_timeout 5s;
52+
53+
location ~ ^/([0-9]+)(/.*)?$ {
54+
set $pod_index $1;
55+
set $pod_path $2;
56+
57+
if ($pod_path = "") {
58+
set $pod_path "/";
59+
}
60+
61+
proxy_set_header Host $host;
62+
proxy_set_header X-Real-IP $remote_addr;
63+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
64+
proxy_set_header X-Forwarded-Proto $scheme;
65+
proxy_http_version 1.1;
66+
67+
proxy_pass http://{{ template "common.fullname" . }}-$pod_index.{{ template "common.fullname" . }}.{{ .Release.Namespace | default "default" }}.svc.cluster.local:80$pod_path;
68+
}
69+
70+
location / {
71+
return 404;
72+
}
73+
}
74+
---
75+
apiVersion: apps/v1
76+
kind: Deployment
77+
metadata:
78+
name: {{ template "common.fullname" . }}-history
79+
{{- if .Release.Namespace }}
80+
namespace: {{ .Release.Namespace }}
81+
{{- end }}
82+
labels:
83+
app: {{ template "common.fullname" . }}-history
84+
chart: {{ template "common.chart" . }}
85+
release: {{ .Release.Name }}
86+
heritage: {{ .Release.Service }}
87+
spec:
88+
replicas: {{ .Values.core.historyProxy.replicaCount | default 1 }}
89+
selector:
90+
matchLabels:
91+
app: {{ template "common.fullname" . }}-history
92+
release: {{ .Release.Name }}
93+
template:
94+
metadata:
95+
labels:
96+
app: {{ template "common.fullname" . }}-history
97+
release: {{ .Release.Name }}
98+
spec:
99+
{{- if (.Values.global).imagePullSecrets }}
100+
imagePullSecrets:
101+
{{ toYaml .Values.global.imagePullSecrets | indent 8 }}
102+
{{- end }}
103+
containers:
104+
- name: history-router
105+
image: "{{ .Values.global.image.nginx.registry }}/{{ .Values.global.image.nginx.repository }}:{{ .Values.global.image.nginx.tag }}"
106+
imagePullPolicy: {{ .Values.global.image.nginx.pullPolicy }}
107+
ports:
108+
- containerPort: 80
109+
name: http
110+
volumeMounts:
111+
- mountPath: /etc/nginx/conf.d
112+
name: nginx-router-config
113+
volumes:
114+
- name: nginx-router-config
115+
configMap:
116+
name: {{ template "common.fullname" . }}-history-router-nginx
117+
---
118+
apiVersion: v1
34119
kind: Service
35120
metadata:
36121
name: {{ template "common.fullname" . }}-history
@@ -49,7 +134,8 @@ spec:
49134
port: 80
50135
targetPort: 80
51136
selector:
52-
app: {{ template "common.fullname" . }}
137+
app: {{ template "common.fullname" . }}-history
138+
release: {{ .Release.Name }}
53139
{{- if and (.Values.core.historyProxy.ingress.enabled) }}
54140
---
55141
apiVersion: networking.k8s.io/v1
@@ -66,6 +152,9 @@ metadata:
66152
{{- end }}
67153
{{- end }}
68154
spec:
155+
{{- if (.Values.core.historyProxy.ingress).ingressClassName }}
156+
ingressClassName: {{ .Values.core.historyProxy.ingress.ingressClassName }}
157+
{{- end }}
69158
tls:
70159
- secretName: {{ template "common.fullname" . }}-history-cert
71160
hosts:

charts/core/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ core:
9595
# will make the chart deplo reverse proxy nginx container
9696
historyProxy:
9797
enabled: false
98+
replicaCount: 1
9899

99100
## Path to serve over http
100101
# localPath: /var/lib/stellar/local_archive
@@ -110,9 +111,9 @@ core:
110111
ingress:
111112
enabled: false
112113
host: history-proxy.example.com
114+
# ingressClassName: nginx
113115
## Extra annotations to add to the Ingress object
114116
#annotations:
115-
# kubernetes.io/ingress.class: "public"
116117
# cert-manager.io/cluster-issuer: "default"
117118
## Extra labels to add to the Ingress object
118119
#labels:

0 commit comments

Comments
 (0)