Skip to content

Commit 18e186e

Browse files
committed
[cinder] Split api in external and internal pods
We want to configure different rate-limits and policies for inter-service communication compared to user communication. To make this work, we need different cinder-api pods. Keystone's service-catalog already supports having different endpoints for these purposes. We spawn a cinder-api-external and a cinder-api-internal deployment each with their own cinder-api-external/internal-ratelimit-redis, since the rate-limit-middleware doesn't support re-using the same redis for multiple apis and it allows us to deploy the redis next to the cinder-api in the same cluster, if we want to. Since most of the configuration/YAML is the same between the two cinder-api pods, we define template function and provide the individual configuration as parameters. During the rollout, there will be a time where the new internal endpoint is not yet synced into the Keystone catalogue. Therefore, we also keep the old "cinder-api" Service alive, pointing to the cinder-api-external Deployment as before. It should be easy to extend this pattern with an "admin" API endpoint as supported by Keystone's catalogue if we choose to use that in the future. This commit contains some restructuring, e.g. introducing new cinder-api-external-etc and cinder-api-internal-etc ConfigMaps to hold and template API configuration and switching to projected volume mounting in the api Deployment for better readability and static config during the runtime.
1 parent dc075ec commit 18e186e

16 files changed

+288
-165
lines changed

openstack/cinder/Chart.lock

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ dependencies:
2020
- name: redis
2121
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
2222
version: 2.2.19
23+
- name: redis
24+
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
25+
version: 2.2.19
2326
- name: owner-info
2427
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
2528
version: 1.0.0
2629
- name: linkerd-support
2730
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
2831
version: 1.1.1
29-
digest: sha256:4c25b977f75c6f0198aa9be9aabd7452328a1a589fb88cf2cea5ff1868b499c1
30-
generated: "2025-10-13T10:21:01.941018+03:00"
32+
digest: sha256:66e466fa523d0d69f7ada1880e2bf097a93a8e26b8011507dc1ea475a98b4243
33+
generated: "2025-10-23T10:19:58.090399364+02:00"

openstack/cinder/Chart.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ dependencies:
2828
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
2929
version: 0.18.5
3030
- name: redis
31-
alias: api-ratelimit-redis
31+
alias: api-external-ratelimit-redis
3232
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
3333
version: 2.2.19
34-
condition: api_rate_limit.enabled
34+
condition: api_external.rate_limit.enabled
35+
- name: redis
36+
alias: api-internal-ratelimit-redis
37+
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
38+
version: 2.2.19
39+
condition: api_internal.rate_limit.enabled
3540
- name: owner-info
3641
repository: oci://keppel.eu-de-1.cloud.sap/ccloud-helm
3742
version: 1.0.0

openstack/cinder/ci/test-values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ cors:
7272
utils:
7373
cors:
7474
allowed_origin: 'https://test.domain'
75+
76+
api-external-ratelimit-redis:
77+
redisPassword: "very-external"
78+
api-internal-ratelimit-redis:
79+
redisPassword: "much-internal"

openstack/cinder/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{- end }}
1111

1212
{{- define "cinder.scheduler_service_dependencies" }}
13-
{{- template "cinder.rabbitmq_service" . }},cinder-api
13+
{{- template "cinder.rabbitmq_service" . }},cinder-api-external
1414
{{- end }}
1515

1616
{{- define "cinder.db_service" }}
Lines changed: 95 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
{{- define "cinder.api.deployment" -}}
2+
{{- $type := index . 1 -}}
3+
{{- $conf := index . 2 -}}
4+
{{- with index . 0 -}}
15
kind: Deployment
26
apiVersion: apps/v1
37

48
metadata:
5-
name: cinder-api
9+
name: cinder-api-{{ $type }}
610
labels:
711
system: openstack
812
type: api
@@ -11,7 +15,7 @@ metadata:
1115
secret.reloader.stakater.com/reload: "{{ .Release.Name }}-secrets"
1216
deployment.reloader.stakater.com/pause-period: "60s"
1317
spec:
14-
replicas: {{ .Values.pod.replicas.api }}
18+
replicas: {{ $conf.replicas }}
1519
revisionHistoryLimit: {{ .Values.pod.lifecycle.upgrades.deployments.revisionHistory }}
1620
strategy:
1721
type: {{ .Values.pod.lifecycle.upgrades.deployments.podReplacementStrategy }}
@@ -22,25 +26,25 @@ spec:
2226
{{ end }}
2327
selector:
2428
matchLabels:
25-
name: cinder-api
29+
name: cinder-api-{{ $type }}
2630
template:
2731
metadata:
2832
labels:
29-
name: cinder-api
30-
{{- tuple . "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | nindent 8 }}
33+
name: cinder-api-{{ $type }}
34+
{{- tuple . "cinder" (printf "api-%s" $type) | include "helm-toolkit.snippets.kubernetes_metadata_labels" | nindent 8 }}
3135
{{- include "utils.topology.pod_label" . | indent 8 }}
3236
annotations:
33-
configmap-etc-hash: {{ include (print $.Template.BasePath "/etc-configmap.yaml") . | sha256sum }}
34-
secrets-hash: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
37+
configmap-etc-hash: {{ include (print .Template.BasePath "/etc-configmap.yaml") . | sha256sum }}
38+
secrets-hash: {{ include (print .Template.BasePath "/secrets.yaml") . | sha256sum }}
3539
{{- if .Values.proxysql.mode }}
3640
prometheus.io/scrape: "true"
3741
prometheus.io/targets: {{ required ".Values.alerts.prometheus missing" .Values.alerts.prometheus | quote }}
3842
{{- end }}
3943
{{- include "utils.linkerd.pod_and_service_annotation" . | indent 8 }}
4044
spec:
41-
{{- tuple . "cinder" "api" | include "kubernetes_pod_anti_affinity" | nindent 6 }}
45+
{{- tuple . "cinder" (printf "api-%s" $type) | include "kubernetes_pod_anti_affinity" | nindent 6 }}
4246
{{- include "utils.proxysql.pod_settings" . | nindent 6 }}
43-
{{- tuple . (dict "name" "cinder-api") | include "utils.topology.constraints" | indent 6 }}
47+
{{- tuple . (dict "name" (printf "cinder-api-%s" $type)) | include "utils.topology.constraints" | indent 6 }}
4448
initContainers:
4549
{{- tuple . (dict "service" (include "cinder.service_dependencies" . ) "jobs" (include "cinder.migration_job_name" .)) | include "utils.snippets.kubernetes_entrypoint_init_container" | indent 6 }}
4650
{{- if .Values.proxysql.native_sidecar }}
@@ -51,7 +55,7 @@ spec:
5155
image: {{required ".Values.global.registry is missing" .Values.global.registry}}/loci-cinder:{{.Values.imageVersionCinderApi | default .Values.imageVersion | required "Please set cinder.imageVersion or similar" }}
5256
imagePullPolicy: {{ required ".Values.global.imagePullPolicy is missing" .Values.global.imagePullPolicy }}
5357
command:
54-
{{- if .Values.api.use_uwsgi }}
58+
{{- if $conf.use_uwsgi }}
5559
- uwsgi
5660
- --ini
5761
- /etc/cinder/api_uwsgi.ini
@@ -70,7 +74,7 @@ spec:
7074
name: sentry
7175
key: {{ .Chart.Name }}.DSN.python
7276
{{- end }}
73-
{{- if .Values.api.use_uwsgi }}
77+
{{- if $conf.use_uwsgi }}
7478
- name: OS_OSLO_MESSAGING_RABBIT__HEARTBEAT_IN_PTHREAD
7579
value: "true"
7680
{{- end }}
@@ -89,64 +93,16 @@ spec:
8993
port: cinder-api
9094
initialDelaySeconds: 15
9195
timeoutSeconds: 5
92-
{{- if .Values.pod.resources.api }}
96+
{{- if $conf.resources }}
9397
resources:
94-
{{ toYaml .Values.pod.resources.api | indent 12 }}
98+
{{- toYaml $conf.resources | nindent 12 }}
9599
{{- end }}
96100
ports:
97101
- name: cinder-api
98102
containerPort: {{.Values.cinderApiPortInternal }}
99103
volumeMounts:
100-
- name: etccinder
101-
mountPath: /etc/cinder
102-
- name: cinder-etc
103-
mountPath: /etc/cinder/cinder.conf
104-
subPath: cinder.conf
105-
readOnly: true
106-
- name: cinder-etc-confd
107-
mountPath: /etc/cinder/cinder.conf.d
108-
- name: cinder-etc
109-
mountPath: /etc/cinder/api-paste.ini
110-
subPath: api-paste.ini
111-
readOnly: true
112-
{{- if .Values.api.use_uwsgi }}
113-
- mountPath: /etc/cinder/api_uwsgi.ini
114-
name: cinder-etc
115-
subPath: api_uwsgi.ini
116-
readOnly: true
117-
{{- end }}
118-
- name: cinder-etc
119-
mountPath: /etc/cinder/policy.yaml
120-
subPath: policy.yaml
121-
readOnly: true
122-
- name: cinder-etc
123-
mountPath: /etc/cinder/logging.ini
124-
subPath: logging.ini
125-
readOnly: true
126-
- name: cinder-etc
127-
mountPath: /etc/cinder/cinder_audit_map.yaml
128-
subPath: cinder_audit_map.yaml
129-
readOnly: true
130-
- name: cinder-etc
131-
mountPath: /etc/cinder/resource_filters.json
132-
subPath: resource_filters.json
133-
readOnly: true
134-
{{- if .Values.api_rate_limit.enabled }}
135-
- name: cinder-etc
136-
mountPath: /etc/cinder/ratelimit.yaml
137-
subPath: ratelimit.yaml
138-
readOnly: true
139-
- name: redis-ratelimit-secret
140-
mountPath: /etc/cinder/ratelimit-backend-secret.conf
141-
subPath: ratelimit-backend-secret.conf
142-
readOnly: true
143-
{{- end }}
144-
{{- if .Values.watcher.enabled }}
145104
- name: cinder-etc
146-
mountPath: /etc/cinder/watcher.yaml
147-
subPath: watcher.yaml
148-
readOnly: true
149-
{{- end }}
105+
mountPath: /etc/cinder
150106
{{- include "utils.proxysql.volume_mount" . | indent 12 }}
151107
{{- include "utils.coordination.volume_mount" . | indent 12 }}
152108
{{- if not .Values.proxysql.native_sidecar }}
@@ -163,27 +119,82 @@ spec:
163119
- name: metrics
164120
containerPort: {{ .Values.port_metrics }}
165121
volumeMounts:
166-
- name: cinder-etc
167-
mountPath: /etc/statsd/statsd-exporter.yaml
168-
subPath: statsd-exporter.yaml
169-
readOnly: true
170-
{{- include "jaeger_agent_sidecar" . | indent 8 }}
122+
- name: statsd-etc
123+
mountPath: /etc/statsd/statsd-exporter.yaml
124+
subPath: statsd-exporter.yaml
125+
readOnly: true
126+
{{- include "jaeger_agent_sidecar" . | indent 8 }}
171127
volumes:
172-
- name: etccinder
173-
emptyDir: {}
174-
- name: cinder-etc
175-
configMap:
176-
name: cinder-etc
177-
- name: cinder-etc-confd
178-
secret:
179-
secretName: {{ .Release.Name }}-secrets
180-
{{- include "utils.proxysql.volumes" . | indent 8 }}
181-
{{- include "utils.coordination.volumes" . | indent 8 }}
182-
183-
{{- if .Values.api_rate_limit.enabled }}
184-
- name: redis-ratelimit-secret
185-
secret:
186-
secretName: cinder-api-ratelimit-secret
187-
{{- end }}
188-
128+
- name: cinder-etc
129+
projected:
130+
sources:
131+
- configMap:
132+
name: cinder-etc
133+
items:
134+
- key: cinder.conf
135+
path: cinder.conf
136+
- key: logging.ini
137+
path: logging.ini
138+
- secret:
139+
name: {{ .Release.Name }}-secrets
140+
items:
141+
- key: secrets.conf
142+
path: cinder.conf.d/secrets.conf
143+
- configMap:
144+
name: cinder-api-{{ $type }}-etc
145+
items:
146+
- key: cinder-api.conf
147+
path: cinder-api.conf
148+
- key: api-paste.ini
149+
path: api-paste.ini
150+
{{- if $conf.use_uwsgi }}
151+
- key: api_uwsgi.ini
152+
path: api_uwsgi.ini
153+
{{- end }}
154+
- key: policy.yaml
155+
path: policy.yaml
156+
- key: resource_filters.json
157+
path: resource_filters.json
158+
{{- if .Values.audit.enabled }}
159+
- key: cinder_audit_map.yaml
160+
path: cinder_audit_map.yaml
161+
{{- end }}
162+
{{- if .Values.watcher.enabled }}
163+
- key: watcher.yaml
164+
path: watcher.yaml
165+
{{- end }}
166+
{{- if $conf.rate_limit.enabled }}
167+
- key: ratelimit.yaml
168+
path: ratelimit.yaml
169+
{{- end }}
170+
{{- if $conf.rate_limit.enabled }}
171+
- secret:
172+
name: cinder-api-{{ $type }}-ratelimit-secret
173+
items:
174+
- key: ratelimit-backend-secret.conf
175+
path: ratelimit-backend-secret.conf
176+
{{- end }}
177+
- name: statsd-etc
178+
projected:
179+
sources:
180+
- configMap:
181+
name: cinder-etc
182+
items:
183+
- key: statsd-exporter.yaml
184+
path: statsd-exporter.yaml
185+
{{- include "utils.proxysql.volumes" . | indent 6 }}
186+
{{- include "utils.coordination.volumes" . | indent 6 }}
187+
{{- end }}
188+
{{- end }}
189189

190+
{{- include "cinder.api.deployment" (tuple . "external" (
191+
dict "replicas" .Values.pod.replicas.api_external
192+
"use_uwsgi" .Values.api_external.use_uwsgi
193+
"resources" .Values.pod.resources.api_external
194+
"rate_limit" .Values.api_external.rate_limit )) }}
195+
---
196+
{{ include "cinder.api.deployment" (tuple . "internal" (
197+
dict "replicas" .Values.pod.replicas.api_internal
198+
"use_uwsgi" .Values.api_internal.use_uwsgi
199+
"resources" .Values.pod.resources.api_internal
200+
"rate_limit" .Values.api_internal.rate_limit )) }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{{- define "cinder.api.etc-configmap" -}}
2+
{{- $type := index . 1 -}}
3+
{{- $conf := index . 2 -}}
4+
{{- with index . 0 -}}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: cinder-api-{{ $type }}-etc
9+
labels:
10+
system: openstack
11+
type: configuration
12+
component: cinder
13+
14+
data:
15+
cinder-api.conf: |
16+
{{ include (print .Template.BasePath "/etc/_cinder-api.conf.tpl") (tuple . $conf) | indent 4 }}
17+
api-paste.ini: |
18+
{{ include (print .Template.BasePath "/etc/_api-paste.ini.tpl") (tuple . $type $conf) | indent 4 }}
19+
{{- if $conf.use_uwsgi }}
20+
api_uwsgi.ini: |
21+
{{ include (print .Template.BasePath "/etc/_api_uwsgi.ini.tpl") $conf | indent 4 }}
22+
{{- end }}
23+
volume.filters: |
24+
{{ include (print .Template.BasePath "/etc/_volume.filters.tpl") . | indent 4 }}
25+
policy.yaml: |
26+
{{ include (print .Template.BasePath "/etc/_cinder-policy.yaml.tpl") . | indent 4 }}
27+
resource_filters.json: |
28+
{{ include (print .Template.BasePath "/etc/_resource_filters.json.tpl") . | indent 4 }}
29+
{{- if .Values.audit.enabled }}
30+
cinder_audit_map.yaml: |
31+
{{ include (print .Template.BasePath "/etc/_cinder_audit_map.yaml.tpl") . | indent 4 }}
32+
{{- end }}
33+
{{- if $conf.rate_limit.enabled }}
34+
ratelimit.yaml: |
35+
{{ include (print .Template.BasePath "/etc/_ratelimit.yaml.tpl") $conf | indent 4 }}
36+
{{- end }}
37+
{{- if .Values.watcher.enabled }}
38+
watcher.yaml: |
39+
{{ include (print .Template.BasePath "/etc/_watcher.yaml.tpl") . | indent 4 }}
40+
{{- end }}
41+
{{- end }}
42+
{{- end }}
43+
44+
{{- include "cinder.api.etc-configmap" (tuple . "external" .Values.api_external) }}
45+
---
46+
{{ include "cinder.api.etc-configmap" (tuple . "internal" .Values.api_internal) }}

openstack/cinder/templates/api-ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1
22
kind: Ingress
33

44
metadata:
5-
name: cinder-api
5+
name: cinder-api-external
66
labels:
77
system: openstack
88
type: api
@@ -25,6 +25,6 @@ spec:
2525
pathType: Prefix
2626
backend:
2727
service:
28-
name: cinder-api
28+
name: cinder-api-external
2929
port:
3030
number: {{.Values.cinderApiPortInternal}}

0 commit comments

Comments
 (0)