Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Commit 92138b3

Browse files
authored
Merge pull request #273 from portdirect/0.2.0/job-refactor-nova
feat: Update Nova Keystone Jobs to match common architecture
2 parents e7f5b64 + 661de5b commit 92138b3

File tree

9 files changed

+256
-120
lines changed

9 files changed

+256
-120
lines changed

nova/templates/bin/_post.sh.tpl

Lines changed: 0 additions & 71 deletions
This file was deleted.

nova/templates/configmap-bin.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ metadata:
1919
data:
2020
db-sync.sh: |
2121
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
22+
ks-service.sh: |+
23+
{{- include "helm-toolkit.keystone_service" . | indent 4 }}
24+
ks-endpoints.sh: |+
25+
{{- include "helm-toolkit.keystone_endpoints" . | indent 4 }}
26+
ks-user.sh: |+
27+
{{- include "helm-toolkit.keystone_user" . | indent 4 }}
2228
init.sh: |
2329
{{ tuple "bin/_init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
24-
post.sh: |
25-
{{ tuple "bin/_post.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
2630
libvirt.sh: |
2731
{{ tuple "bin/_libvirt.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}

nova/templates/job-db-init.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
{{- $envAll := . }}
16-
{{- $dependencies := .Values.dependencies.init }}
16+
{{- $dependencies := .Values.dependencies.db_init }}
1717
apiVersion: batch/v1
1818
kind: Job
1919
metadata:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
{{- $envAll := . }}
16+
{{- $ksAdminSecret := $envAll.Values.keystone.admin_secret | default "nova-env-keystone-admin" }}
17+
{{- $dependencies := .Values.dependencies.ks_endpoints }}
18+
apiVersion: batch/v1
19+
kind: Job
20+
metadata:
21+
name: nova-ks-endpoints
22+
spec:
23+
template:
24+
metadata:
25+
annotations:
26+
pod.beta.kubernetes.io/init-containers: '[
27+
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
28+
]'
29+
spec:
30+
restartPolicy: OnFailure
31+
nodeSelector:
32+
{{ .Values.labels.control_node_selector_key }}: {{ .Values.labels.control_node_selector_value }}
33+
containers:
34+
{{- range $key1, $osServiceType := tuple "compute" }}
35+
{{- range $key2, $osServiceEndPoint := tuple "admin" "internal" "public" }}
36+
- name: {{ $osServiceType }}-ks-endpoints-{{ $osServiceEndPoint }}
37+
image: {{ $envAll.Values.images.ks_endpoints }}
38+
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
39+
{{- if $envAll.Values.resources.enabled }}
40+
resources:
41+
requests:
42+
memory: {{ $envAll.Values.resources.nova_ks_endpoints.requests.memory | quote }}
43+
cpu: {{ $envAll.Values.resources.nova_ks_endpoints.requests.cpu | quote }}
44+
limits:
45+
memory: {{ $envAll.Values.resources.nova_ks_endpoints.limits.memory | quote }}
46+
cpu: {{ $envAll.Values.resources.nova_ks_endpoints.limits.cpu | quote }}
47+
{{- end }}
48+
command:
49+
- bash
50+
- /tmp/ks-endpoints.sh
51+
volumeMounts:
52+
- name: ks-endpoints-sh
53+
mountPath: /tmp/ks-endpoints.sh
54+
subPath: ks-endpoints.sh
55+
readOnly: true
56+
env:
57+
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
58+
{{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
59+
{{- end }}
60+
- name: OS_SVC_ENDPOINT
61+
value: {{ $osServiceEndPoint }}
62+
- name: OS_SERVICE_NAME
63+
value: {{ tuple $osServiceType $envAll | include "helm-toolkit.keystone_endpoint_name_lookup" }}
64+
- name: OS_SERVICE_TYPE
65+
value: {{ $osServiceType }}
66+
- name: OS_SERVICE_ENDPOINT
67+
value: {{ tuple $osServiceType $osServiceEndPoint "api" $envAll | include "helm-toolkit.keystone_endpoint_uri_lookup" }}
68+
{{- end }}
69+
{{- end }}
70+
volumes:
71+
- name: ks-endpoints-sh
72+
configMap:
73+
name: nova-bin

nova/templates/job-ks-service.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
{{- $envAll := . }}
16+
{{- $ksAdminSecret := .Values.keystone.admin_secret | default "nova-env-keystone-admin" }}
17+
{{- $dependencies := .Values.dependencies.ks_service }}
18+
apiVersion: batch/v1
19+
kind: Job
20+
metadata:
21+
name: nova-ks-service
22+
spec:
23+
template:
24+
metadata:
25+
annotations:
26+
pod.beta.kubernetes.io/init-containers: '[
27+
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
28+
]'
29+
spec:
30+
restartPolicy: OnFailure
31+
nodeSelector:
32+
{{ .Values.labels.control_node_selector_key }}: {{ .Values.labels.control_node_selector_value }}
33+
containers:
34+
{{- range $key1, $osServiceType := tuple "compute" }}
35+
- name: {{ $osServiceType }}-ks-service-registration
36+
image: {{ $envAll.Values.images.ks_service }}
37+
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
38+
{{- if $envAll.Values.resources.enabled }}
39+
resources:
40+
requests:
41+
memory: {{ $envAll.Values.resources.nova_ks_service.requests.memory | quote }}
42+
cpu: {{ $envAll.Values.resources.nova_ks_service.requests.cpu | quote }}
43+
limits:
44+
memory: {{ $envAll.Values.resources.nova_ks_service.limits.memory | quote }}
45+
cpu: {{ $envAll.Values.resources.nova_ks_service.limits.cpu | quote }}
46+
{{- end }}
47+
command:
48+
- bash
49+
- /tmp/ks-service.sh
50+
volumeMounts:
51+
- name: ks-service-sh
52+
mountPath: /tmp/ks-service.sh
53+
subPath: ks-service.sh
54+
readOnly: true
55+
env:
56+
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
57+
{{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
58+
{{- end }}
59+
- name: OS_SERVICE_NAME
60+
value: {{ tuple $osServiceType $envAll | include "helm-toolkit.keystone_endpoint_name_lookup" }}
61+
- name: OS_SERVICE_TYPE
62+
value: {{ $osServiceType }}
63+
{{- end }}
64+
volumes:
65+
- name: ks-service-sh
66+
configMap:
67+
name: nova-bin
Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
{{- $ksAdminSecret := .Values.keystone.admin_secret | default "nova-env-keystone-admin" }}
16+
{{- $ksUserSecret := .Values.keystone.user_secret | default "nova-env-keystone-user" }}
1517
{{- $envAll := . }}
16-
{{- $dependencies := .Values.dependencies.post }}
18+
{{- $dependencies := .Values.dependencies.ks_user }}
1719
apiVersion: batch/v1
1820
kind: Job
1921
metadata:
20-
name: nova-post
22+
name: nova-ks-user
2123
spec:
2224
template:
2325
metadata:
@@ -30,35 +32,38 @@ spec:
3032
nodeSelector:
3133
{{ .Values.labels.control_node_selector_key }}: {{ .Values.labels.control_node_selector_value }}
3234
containers:
33-
- name: nova-post
34-
image: {{ .Values.images.post }}
35+
- name: nova-ks-user
36+
image: {{ .Values.images.ks_user }}
3537
imagePullPolicy: {{ .Values.images.pull_policy }}
3638
{{- if .Values.resources.enabled }}
3739
resources:
3840
requests:
39-
memory: {{ .Values.resources.nova_post.requests.memory | quote }}
40-
cpu: {{ .Values.resources.nova_post.requests.cpu | quote }}
41+
memory: {{ .Values.resources.nova_ks_user.requests.memory | quote }}
42+
cpu: {{ .Values.resources.nova_ks_user.requests.cpu | quote }}
4143
limits:
42-
memory: {{ .Values.resources.nova_post.limits.memory | quote }}
43-
cpu: {{ .Values.resources.nova_post.limits.cpu | quote }}
44+
memory: {{ .Values.resources.nova_ks_user.limits.memory | quote }}
45+
cpu: {{ .Values.resources.nova_ks_user.limits.cpu | quote }}
4446
{{- end }}
4547
command:
4648
- bash
47-
- /tmp/post.sh
48-
env:
49-
- name: ANSIBLE_LIBRARY
50-
value: /usr/share/ansible/
49+
- /tmp/ks-user.sh
5150
volumeMounts:
52-
- name: novaconf
53-
mountPath: /etc/nova/nova.conf
54-
subPath: nova.conf
55-
- name: nova-bin
56-
mountPath: /tmp/post.sh
57-
subPath: post.sh
51+
- name: ks-user-sh
52+
mountPath: /tmp/ks-user.sh
53+
subPath: ks-user.sh
54+
readOnly: true
55+
env:
56+
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
57+
{{- include "helm-toolkit.keystone_openrc_env_vars" $env | indent 12 }}
58+
{{- end }}
59+
- name: SERVICE_OS_SERVICE_NAME
60+
value: "nova"
61+
{{- with $env := dict "ksUserSecret" $ksUserSecret }}
62+
{{- include "helm-toolkit.keystone_user_create_env_vars" $env | indent 12 }}
63+
{{- end }}
64+
- name: SERVICE_OS_ROLE
65+
value: {{ .Values.keystone.nova_user_role | quote }}
5866
volumes:
59-
- name: novaconf
60-
configMap:
61-
name: nova-etc
62-
- name: nova-bin
67+
- name: ks-user-sh
6368
configMap:
6469
name: nova-bin
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: Secret
17+
metadata:
18+
name: nova-env-keystone-admin
19+
type: Opaque
20+
data:
21+
OS_AUTH_URL: |
22+
{{ tuple "identity" "admin" "admin" . | include "helm-toolkit.keystone_endpoint_uri_lookup" | b64enc | indent 4 }}
23+
OS_REGION_NAME: |
24+
{{ .Values.keystone.admin_region_name | b64enc | indent 4 }}
25+
OS_PROJECT_DOMAIN_NAME: |
26+
{{ .Values.keystone.admin_project_domain | b64enc | indent 4 }}
27+
OS_PROJECT_NAME: |
28+
{{ .Values.keystone.admin_project_name | b64enc | indent 4 }}
29+
OS_USER_DOMAIN_NAME: |
30+
{{ .Values.keystone.admin_user_domain | b64enc | indent 4 }}
31+
OS_USERNAME: |
32+
{{ .Values.keystone.admin_user | b64enc | indent 4 }}
33+
OS_PASSWORD: |
34+
{{ .Values.keystone.admin_password | b64enc | indent 4 }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2017 The Openstack-Helm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: Secret
17+
metadata:
18+
name: nova-env-keystone-user
19+
type: Opaque
20+
data:
21+
OS_AUTH_URL: |
22+
{{ tuple "identity" "internal" "api" . | include "helm-toolkit.keystone_endpoint_uri_lookup" | b64enc | indent 4 }}
23+
OS_REGION_NAME: |
24+
{{ .Values.keystone.nova_region_name | b64enc | indent 4 }}
25+
OS_PROJECT_DOMAIN_NAME: |
26+
{{ .Values.keystone.nova_project_domain | b64enc | indent 4 }}
27+
OS_PROJECT_NAME: |
28+
{{ .Values.keystone.nova_project_name | b64enc | indent 4 }}
29+
OS_USER_DOMAIN_NAME: |
30+
{{ .Values.keystone.nova_user_domain | b64enc | indent 4 }}
31+
OS_USERNAME: |
32+
{{ .Values.keystone.nova_user | b64enc | indent 4 }}
33+
OS_PASSWORD: |
34+
{{ .Values.keystone.nova_password | b64enc | indent 4 }}

0 commit comments

Comments
 (0)