158 lines
6.4 KiB
YAML
158 lines
6.4 KiB
YAML
{{- $searchPath := ":global.kolla.nova.api.create_cell.job:global.kolla.nova.api.create_cell.all:global.kolla.nova.api.all:global.kolla.nova.all:global.kolla.all" }}
|
|
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c "contName" "nova-api" }}
|
|
{{- $_ := set $c "imageName" "image_full" }}
|
|
{{- $_ := set $c "tagName" "image_tag" }}
|
|
{{- $imageFull := include "kolla_build_image_full" $c }}
|
|
{{- $resourceName := "nova-api" }}
|
|
{{- $serviceName := "nova-api" }}
|
|
{{- $podTypeBootstrap := true }}
|
|
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $selectorKey := include "kolla_val_get_str" (dict "key" "selector_key" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }}
|
|
{{- $keystoneSearchPath := ":global.kolla.keystone.all:global.kolla.all" }}
|
|
{{- $keystonePort := include "kolla_val_get_str" (dict "key" "port" "searchPath" $keystoneSearchPath "Values" .Values ) }}
|
|
{{- $elementName := include "kolla_val_get_str" (dict "key" "element_name" "searchPath" $keystoneSearchPath "Values" .Values ) | default "keystone" }}
|
|
{{- $keystoneURL := printf "%s-internal" $elementName }}
|
|
{{- $localVals := dict }}
|
|
{{- $c1 := dict "key" "cell_wait_compute" "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c1 "retDict" $localVals }}
|
|
{{- $_ := set $c1 "retKey" "cell_wait_compute" }}
|
|
{{- $_ := include "kolla_val_get_raw" $c1 }}
|
|
{{- $c2 := dict "key" "cell_wait_compute_sleep" "searchPath" $searchPath "Values" .Values }}
|
|
{{- $_ := set $c2 "retDict" $localVals }}
|
|
{{- $_ := set $c2 "retKey" "cell_wait_compute_sleep" }}
|
|
{{- $_ := include "kolla_val_get_raw" $c2 }}
|
|
{{- with $env := dict "resourceName" $resourceName "serviceName" $serviceName "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "Values" .Values "Release" .Release "searchPath" $searchPath }}
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: "{{ .resourceName }}-create-cell"
|
|
spec:
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
pod.beta.kubernetes.io/init-containers: '[
|
|
{{- include "common_dependency_container_multi" $env | indent 10 }}
|
|
{
|
|
"name": "initialize-cell-api-logs",
|
|
"image": "{{ $imageFull }}",
|
|
"imagePullPolicy": "{{ $imagePullPolicy }}",
|
|
"command": [
|
|
"sh",
|
|
"-ce",
|
|
"mkdir /var/log/kolla/nova;
|
|
chown -R nova: /var/log/kolla/nova;
|
|
chmod 755 /var/log/kolla/nova; "],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "kolla-logs",
|
|
"mountPath": "/var/log/kolla"
|
|
}
|
|
]
|
|
}{{- if $localVals.cell_wait_compute }},
|
|
{
|
|
"name": "wait-for-nova-compute-up",
|
|
"image": {{ include "kolla_toolbox_image_full" . | quote }},
|
|
"imagePullPolicy": "{{ $imagePullPolicy }}",
|
|
"env": [
|
|
{
|
|
"name": "OS_PASSWORD",
|
|
"valueFrom":
|
|
{
|
|
"secretKeyRef":
|
|
{
|
|
"name": "keystone-admin-password",
|
|
"key": "password"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "OS_AUTH_URL",
|
|
"value": "http://{{ $keystoneURL }}:{{ $keystonePort }}/v3"
|
|
},
|
|
{
|
|
"name": "OS_PROJECT_NAME",
|
|
"value": "admin"
|
|
},
|
|
{
|
|
"name": "OS_USER_DOMAIN_NAME",
|
|
"value": "Default"
|
|
},
|
|
{
|
|
"name": "OS_USERNAME",
|
|
"value": "admin"
|
|
},
|
|
{
|
|
"name": "OS_PROJECT_DOMAIN_NAME",
|
|
"value": "Default"
|
|
},
|
|
{
|
|
"name": "OS_IDENTITY_API_VERSION",
|
|
"value": "3"
|
|
},
|
|
{
|
|
"name": "OS_REGION_NAME",
|
|
"value": "RegionOne"
|
|
}
|
|
],
|
|
"command": [
|
|
"sh",
|
|
"-ce",
|
|
"touch /tmp/not_found;
|
|
while [[ -f /tmp/not_found ]]; do
|
|
openstack hypervisor list -f value -c State | while read compute_state; do
|
|
if [ ''x''$compute_state == ''xup'' ]; then
|
|
echo ''Detected at least one compute node in UP state. Exiting...'';
|
|
rm -f /tmp/not_found;
|
|
fi;
|
|
done;
|
|
sleep {{ $localVals.cell_wait_compute_sleep }};
|
|
done;
|
|
"],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "kolla-logs",
|
|
"mountPath": "/var/log/kolla"
|
|
}
|
|
]
|
|
}
|
|
{{- end }}
|
|
]'
|
|
spec:
|
|
nodeSelector:
|
|
{{ $selectorKey }}: {{ $selectorValue | quote }}
|
|
restartPolicy: OnFailure
|
|
containers:
|
|
- image: {{ $imageFull | quote }}
|
|
imagePullPolicy: {{ $imagePullPolicy | quote }}
|
|
name: "main"
|
|
securityContext:
|
|
runAsUser: 0
|
|
volumeMounts:
|
|
{{ include "common_volume_mounts" . | indent 12 }}
|
|
- mountPath: {{ $containerConfigDirectory }}
|
|
name: service-configmap
|
|
readOnly: true
|
|
env:
|
|
- name: KOLLA_KUBERNETES
|
|
value: ""
|
|
- name: KOLLA_BOOTSTRAP
|
|
value: ""
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: "COPY_ONCE"
|
|
command: [
|
|
"bash",
|
|
"-ce",
|
|
"if [ ! -d /etc/nova ]; then mkdir /etc/nova; fi;
|
|
/bin/cp -aLf {{ $containerConfigDirectory }}/..data/nova.conf /etc/nova/nova.conf;
|
|
nova-manage cell_v2 simple_cell_setup;
|
|
"]
|
|
volumes:
|
|
{{- include "common_volumes" . | indent 8 }}
|
|
- name: service-configmap
|
|
configMap:
|
|
name: {{ .serviceName }}
|
|
{{- end }}
|