[Glance] add job-metadefs-load

Glance provide default list of metadata definitions in /etc/glance/metadefs
directory. The patch adds job that will load those defaults definitions.
The job is enabled by default.

Change-Id: Ib3ab20a9a7f73b568b029b06101cf4e5e2473716
This commit is contained in:
Vasyl Saienko 2019-09-04 10:22:49 +00:00
parent b4d673a90e
commit 6571c9e208
4 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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.
*/}}
glance-manage --config-file /etc/glance/glance-api.conf db_load_metadefs /var/lib/openstack/etc/glance/metadefs

View File

@ -35,6 +35,8 @@ data:
{{ tuple $rallyTests | include "helm-toolkit.scripts.rally_test" | indent 4 }}
storage-init.sh: |
{{ tuple "bin/_storage-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
metadefs-load.sh: |
{{ tuple "bin/_metadefs-load.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
db-init.py: |
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-sync.sh: |

View File

@ -0,0 +1,85 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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.
*/}}
{{- if .Values.manifests.job_metadefs_load }}
{{- $envAll := . }}
{{- $serviceAccountName := "glance-metadefs-load" }}
{{ tuple $envAll "metadefs_load" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: glance-metadefs-load
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
template:
metadata:
labels:
{{ tuple $envAll "glance" "metadefs_load" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "glance" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers:
{{ tuple $envAll "metadefs_load" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: glance-metadefs-load
{{ tuple $envAll "glance_metadefs_load" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.metadefs_load | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command:
- /tmp/metadefs-load.sh
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: glance-bin
mountPath: /tmp/metadefs-load.sh
subPath: metadefs-load.sh
readOnly: true
- name: etcglance
mountPath: /etc/glance
- name: glance-etc
mountPath: /etc/glance/glance-api.conf
subPath: glance-api.conf
readOnly: true
{{- if .Values.conf.glance.DEFAULT.log_config_append }}
- name: glance-etc
mountPath: {{ .Values.conf.glance.DEFAULT.log_config_append }}
subPath: {{ base .Values.conf.glance.DEFAULT.log_config_append }}
readOnly: true
{{- end }}
volumes:
- name: pod-tmp
emptyDir: {}
- name: glance-bin
configMap:
name: glance-bin
defaultMode: 0555
- name: etcglance
emptyDir: {}
- name: glance-etc
secret:
secretName: glance-etc
defaultMode: 0444
{{- end }}

View File

@ -40,6 +40,7 @@ images:
tags:
test: docker.io/xrally/xrally-openstack:1.3.0
glance_storage_init: docker.io/port/ceph-config-helper:v1.10.3
glance_metadefs_load: docker.io/openstackhelm/glance:ocata-ubuntu_xenial
db_init: docker.io/openstackhelm/heat:ocata-ubuntu_xenial
glance_db_sync: docker.io/openstackhelm/glance:ocata-ubuntu_xenial
db_drop: docker.io/openstackhelm/heat:ocata-ubuntu_xenial
@ -563,6 +564,10 @@ dependencies:
jobs:
- glance-ks-user
services: null
metadefs_load:
jobs:
- glance-db-sync
services: null
tests:
services:
- endpoint: internal
@ -927,6 +932,13 @@ pod:
limits:
memory: "1024Mi"
cpu: "2000m"
metadefs_load:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
db_sync:
requests:
memory: "128Mi"
@ -1015,6 +1027,7 @@ manifests:
job_ks_service: true
job_ks_user: true
job_storage_init: true
job_metadefs_load: true
job_rabbit_init: true
pdb_api: true
pdb_registry: false