Skip to content

Commit

Permalink
Configuration Management Overrides for Cinder
Browse files Browse the repository at this point in the history
This commit is based on how Nova got its configuration overrides
implemented.

An important thing here is support for setting multiple Cinder backends
(e.g. Ceph cluster + NFS) in the values.yaml (fixes att-comdev#321).
  • Loading branch information
Michał Dulko committed Apr 10, 2017
1 parent 04a215e commit e729cf2
Show file tree
Hide file tree
Showing 9 changed files with 5,884 additions and 100 deletions.
2 changes: 2 additions & 0 deletions cinder/templates/configmap-bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{ tuple .Values.conf.cinder . | include "helm-toolkit.oslo_values_setup" | trunc 0 }}

apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
48 changes: 48 additions & 0 deletions cinder/templates/configmap-etc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- include "cinder.conf.cinder_values_skeleton" .Values.conf.cinder | trunc 0 -}}

{{- if empty .Values.conf.cinder.keystone_authtoken.keystonemiddleware.auth_token.auth_uri -}}
{{- tuple "identity" "internal" "api" . | include "helm-toolkit.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.keystone_authtoken.keystonemiddleware.auth_token "auth_uri" | quote | trunc 0 -}}
{{- end -}}

# FIXME(dulek) fix for broken keystonemiddleware oslo config gen in newton - will remove in future
{{- if empty .Values.conf.cinder.keystone_authtoken.keystonemiddleware.auth_token.auth_url -}}
{{- tuple "identity" "internal" "api" . | include "helm-toolkit.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.keystone_authtoken.keystonemiddleware.auth_token "auth_url" | quote | trunc 0 -}}
{{- end -}}

{{- if empty .Values.conf.cinder.database.oslo.db.connection -}}
{{- tuple "oslo_db" "internal" "user" "mysql" . | include "helm-toolkit.authenticated_endpoint_uri_lookup"| set .Values.conf.cinder.database.oslo.db "connection" | quote | trunc 0 -}}
{{- end -}}

{{- if empty .Values.conf.cinder.default.oslo.messaging.transport_url -}}
{{- tuple "oslo_messaging" "internal" "user" "amqp" . | include "helm-toolkit.authenticated_endpoint_uri_lookup" | set .Values.conf.cinder.default.oslo.messaging "transport_url" | quote | trunc 0 -}}
{{- end -}}

{{- if empty .Values.conf.cinder.default.cinder.glance_api_servers -}}
{{- tuple "image" "internal" "api" . | include "helm-toolkit.keystone_endpoint_uri_lookup"| set .Values.conf.cinder.default.cinder "glance_api_servers" | quote | trunc 0 -}}
{{- end -}}

apiVersion: v1
kind: ConfigMap
metadata:
name: cinder-etc
data:
cinder.conf: |+
{{ if .Values.conf.cinder.override -}}
{{ .Values.conf.cinder.override }}
{{- else -}}
{{- if .Values.conf.cinder.prefix -}}
{{ .Values.conf.cinder.prefix }}
{{- end }}
{{ tuple "etc/_cinder.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{- end }}
{{- if .Values.conf.cinder.append -}}
{{ .Values.conf.cinder.append }}
{{- end }}
api-paste.ini: |+
{{ if .Values.conf.paste.override -}}
{{ .Values.conf.paste.override }}
{{- else -}}
{{- if .Values.conf.paste.prefix -}}
{{ .Values.conf.paste.prefix }}
{{- end }}
{{ tuple "etc/_cinder-api-paste.ini.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{- end }}
{{- if .Values.conf.paste.append -}}
{{ .Values.conf.paste.append }}
{{- end }}
policy.json: |+
{{ if .Values.conf.policy.override -}}
{{ .Values.conf.policy.override }}
{{- else -}}
{{ tuple "etc/_policy.json.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{- end }}
# TODO(dulek): Get this done correctly.
ceph.conf: |+
{{ tuple "etc/_ceph.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
ceph.client.{{ .Values.ceph.cinder_user }}.keyring: |+
Expand Down
12 changes: 8 additions & 4 deletions cinder/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.api }}
{{- $mounts_cinder_api := .Values.mounts.cinder_api.cinder_api }}
{{- $mounts_cinder_api_init := .Values.mounts.cinder_api.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,7 +38,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_api_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
Expand All @@ -60,10 +62,10 @@ spec:
- /etc/cinder/conf
ports:
- name: c-api
containerPort: {{ .Values.network.api.port }}
containerPort: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }}
readinessProbe:
tcpSocket:
port: {{ .Values.network.api.port }}
port: {{ .Values.conf.cinder.default.cinder.osapi_volume_listen_port }}
volumeMounts:
- name: pod-etc-cinder
mountPath: /etc/cinder
Expand All @@ -81,6 +83,7 @@ spec:
mountPath: /etc/cinder/policy.json
subPath: policy.json
readOnly: true
{{ if $mounts_cinder_api.volumeMounts }}{{ toYaml $mounts_cinder_api.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
Expand All @@ -95,3 +98,4 @@ spec:
- name: cinderpolicy
configMap:
name: cinder-etc
{{ if $mounts_cinder_api.volumes }}{{ toYaml $mounts_cinder_api.volumes | indent 8 }}{{ end }}
8 changes: 6 additions & 2 deletions cinder/templates/deployment-scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.scheduler }}
{{- $mounts_cinder_scheduler := .Values.mounts.cinder_scheduler.cinder_scheduler }}
{{- $mounts_cinder_scheduler_init := .Values.mounts.cinder_scheduler.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,7 +38,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_scheduler_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
Expand Down Expand Up @@ -75,6 +77,7 @@ spec:
mountPath: /etc/cinder/policy.json
subPath: policy.json
readOnly: true
{{ if $mounts_cinder_scheduler.volumeMounts }}{{ toYaml $mounts_cinder_scheduler.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
Expand All @@ -89,3 +92,4 @@ spec:
- name: cinderpolicy
configMap:
name: cinder-etc
{{ if $mounts_cinder_scheduler.volumes }}{{ toYaml $mounts_cinder_scheduler.volumes | indent 8 }}{{ end }}
8 changes: 6 additions & 2 deletions cinder/templates/deployment-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.volume }}
{{- $mounts_cinder_volume := .Values.mounts.cinder_volume.cinder_volume }}
{{- $mounts_cinder_volume_init := .Values.mounts.cinder_volume.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,7 +38,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_volume_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
Expand Down Expand Up @@ -75,6 +77,7 @@ spec:
mountPath: /etc/ceph/ceph.client.{{ .Values.ceph.cinder_user }}.keyring
subPath: ceph.client.{{ .Values.ceph.cinder_user }}.keyring
readOnly: true
{{ if $mounts_cinder_volume.volumeMounts }}{{ toYaml $mounts_cinder_volume.volumeMounts | indent 12 }} {{ end }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
Expand All @@ -89,3 +92,4 @@ spec:
- name: cephclientcinderkeyring
configMap:
name: cinder-etc
{{ if $mounts_cinder_volume.volumes }}{{ toYaml $mounts_cinder_volume.volumes | indent 8 }}{{ end }}
Loading

0 comments on commit e729cf2

Please sign in to comment.