Update init containers

Previously Kubernetes only supported init containers stored
in json encoded annotations. This PS switches them all to
use the native initContainer yaml section now.

Change-Id: Ib8d7a4581baa01173d420570468687679f433e08
This commit is contained in:
Kevin Fox 2017-09-19 16:45:30 -07:00
parent 459faa6ffd
commit 9ca5ae155c
49 changed files with 1083 additions and 1569 deletions

View File

@ -33,6 +33,11 @@ spec:
terminationGracePeriodSeconds: {{ $gracePeriodSeconds }}
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
{{- if .initContainers }}
{{- include .initContainers . | indent 8 }}
{{- end }}
containers:
- name: main
image: {{ .imageFull | quote }}

View File

@ -39,55 +39,49 @@ spec:
"prometheus.io/scrape": "true"
{{- end }}
{{- end }}
#FIXME Once out of alpha, this should be converted to yaml.
#FIXME once all services are converted, bind_host can be dropped here and changed to default to 127.0.0.1 instead of 0.0.0.0.
# The init container overrides the listen address and port to ensure it does not conflict with haproxy and prevent
# other containers from directly accessing the service
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" . | indent 10 }}
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if eq .resourceName "kibana" }}
IP=\"127.0.0.1\";
PORT=\"8080\";
sed -i ''s|^elasticsearch.url:.*|elasticsearch.url: \"http://elasticsearch:9200\"|g'' /srv/pod-main-config/kibana.yml;
sed -i ''s|^server.host:.*|server.host: \"''$IP''\"|g'' /srv/pod-main-config/kibana.yml;
sed -i ''s|^server.port:.*|server.port: \"''$PORT''\"|g'' /srv/pod-main-config/kibana.yml;
{{- else }}
CONF=/srv/pod-main-config/{{ .configFileName }};
{{- if $localVals.haproxy }}
{{- if eq .resourceName "nova-api" }}
crudini --set $CONF DEFAULT metadata_listen 127.0.0.1;
crudini --set $CONF DEFAULT metadata_listen_port 8081;
{{- end }}
crudini --set $CONF {{ .configSectionName }} {{ .configListenHostParameter }} 127.0.0.1;
crudini --set $CONF {{ .configSectionName }} {{ .configListenPortParameter }} 8080;
{{- end }}
{{- end }}
"],
"volumeMounts": [
{
"name": "service-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
#You've got 2 days to drain or figure out why it won't.
terminationGracePeriodSeconds: {{ $gracePeriodSeconds }}
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
#FIXME once all services are converted, bind_host can be dropped here and changed to default to 127.0.0.1 instead of 0.0.0.0.
# The init container overrides the listen address and port to ensure it does not conflict with haproxy and prevent
# other containers from directly accessing the service
{{- include "common_dependency_container" . | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if eq .resourceName "kibana" }}
IP=\"127.0.0.1\";
PORT=\"8080\";
sed -i 's|^elasticsearch.url:.*|elasticsearch.url: \"http://elasticsearch:9200\"|g' /srv/pod-main-config/kibana.yml;
sed -i 's|^server.host:.*|server.host: \"'$IP'\"|g' /srv/pod-main-config/kibana.yml;
sed -i 's|^server.port:.*|server.port: \"'$PORT'\"|g' /srv/pod-main-config/kibana.yml;
{{- else }}
CONF=/srv/pod-main-config/{{ .configFileName }};
{{- if $localVals.haproxy }}
{{- if eq .resourceName "nova-api" }}
crudini --set $CONF DEFAULT metadata_listen 127.0.0.1;
crudini --set $CONF DEFAULT metadata_listen_port 8081;
{{- end }}
crudini --set $CONF {{ .configSectionName }} {{ .configListenHostParameter }} 127.0.0.1;
crudini --set $CONF {{ .configSectionName }} {{ .configListenPortParameter }} 8080;
{{- end }}
{{- end }}
volumeMounts:
- name: service-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
{{- if .initContainers }}
{{- include .initContainers . | indent 8 }}
{{- end }}
containers:
{{- if $localVals.haproxy }}
- name: haproxy

View File

@ -14,13 +14,12 @@ metadata:
name: "{{ .resourceName }}-create-db"
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 2 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
restartPolicy: OnFailure
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -22,12 +22,11 @@ spec:
parallelism: 1
completions: 1
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -22,12 +22,11 @@ spec:
parallelism: 1
completions: 1
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -21,12 +21,11 @@ spec:
parallelism: 1
completions: 1
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -14,13 +14,12 @@ metadata:
name: "{{ .resourceName }}-delete-db"
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 2 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
restartPolicy: OnFailure
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -22,12 +22,11 @@ spec:
parallelism: 1
completions: 1
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -21,12 +21,11 @@ spec:
parallelism: 1
completions: 1
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -3,13 +3,7 @@
{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}}
{{- end -}}
{{- define "init_container_header" }}
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- end }}
{{- define "common_dependency_container_common" }}
{{- define "common_dependency_container" }}
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" .searchPath "Values" .Values ) }}
{{- $localVals := dict }}
{{- $c1 := dict "searchPath" .searchPath "Values" .Values }}
@ -23,60 +17,23 @@ metadata:
{{- $_ := set $c2 "retKey" "dependencies" }}
{{- $_ := include "kolla_val_get_raw" $c2 }}
{{- if $localVals.kubernetes_entrypoint }}
{
"name": "dependencies",
"image": {{ include "kubernetes_entrypoint_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
- name: dependencies
image: {{ include "kubernetes_entrypoint_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
{{- if .extraDepVolumeMounts }}
"volumeMounts": [
{{- include .extraDepVolumeMounts . | indent 6 }}
],
volumeMounts:
{{- include .extraDepVolumeMounts . | indent 4 }}
{{- end }}
"env": [
env:
{{- if .depsOverride }}
{{- include "depsOverride" . }}
{{- include "depsOverride" . | indent 6 }}
{{- else }}
{{- range $k, $v := $localVals.dependencies }}
{
"name": {{ printf "dependency_%s" $k | upper | quote }},
"value": {{ include "joinListWithColon" $v | quote }}
},
- name: {{ printf "dependency_%s" $k | upper | quote }}
value: {{ include "joinListWithColon" $v | quote }}
{{- end }}
{{- end }}
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
}
]
- name: NAMESPACE
value: {{ .Release.Namespace | quote }}
{{- end }}
{{- end }}
{{- define "common_dependency_container_single" }}
{{- $localVals := dict }}
{{- $c1 := dict "searchPath" .searchPath "Values" .Values }}
{{- $_ := set $c1 "key" "kubernetes_entrypoint" }}
{{- $_ := set $c1 "retDict" $localVals }}
{{- $_ := set $c1 "retKey" "kubernetes_entrypoint" }}
{{- $_ := include "kolla_val_get_raw" $c1 }}
{{- include "common_dependency_container_common" . }}
{{- if $localVals.kubernetes_entrypoint }}
}
{{- end }}
{{- end }}
{{- define "common_dependency_container_multi" }}
{{- $localVals := dict }}
{{- $c1 := dict "searchPath" .searchPath "Values" .Values }}
{{- $_ := set $c1 "key" "kubernetes_entrypoint" }}
{{- $_ := set $c1 "retDict" $localVals }}
{{- $_ := set $c1 "retKey" "kubernetes_entrypoint" }}
{{- $_ := include "kolla_val_get_raw" $c1 }}
{{- include "common_dependency_container_common" . }}
{{- if $localVals.kubernetes_entrypoint }}
},
{{- end }}
{{- end }}
{{- define "init_container_tail" }}
]'
{{- end }}

View File

@ -9,13 +9,12 @@ metadata:
name: "{{ .resourceName }}-manage-db"
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
restartPolicy: OnFailure
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ .imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -14,32 +14,23 @@ spec:
labels:
service: {{ .serviceName }}
type: {{ .serviceType }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" . | indent 10 }}
{
"name": "initialize-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-ce",
"cp -a /config/..data/* /podconfig/; "],
"volumeMounts": [
{
"name": "service-config",
"mountPath": "/config/"
},
{
"name": "pod-config",
"mountPath": "/podconfig/"
}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
- name: initialize-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -ce
- cp -a /config/..data/* /podconfig/;
volumeMounts:
- name: service-config
mountPath: /config/
- name: pod-config
mountPath: /podconfig/
containers:
- name: main
image: "{{ .imageFull }}"

View File

@ -29,46 +29,33 @@ spec:
labels:
service: {{ $elementName }}
type: {{ $serviceType }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-cinder-volume",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"command": [
"sh",
"-ce",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/; "],
"volumeMounts": [
{
"name": "cinder-backup-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "initialize-cinder-logs",
"image": "{{ $imageFull }}",
"command": [
"sh",
"-ce",
"mkdir /var/log/kolla/cinder ;
chown -R cinder: /var/log/kolla/cinder "],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-cinder-volume
image: {{ include "kolla_toolbox_image_full" . | quote }}
command:
- sh
- -ce
- cp -a /srv/configmap/..data/* /srv/pod-main-config/;
volumeMounts:
- name: cinder-backup-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: initialize-cinder-logs
image: "{{ $imageFull }}"
command:
- sh
- -ce
- |
mkdir /var/log/kolla/cinder ;
chown -R cinder: /var/log/kolla/cinder
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
containers:
- name: main
image: "{{ $imageFull }}"

View File

@ -32,60 +32,43 @@ spec:
labels:
component: {{ $resourceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"command": [
"bash",
"-ec",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
cp -a /srv/ceph.conf /srv/pod-main-config/;
cp -a /srv/ceph.client.cinder.keyring /srv/pod-main-config/;
"],
"volumeMounts": [
{
"name": "ceph-conf",
"mountPath": "/srv/ceph.conf",
"subPath": "ceph.conf"
},
{
"name": "ceph-client-cinder-keyring",
"mountPath": "/srv/ceph.client.cinder.keyring",
"subPath": "ceph.client.cinder.keyring"
},
{
"name": "cinder-volume-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "initialize-cinder-logs",
"image": "{{ $imageFull }}",
"command": [
"sh",
"-ce",
"mkdir /var/log/kolla/cinder ;
chown -R cinder: /var/log/kolla/cinder "],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
spec:
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
command:
- bash
- -ec
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
cp -a /srv/ceph.conf /srv/pod-main-config/;
cp -a /srv/ceph.client.cinder.keyring /srv/pod-main-config/;
volumeMounts:
- name: ceph-conf
mountPath: /srv/ceph.conf
subPath: ceph.conf
- name: ceph-client-cinder-keyring
mountPath: /srv/ceph.client.cinder.keyring
subPath: ceph.client.cinder.keyring
- name: cinder-volume-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: initialize-cinder-logs
image: {{ $imageFull | quote }}
command:
- sh
- -ce
- |
mkdir /var/log/kolla/cinder;
chown -R cinder: /var/log/kolla/cinder
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -36,88 +36,69 @@ spec:
labels:
component: {{ $resourceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "initialize-cinder-volume-lvm",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"bash",
"-ce",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- range $key, $val := $localVals.lvm_backends }}
{{- range $key2, $val2 := $val }}
{{- $vg_ip := $key2 }}
{{- $vg_name := $val2 }}
{{- $lvm_enabled_backend := printf "%s_%s" $vg_ip $vg_name }}
crudini --set /srv/pod-main-config/cinder.conf DEFAULT enabled_backends {{ $lvm_enabled_backend }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_group {{ $vg_name }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_backend_name {{ $lvm_enabled_backend }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_driver ''cinder.volume.drivers.lvm.LVMVolumeDriver'';
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_helper {{ $iscsiHelper }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_protocol ''iscsi'';
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_ip_address {{ $vg_ip }};
{{- end }}
{{- end }}
"],
"volumeMounts": [
{
"name": "cinder-volume-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "initialize-cinder-logs",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-ce",
"mkdir /var/log/kolla/cinder ;
chown -R cinder: /var/log/kolla/cinder "],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
},
{
"name": "initialize-iscsi-iqn",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0,
"privileged": true
},
"command": [
"bash",
"-ce",
"if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc ''a-f0-9'' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
"],
"volumeMounts": [
{
"name": "iscsi-info",
"mountPath": "/etc/iscsi"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
- name: initialize-cinder-volume-lvm
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- bash
- -ce
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- range $key, $val := $localVals.lvm_backends }}
{{- range $key2, $val2 := $val }}
{{- $vg_ip := $key2 }}
{{- $vg_name := $val2 }}
{{- $lvm_enabled_backend := printf "%s_%s" $vg_ip $vg_name }}
crudini --set /srv/pod-main-config/cinder.conf DEFAULT enabled_backends {{ $lvm_enabled_backend }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_group {{ $vg_name }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_backend_name {{ $lvm_enabled_backend }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} volume_driver 'cinder.volume.drivers.lvm.LVMVolumeDriver';
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_helper {{ $iscsiHelper }};
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_protocol 'iscsi';
crudini --set /srv/pod-main-config/cinder.conf {{ $lvm_enabled_backend }} iscsi_ip_address {{ $vg_ip }};
{{- end }}
{{- end }}
volumeMounts:
- name: cinder-volume-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: initialize-cinder-logs
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -ce
- |
mkdir /var/log/kolla/cinder;
chown -R cinder: /var/log/kolla/cinder
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
- name: initialize-iscsi-iqn
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
privileged: true
command:
- bash
- -ce
- |
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc 'a-f0-9' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
volumeMounts:
- name: iscsi-info
mountPath: /etc/iscsi
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -57,50 +57,6 @@ spec:
{{- if $localVals.ceph_backend }}
kolla_upgrade: minor_rolling_safe
{{- end }}
pod.alpha.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.ceph_backend }}
cp -a /srv/ceph.conf /srv/pod-main-config/;
cp -a /srv/ceph.client.glance.keyring /srv/pod-main-config/;
{{- end }}
{{- if $localVals.haproxy }}
CONF=/srv/pod-main-config/glance-api.conf;
crudini --set $CONF DEFAULT bind_host 127.0.0.1;
crudini --set $CONF DEFAULT bind_port 8080;
{{- end }}
"],
"volumeMounts": [
{{- if $localVals.ceph_backend }}
{
"name": "ceph-conf",
"mountPath": "/srv/ceph.conf",
"subPath": "ceph.conf"
},
{
"name": "ceph-client-glance-keyring",
"mountPath": "/srv/ceph.client.glance.keyring",
"subPath": "ceph.client.glance.keyring"
},
{{- end }}
{
"name": "service-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
{{- if $localVals.ceph_backend }}
hostPID: True
@ -111,6 +67,38 @@ spec:
{{- if $localVals.haproxy }}
terminationGracePeriodSeconds: {{ $gracePeriodSeconds }}
{{- end }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.ceph_backend }}
cp -a /srv/ceph.conf /srv/pod-main-config/;
cp -a /srv/ceph.client.glance.keyring /srv/pod-main-config/;
{{- end }}
{{- if $localVals.haproxy }}
CONF=/srv/pod-main-config/glance-api.conf;
crudini --set $CONF DEFAULT bind_host 127.0.0.1;
crudini --set $CONF DEFAULT bind_port 8080;
{{- end }}
volumeMounts:
{{- if $localVals.ceph_backend }}
- name: ceph-conf
mountPath: /srv/ceph.conf
subPath: ceph.conf
- name: ceph-client-glance-keyring
mountPath: /srv/ceph.client.glance.keyring
subPath: ceph.client.glance.keyring
{{- end }}
- name: service-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
containers:
{{- if $localVals.haproxy }}
- name: haproxy

View File

@ -24,13 +24,12 @@ metadata:
name: glance-manage-db
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
restartPolicy: OnFailure
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -31,71 +31,58 @@ spec:
metadata:
labels:
service: {{ $serviceName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "fix-permissions",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0
},
"command": [
"/bin/sh",
"-c",
" if [ ! $(ls -A /helm-repo) ]; then
chown -R helm: /helm-repo;
chmod 755 /helm-repo;
fi;
"],
"volumeMounts": [
{{- if $persistent }}
{
"name": "helm-repo-persistent-storage",
"mountPath": "/helm-repo"
}
{{- end }}
]
},
{
"name": "prepare-repo",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
" if [ ! $(ls -A /helm-repo) ]; then
pushd /tmp;
if [ ''x{{ $method }}'' == ''xgit'' ]; then
git clone {{ $url }} kolla-kubernetes;
fi;
if [ ''x{{ $method }}'' == ''xtar'' ]; then
curl -o kolla-kubernetes.tar.gz {{ $url }};
tar -zxvf kolla-kubernetes.tar.gz;
fi;
pushd kolla-kubernetes;
tools/helm_prebuild_microservices.py;
tools/helm_build_microservices.py /helm-repo;
popd;
popd;
pushd /helm-repo;
helm repo index --url http://helm-repo:{{ $port }} /helm-repo;
popd;
fi;
"],
"volumeMounts": [
{{- if $persistent }}
{
"name": "helm-repo-persistent-storage",
"mountPath": "/helm-repo"
}
{{- end }}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
- name: fix-permissions
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
- |
if [ ! $(ls -A /helm-repo) ]; then
chown -R helm: /helm-repo;
chmod 755 /helm-repo;
fi;
volumeMounts:
{{- if $persistent }}
- name: helm-repo-persistent-storage
mountPath: /helm-repo
{{- end }}
- name: prepare-repo
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
if [ ! $(ls -A /helm-repo) ]; then
pushd /tmp;
if [ 'x{{ $method }}' == 'xgit' ]; then
git clone {{ $url }} kolla-kubernetes;
fi;
if [ 'x{{ $method }}' == 'xtar' ]; then
curl -o kolla-kubernetes.tar.gz {{ $url }};
tar -zxvf kolla-kubernetes.tar.gz;
fi;
pushd kolla-kubernetes;
tools/helm_prebuild_microservices.py;
tools/helm_build_microservices.py /helm-repo;
popd;
popd;
pushd /helm-repo;
helm repo index --url http://helm-repo:{{ $port }} /helm-repo;
popd;
fi;
volumeMounts:
{{- if $persistent }}
- name: helm-repo-persistent-storage
mountPath: /helm-repo
{{- end }}
containers:
- name: main
image: "{{ $imageFull }}"

View File

@ -27,13 +27,11 @@ spec:
metadata:
labels:
service: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_single" $env | indent 10 }}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- name: main
image: "{{ $imageFull }}"

View File

@ -36,81 +36,61 @@ spec:
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-ironic-conductor",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"IP=$(ip addr show to {{ $ironicProvisionCIDR }} | grep -m1 -G ''inet'' | awk ''{print $2}'' | cut -d ''/'' -f 1);
if test -z $IP; then exit 1; fi;
cp -a /config/ironic/..data/* /ironic/;
cp -a /config/pxe/..data/* /pxe/;
jq ''.command = \"in.tftpd -v -L -u root -a ''$IP'':69 --map-file /map-file /tftpboot\"'' /config/pxe/..data/config.json > /pxe/config.json;
crudini --set /ironic/ironic.conf conductor api_url http://{{ $ironicAPI }}:6385;
crudini --set /ironic/ironic.conf pxe tftp_server $IP;
"],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
},
{
"name": "conductor-config",
"mountPath": "/config/ironic"
},
{
"name": "pxe-config",
"mountPath": "/config/pxe"
},
{
"name": "ironic-conductor-config",
"mountPath": "/ironic/"
},
{
"name": "ironic-pxe-config",
"mountPath": "/pxe/"
}
]
},
{
"name": "pxelinux",
"image": {{ $imageFullPXE | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"if [ -f /var/lib/tftpboot/pxelinux.0 ]; then
cp /var/lib/tftpboot/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/share/syslinux/chain.c32 ]; then
cp /usr/share/syslinux/chain.c32 /tftpboot;
fi;
if [ -f /usr/lib/PXELINUX/pxelinux.0 ]; then
cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/lib/syslinux/modules/bios/chain.c32 ]; then
cp /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot;
fi;
mkdir -p /tftpboot/pxelinux.cfg;
"],
"volumeMounts": [
{
"name": "tftpboot",
"mountPath": "/tftpboot/"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-ironic-conductor
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
IP=$(ip addr show to {{ $ironicProvisionCIDR }} | grep -m1 -G 'inet' | awk '{print $2}' | cut -d '/' -f 1);
if test -z $IP; then exit 1; fi;
cp -a /config/ironic/..data/* /ironic/;
cp -a /config/pxe/..data/* /pxe/;
jq '.command = "in.tftpd -v -L -u root -a '$IP':69 --map-file /map-file /tftpboot"' /config/pxe/..data/config.json > /pxe/config.json;
crudini --set /ironic/ironic.conf conductor api_url http://{{ $ironicAPI }}:6385;
crudini --set /ironic/ironic.conf pxe tftp_server $IP;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla/
- name: conductor-config
mountPath: /config/ironic
- name: pxe-config
mountPath: /config/pxe
- name: ironic-conductor-config
mountPath: /ironic/
- name: ironic-pxe-config
mountPath: /pxe/
- name: pxelinux
image: {{ $imageFullPXE | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
if [ -f /var/lib/tftpboot/pxelinux.0 ]; then
cp /var/lib/tftpboot/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/share/syslinux/chain.c32 ]; then
cp /usr/share/syslinux/chain.c32 /tftpboot;
fi;
if [ -f /usr/lib/PXELINUX/pxelinux.0 ]; then
cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/lib/syslinux/modules/bios/chain.c32 ]; then
cp /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot;
fi;
mkdir -p /tftpboot/pxelinux.cfg;
volumeMounts:
- name: tftpboot
mountPath: /tftpboot/
containers:
- name: pxe
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -50,112 +50,83 @@ spec:
labels:
service: {{ $serviceName }}
type: {{ $serviceType }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-ironic-dnsmasq",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"IP=$(ip addr show dev {{ $ironicInterface }} to {{ $ironicInspectionCIDR }} | grep -m1 -G ''inet'' | awk ''{print $2}'' | cut -d ''/'' -f 1);
if test -z $IP; then exit 1; fi;
cp -a /config/dnsmasq/..data/* /dnsmasq/;
cp -a /config/pxe/..data/* /pxe/;
curl -L {{ $url1 }} -o /tftpboot/ironic-agent.initramfs;
curl -L {{ $url2 }} -o /tftpboot/ironic-agent.kernel;
jq ''.command = \"in.tftpd -v -L -u root -a ''$IP'':69 --map-file /map-file /tftpboot\"'' /config/pxe/..data/config.json > /pxe/config.json;
sed -i ''s|ironic-inspector|''$IP''|g'' /pxe/default;
{{- if $ironicInspectLLDP }}
sed -i ''/^append/ s/$/ ipa-collect-lldp=1/'' /pxe/default;
{{- end }}
sed -i ''s|interface=.*|interface={{ $ironicInterface }}|g'' /dnsmasq/dnsmasq.conf;
sed -i ''s|dhcp-option=option:tftp-server,.*|dhcp-option=option:tftp-server,''$IP''|g'' /dnsmasq/dnsmasq.conf;
sed -i ''s|dhcp-option=option:server-ip-address,.*|dhcp-option=option:server-ip-address,''$IP''|g'' /dnsmasq/dnsmasq.conf;
sed -i ''s|dhcp-range=.*|dhcp-range={{ $ironicDHCPrange }}|g'' /dnsmasq/dnsmasq.conf;
"],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
},
{
"name": "dnsmasq-config",
"mountPath": "/config/dnsmasq"
},
{
"name": "ironic-pxe-config",
"mountPath": "/pxe/"
},
{
"name": "pxe-config",
"mountPath": "/config/pxe"
},
{
"name": "ironic-dnsmasq-config",
"mountPath": "/dnsmasq/"
},
{
"name": "tftpboot",
"mountPath": "/tftpboot/"
}
]
},
{
"name": "pxelinux",
"image": {{ $imageFullPXE | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"if [ -f /var/lib/tftpboot/pxelinux.0 ]; then
cp /var/lib/tftpboot/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/share/syslinux/chain.c32 ]; then
cp /usr/share/syslinux/chain.c32 /tftpboot;
fi;
if [ -f /usr/lib/PXELINUX/pxelinux.0 ]; then
cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/lib/syslinux/modules/bios/chain.c32 ]; then
cp /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot;
fi;
"],
"volumeMounts": [
{
"name": "tftpboot",
"mountPath": "/tftpboot/"
}
]
},
{
"name": "update-inspector-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
crudini --set /srv/pod-main-config/inspector.conf firewall dnsmasq_interface {{ $ironicInterface }};
"],
"volumeMounts": [
{
"name": "inspector-config",
"mountPath": "/srv/configmap"
},
{
"name": "ironic-inspector-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
hostNetwork: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-ironic-dnsmasq
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
IP=$(ip addr show dev {{ $ironicInterface }} to {{ $ironicInspectionCIDR }} | grep -m1 -G 'inet' | awk '{print $2}' | cut -d '/' -f 1);
if test -z $IP; then exit 1; fi;
cp -a /config/dnsmasq/..data/* /dnsmasq/;
cp -a /config/pxe/..data/* /pxe/;
curl -L {{ $url1 }} -o /tftpboot/ironic-agent.initramfs;
curl -L {{ $url2 }} -o /tftpboot/ironic-agent.kernel;
jq '.command = "in.tftpd -v -L -u root -a '$IP':69 --map-file /map-file /tftpboot"' /config/pxe/..data/config.json > /pxe/config.json;
sed -i 's|ironic-inspector|'$IP'|g' /pxe/default;
{{- if $ironicInspectLLDP }}
sed -i '/^append/ s/$/ ipa-collect-lldp=1/' /pxe/default;
{{- end }}
sed -i 's|interface=.*|interface={{ $ironicInterface }}|g' /dnsmasq/dnsmasq.conf;
sed -i 's|dhcp-option=option:tftp-server,.*|dhcp-option=option:tftp-server,'$IP'|g' /dnsmasq/dnsmasq.conf;
sed -i 's|dhcp-option=option:server-ip-address,.*|dhcp-option=option:server-ip-address,'$IP'|g' /dnsmasq/dnsmasq.conf;
sed -i 's|dhcp-range=.*|dhcp-range={{ $ironicDHCPrange }}|g' /dnsmasq/dnsmasq.conf;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla/
- name: dnsmasq-config
mountPath: /config/dnsmasq
- name: ironic-pxe-config
mountPath: /pxe/
- name: pxe-config
mountPath: /config/pxe
- name: ironic-dnsmasq-config
mountPath: /dnsmasq/
- name: tftpboot
mountPath: /tftpboot/
- name: pxelinux
image: {{ $imageFullPXE | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
if [ -f /var/lib/tftpboot/pxelinux.0 ]; then
cp /var/lib/tftpboot/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/share/syslinux/chain.c32 ]; then
cp /usr/share/syslinux/chain.c32 /tftpboot;
fi;
if [ -f /usr/lib/PXELINUX/pxelinux.0 ]; then
cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot;
fi;
if [ -f /usr/lib/syslinux/modules/bios/chain.c32 ]; then
cp /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot;
fi;
volumeMounts:
- name: tftpboot
mountPath: /tftpboot/
- name: update-inspector-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
crudini --set /srv/pod-main-config/inspector.conf firewall dnsmasq_interface {{ $ironicInterface }};
volumeMounts:
- name: inspector-config
mountPath: /srv/configmap
- name: ironic-inspector-config
mountPath: /srv/pod-main-config
containers:
- name: pxe
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -27,40 +27,32 @@ spec:
labels:
component: iscsi-target
system: iscsi-target
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-iscsi-iqn",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0,
"privileged": true
},
"command": [
"bash",
"-ce",
"if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc ''a-f0-9'' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
"],
"volumeMounts": [
{
"name": "iscsi-info",
"mountPath": "/etc/iscsi"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-iscsi-iqn
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
privileged: true
command:
- bash
- -ce
- |
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc 'a-f0-9' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
volumeMounts:
- name: iscsi-info
mountPath: /etc/iscsi
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -26,66 +26,49 @@ spec:
labels:
component: iscsid
system: iscsid
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-iscsid",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"bash",
"-ce",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
ls -l /etc/iscsi || true;
cp -a /etc/iscsi/iscsid.conf /srv/pod-main-config/;
"],
"volumeMounts": [
{
"name": "iscsid-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "initialize-iscsi-iqn",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0,
"privileged": true
},
"command": [
"bash",
"-ce",
"cp -a /srv/pod-main-config/iscsid.conf /etc/iscsi/iscsid.conf;
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc ''a-f0-9'' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
"],
"volumeMounts": [
{
"name": "iscsi-info",
"mountPath": "/etc/iscsi"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-iscsid
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- bash
- -ce
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
ls -l /etc/iscsi || true;
cp -a /etc/iscsi/iscsid.conf /srv/pod-main-config/;
volumeMounts:
- name: iscsid-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: initialize-iscsi-iqn
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
privileged: true
command:
- bash
- -ce
- |
cp -a /srv/pod-main-config/iscsid.conf /etc/iscsi/iscsid.conf;
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc 'a-f0-9' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
volumeMounts:
- name: iscsi-info
mountPath: /etc/iscsi
- name: pod-main-config
mountPath: /srv/pod-main-config
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -28,44 +28,33 @@ spec:
labels:
component: keepalived
system: keepalived
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-keepalived",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
API_INTERFACE={{ $apiInterface }};
F=/var/lib/kolla-kubernetes/keepalived/api_interface;
[ -f $F ] && API_INTERFACE=$(<$F);
sed -i ''s|interface.*|interface ''$API_INTERFACE''|g'' /srv/pod-main-config/keepalived.conf;
sed -i ''s|\\(dev*\\).*|\\1 ''$API_INTERFACE''|g'' /srv/pod-main-config/keepalived.conf;
cat /srv/pod-main-config/keepalived.conf;
"],
"volumeMounts": [
{
"name": "keepalived-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "host-var-lib-kk",
"mountPath": "/var/lib/kolla-kubernetes"
}
]
}
]'
spec:
hostNetwork: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-keepalived
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
API_INTERFACE={{ $apiInterface }};
F=/var/lib/kolla-kubernetes/keepalived/api_interface;
[ -f $F ] && API_INTERFACE=$(<$F);
sed -i 's|interface.*|interface '$API_INTERFACE'|g' /srv/pod-main-config/keepalived.conf;
sed -i 's|\(dev*\).*|\1 '$API_INTERFACE'|g' /srv/pod-main-config/keepalived.conf;
cat /srv/pod-main-config/keepalived.conf;
volumeMounts:
- name: keepalived-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: host-var-lib-kk
mountPath: /var/lib/kolla-kubernetes
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -17,31 +17,24 @@
{{- $extraConfigmapConfig := "keystone_extra_configmap_config" }}
{{- $extraVolumes := "keystone_extra_volumes" }}
{{- $extraVolumeMounts := "keystone_extra_volume_mounts" }}
{{- $extraAnnotations := "keystone_initcontainer" }}
{{- $initContainers := "keystone_initcontainer" }}
{{- $checkPath := "/" }}
{{- $privileged := false }}
{{- $haproxy := false }}
{{- define "keystone_initcontainer" }}
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" . | indent 2 }}
{
"name": "initialize-keystone-logs",
"image": "{{ .imageFull }}",
"imagePullPolicy": "IfNotPresent",
"command": [
"sh",
"-ce",
"mkdir /var/log/kolla/keystone ;
chown -R keystone: /var/log/kolla/keystone;
chmod 755 /var/log/kolla/keystone; "],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
- name: initialize-keystone-logs
image: {{ .imageFull | quote }}
imagePullPolicy: IfNotPresent
command:
- sh
- -ce
- |
mkdir /var/log/kolla/keystone ;
chown -R keystone: /var/log/kolla/keystone;
chmod 755 /var/log/kolla/keystone;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
{{- end }}
{{- define "keystone_extra_volumes" }}
- name: keystone-fernet-keys
@ -63,6 +56,6 @@ items:
- key: config.json
path: config.json
{{- end }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "configFileName" $configFileName "configSectionName" $configSectionName "configListenHostParameter" $configListenHostParameter "configListenPortParameter" $configListenPortParameter "portName" $portName "imageFull" $imageFull "checkPath" $checkPath "extraConfigmapConfig" $extraConfigmapConfig "extraVolume" $extraVolumes "extraVolumeMounts" $extraVolumeMounts "extraAnnotations" $extraAnnotations "privileged" $privileged "haproxy" $haproxy "Values" .Values "Release" .Release "searchPath" $searchPath }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "configFileName" $configFileName "configSectionName" $configSectionName "configListenHostParameter" $configListenHostParameter "configListenPortParameter" $configListenPortParameter "portName" $portName "imageFull" $imageFull "checkPath" $checkPath "extraConfigmapConfig" $extraConfigmapConfig "extraVolume" $extraVolumes "extraVolumeMounts" $extraVolumeMounts "initContainers" $initContainers "privileged" $privileged "haproxy" $haproxy "Values" .Values "Release" .Release "searchPath" $searchPath }}
{{- include "common_api_apache_deployment" $env }}
{{- end }}

View File

@ -33,13 +33,12 @@ metadata:
name: keystone-create-endpoints
spec:
template:
{{- include "init_container_header" $env | indent 4 }}
{{- include "common_dependency_container_single" $env | indent 10 }}
{{- include "init_container_tail" $env | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
restartPolicy: OnFailure
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -17,12 +17,11 @@ metadata:
name: keystone-fernet-rotate-job
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -17,12 +17,11 @@ metadata:
name: keystone-fernet-setup-job
spec:
template:
{{- include "init_container_header" . | indent 4 }}
{{- include "common_dependency_container_single" . | indent 10 }}
{{- include "init_container_tail" . | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" . | indent 8 }}
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -25,13 +25,11 @@ spec:
metadata:
labels:
service: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_single" $env | indent 10 }}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -36,9 +36,6 @@ spec:
labels:
service: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_single" $env | indent 10 }}
]'
{{- if $localVals.prometheus }}
"prometheus.io/port": {{ $localVals.prometheusPort | quote }}
"prometheus.io/scrape": "true"
@ -49,6 +46,8 @@ spec:
{{- end }}
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- image: "{{ $memcachedImageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -31,65 +31,48 @@ spec:
labels:
component: neutron
system: dhcp-agent
annotations:
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" $env | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.openvswitch_tcp }}
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list \"$TUNNEL_INTERFACE\" | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
"],
"volumeMounts": [
{
"name": "neutron-dhcp-agent-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "update-permissions",
"image": {{ $imageFull | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0
},
"command": [
"/bin/sh",
"-c",
"chown --recursive neutron.kolla /var/log/kolla;"
],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" $env | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.openvswitch_tcp }}
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list "$TUNNEL_INTERFACE" | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
volumeMounts:
- name: neutron-dhcp-agent-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: "update-permissions"
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
- chown --recursive neutron.kolla /var/log/kolla;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -36,77 +36,61 @@ spec:
labels:
component: neutron
system: l3-agent-{{ $restype }}
annotations:
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.openvswitch_tcp }}
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list {{ $tunnelInterface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
{{- if eq $restype "compute" }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr;
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers false;
{{- else }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers true;
{{- if $localVals.dvr }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr_snat;
{{- else }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode legacy;
{{- end }}
{{- end }}"
],
"volumeMounts": [
{
"name": "neutron-l3-agent-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "update-permissions",
"image": {{ $imageFull | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0
},
"command": [
"/bin/sh",
"-c",
"chown --recursive neutron.kolla /var/log/kolla;
echo FIXME check for ip6tables loaded;"
],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{{- if $localVals.openvswitch_tcp }}
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list {{ $tunnelInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
{{- if eq $restype "compute" }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr;
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers false;
{{- else }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers true;
{{- if $localVals.dvr }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr_snat;
{{- else }}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode legacy;
{{- end }}
{{- end }}
volumeMounts:
- name: neutron-l3-agent-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: update-permissions
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
command:
- /bin/sh
- -c
- |
chown --recursive neutron.kolla /var/log/kolla;
echo FIXME check for ip6tables loaded;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -26,14 +26,12 @@ spec:
labels:
component: neutron
system: metadata-agent-{{ $restype }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_single" $env | indent 10 }}
]'
spec:
hostNetwork: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -36,98 +36,77 @@ spec:
labels:
component: neutron
system: openvswitch-agent-{{ $restype }}
annotations:
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list \"$TUNNEL_INTERFACE\" | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
{{- if $localVals.openvswitch_tcp }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP"
],
"volumeMounts": [
{
"name": "neutron-openvswitch-agent-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "host-var-lib-kk",
"mountPath": "/var/lib/kolla-kubernetes"
}
]
},
{
"name": "deps-and-update-permissions",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0,
"privileged": true
},
"command": [
"/bin/sh",
"-c",
"chown --recursive neutron.kolla /var/log/kolla;
{{- if $localVals.openvswitch_no_kernel_module }}
echo Waiting for openvswitch to be available;
{{- else }}
echo Waiting for openvswitch kernel module to load;
{{- end }}
while true; do
{{- if $localVals.openvswitch_no_kernel_module }}
loaded=$(timeout 5s ovs-vsctl show >/dev/null 2>&1 && echo 1 || echo 0);
{{- else }}
loaded=$(lsmod | grep openvswitch | wc -l);
{{- end }}
[ $loaded -ne 0 ] && break;
sleep 1;
done;
echo Done.;
timeout 5s ovs-dpctl show;
echo Waiting for openvswitch daemon to be responsive;
while true; do
timeout 5s ovs-appctl version;
[ $? -eq 0 ] && break;
sleep 1;
echo Trying again.;
done;
echo Done.;
"
],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
},
{
"name": "host-run",
"mountPath": "/var/run"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True #needed for openvswitch pid file
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
TUNNEL_INTERFACE={{ $tunnelInterface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list "$TUNNEL_INTERFACE" | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
{{- if $localVals.openvswitch_tcp }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{{- end }}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP
volumeMounts:
- name: neutron-openvswitch-agent-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: host-var-lib-kk
mountPath: /var/lib/kolla-kubernetes
- name: deps-and-update-permissions
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
privileged: true
command:
- /bin/sh
- -c
- |
chown --recursive neutron.kolla /var/log/kolla;
{{- if $localVals.openvswitch_no_kernel_module }}
echo Waiting for openvswitch to be available;
{{- else }}
echo Waiting for openvswitch kernel module to load;
{{- end }}
while true; do
{{- if $localVals.openvswitch_no_kernel_module }}
loaded=$(timeout 5s ovs-vsctl show >/dev/null 2>&1 && echo 1 || echo 0);
{{- else }}
loaded=$(lsmod | grep openvswitch | wc -l);
{{- end }}
[ $loaded -ne 0 ] && break;
sleep 1;
done;
echo Done.;
timeout 5s ovs-dpctl show;
echo Waiting for openvswitch daemon to be responsive;
while true; do
timeout 5s ovs-appctl version;
[ $? -eq 0 ] && break;
sleep 1;
echo Trying again.;
done;
echo Done.;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
- name: host-run
mountPath: /run
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -19,30 +19,24 @@ metadata:
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"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"
}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
restartPolicy: OnFailure
initContainers:
- name: initialize-cell-api-logs
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
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
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -31,99 +31,67 @@ 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
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-cell-api-logs
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
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 | quote }}
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 }}
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -29,10 +29,8 @@
{{- $tunnelInterface := include "kolla_val_get_str" (dict "key" "tunnel_interface" "searchPath" $searchPath "Values" .Values ) }}
{{- $elementName := .Values.element_name | default $resourceName }}
{{- define "nova_compute_extra_dep_volume_mounts" }}
{
"name": "run",
"mountPath": "/var/run"
}
- name: run
mountPath: /var/run
{{- end }}
{{- $extraDepVolumeMounts := "nova_compute_extra_dep_volume_mounts" }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "privileged" $privileged "Values" .Values "Release" .Release "searchPath" $searchPath "extraDepVolumeMounts" $extraDepVolumeMounts }}
@ -49,103 +47,6 @@ spec:
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-nova-compute",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"cp -a /config/..data/* /nova/;
IP=$(ip addr show dev {{ $tunnelInterface }} | grep -G ''inet '' | awk ''{print $2}'' | sed ''s@/.*@@'');
mkdir -p /var/log/kolla/nova-init;
echo Using $IP | tee /var/log/kolla/nova-init/ip.log;
crudini --set /nova/nova.conf DEFAULT my_ip $IP;
crudini --set /nova/nova.conf vnc novncproxy_host $IP;
crudini --set /nova/nova.conf vnc vncserver_listen $IP;
crudini --set /nova/nova.conf vnc vncserver_proxyclient_address $IP;
{{- if $localVals.libvirt_tcp }}
sed -i ''s|^connection_uri.*=.*|connection_uri=\"qemu+tcp://127.0.0.1/system\"|g'' /nova/nova.conf;
{{- end }}
{{- if $localVals.ceph_backend }}
cp -a /secret/a/..data/ceph.client.nova.keyring /nova/ceph.client.nova.keyring;
cp -a /config2/..data/ceph.conf /nova/ceph.conf;
{{- end }}
"],
"volumeMounts": [
{{- if $localVals.ceph_backend }}
{
"name": "ceph-conf",
"mountPath": "/config2/"
},
{
"name": "ceph-client-nova-keyring",
"mountPath": "/secret/a/"
},
{{- end }}
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
},
{
"name": "nova-compute-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
},
{
"name": "initialize-nova",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-ce",
"[ ! -d /var/lib/nova/instances ] && mkdir -p /var/lib/nova/instances;
chown nova: /var/lib/nova;
chown nova: /var/lib/nova/instances;
"],
"securityContext": {
"runAsUser": 0
},
"volumeMounts": [
{
"name": "nova-compute-persistent-storage",
"mountPath": "/var/lib/nova"
}
]
},
{
"name": "initialize-iscsi-iqn",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0,
"privileged": true
},
"command": [
"bash",
"-ce",
"if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc ''a-f0-9'' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
"],
"volumeMounts": [
{
"name": "iscsi-info",
"mountPath": "/etc/iscsi"
}
]
}
]'
spec:
hostNetwork: True
nodeSelector:
@ -153,6 +54,76 @@ spec:
{{- if not $localVals.libvirt_tcp }}
hostIPC: True
{{- end }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-nova-compute
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
cp -a /config/..data/* /nova/;
IP=$(ip addr show dev {{ $tunnelInterface }} | grep -G 'inet ' | awk '{print $2}' | sed 's@/.*@@');
mkdir -p /var/log/kolla/nova-init;
echo Using $IP | tee /var/log/kolla/nova-init/ip.log;
crudini --set /nova/nova.conf DEFAULT my_ip $IP;
crudini --set /nova/nova.conf vnc novncproxy_host $IP;
crudini --set /nova/nova.conf vnc vncserver_listen $IP;
crudini --set /nova/nova.conf vnc vncserver_proxyclient_address $IP;
{{- if $localVals.libvirt_tcp }}
sed -i 's|^connection_uri.*=.*|connection_uri="qemu+tcp://127.0.0.1/system"|g' /nova/nova.conf;
{{- end }}
{{- if $localVals.ceph_backend }}
cp -a /secret/a/..data/ceph.client.nova.keyring /nova/ceph.client.nova.keyring;
cp -a /config2/..data/ceph.conf /nova/ceph.conf;
{{- end }}
volumeMounts:
{{- if $localVals.ceph_backend }}
- name: ceph-conf
mountPath: /config2/
- name: ceph-client-nova-keyring
mountPath: /secret/a/
{{- end }}
- name: kolla-logs
mountPath: /var/log/kolla/
- name: nova-compute-config
mountPath: /config/
- name: nova-config
mountPath: /nova/
- name: initialize-nova
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -ce
- |
[ ! -d /var/lib/nova/instances ] && mkdir -p /var/lib/nova/instances;
chown nova: /var/lib/nova;
chown nova: /var/lib/nova/instances;
securityContext:
runAsUser: 0
volumeMounts:
- name: nova-compute-persistent-storage
mountPath: /var/lib/nova
- name: initialize-iscsi-iqn
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
securityContext:
runAsUser: 0
privileged: true
command:
- bash
- -ce
- |
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
iqn=$( cat /dev/urandom | tr -dc 'a-f0-9' | head -c 12 );
echo InitiatorName=iqn.2010-10.org.openstack:$iqn > /etc/iscsi/initiatorname.iscsi;
chmod 640 /etc/iscsi/initiatorname.iscsi;
fi;
volumeMounts:
- name: iscsi-info
mountPath: /etc/iscsi
containers:
- name: main
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -30,40 +30,29 @@ spec:
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-nova-compute",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"cp -a /config/..data/* /ironic/;
IP=$(ip addr show dev {{ $tunnelInterface }} | grep -G ''inet '' | awk ''{print $2}'' | sed ''s@/.*@@'');
crudini --set /ironic/nova.conf DEFAULT my_ip $IP;
crudini --set /ironic/nova.conf DEFAULT vif_pluggin_is_fatal false;
"],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
},
{
"name": "nova-compute-ironic-config",
"mountPath": "/config/"
},
{
"name": "ironic-config",
"mountPath": "/ironic/"
}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-nova-compute
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
cp -a /config/..data/* /ironic/;
IP=$(ip addr show dev {{ $tunnelInterface }} | grep -G 'inet ' | awk '{print $2}' | sed 's@/.*@@');
crudini --set /ironic/nova.conf DEFAULT my_ip $IP;
crudini --set /ironic/nova.conf DEFAULT vif_pluggin_is_fatal false;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla/
- name: nova-compute-ironic-config
mountPath: /config/
- name: ironic-config
mountPath: /ironic/
containers:
- name: main
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -38,54 +38,6 @@ spec:
labels:
component: {{ $serviceName }}
system: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-nova-libvirt",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"cp -a /config/..data/* /nova/;
{{- if $localVals.libvirt_tcp }}
sed -i ''s|^listen_addr.*=.*|listen_addr=\"127.0.0.1\"|g'' /nova/libvirtd.conf;
{{- end }}
{{- if $localVals.ceph_backend }}
mkdir -p /nova/secrets/;
RDB_SECRET_UUID=$(sed -n ''s|.*<uuid>\\(.*\\)</uuid>.*|\\1|p'' /secret/a/data);
cp -a /secret/a/..data/data /nova/secrets/$RDB_SECRET_UUID.xml;
cp -a /secret/b/..data/data /nova/secrets/$RDB_SECRET_UUID.base64;
cp -a /config2/..data/ceph.conf /nova;
{{- end }}
"],
"volumeMounts": [
{{- if $localVals.ceph_backend }}
{
"name": "ceph-conf",
"mountPath": "/config2"
},
{
"name": "nova-libvirt-secret",
"mountPath": "/secret/a/"
},
{
"name": "nova-libvirt-bin-secret",
"mountPath": "/secret/b/"
},
{{- end }}
{
"name": "nova-libvirt-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
@ -94,9 +46,42 @@ spec:
{{- if not $localVals.libvirt_tcp }}
hostIPC: True
{{- end }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-nova-libvirt
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
cp -a /config/..data/* /nova/;
{{- if $localVals.libvirt_tcp }}
sed -i 's|^listen_addr.*=.*|listen_addr="127.0.0.1"|g' /nova/libvirtd.conf;
{{- end }}
{{- if $localVals.ceph_backend }}
mkdir -p /nova/secrets/;
RDB_SECRET_UUID=$(sed -n 's|.*<uuid>\(.*\)</uuid>.*|\1|p' /secret/a/data);
cp -a /secret/a/..data/data /nova/secrets/$RDB_SECRET_UUID.xml;
cp -a /secret/b/..data/data /nova/secrets/$RDB_SECRET_UUID.base64;
cp -a /config2/..data/ceph.conf /nova;
{{- end }}
volumeMounts:
{{- if $localVals.ceph_backend }}
- name: ceph-conf
mountPath: /config2
- name: nova-libvirt-secret
mountPath: /secret/a/
- name: nova-libvirt-bin-secret
mountPath: /secret/b/
{{- end }}
- name: nova-libvirt-config
mountPath: /config/
- name: nova-config
mountPath: /nova/
containers:
- name: main
image: "{{ $imageFull }}"
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/bash

View File

@ -15,32 +15,25 @@
{{- $configListenHostParameter := "osapi_compute_listen" }}
{{- $configListenPortParameter := "osapi_compute_listen_port" }}
{{- $portName := "placement-api" }}
{{- $extraAnnotations := "placement_api_initcontainer" }}
{{- $initContainers := "placement_api_initcontainer" }}
{{- $checkPath := "/" }}
{{- $privileged := false }}
{{- $haproxy := true }}
{{- define "placement_api_initcontainer" }}
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" . | indent 2 }}
{
"name": "initialize-placement-api-logs",
"image": "{{ .imageFull }}",
"imagePullPolicy": "{{ .imagePullPolicy }}",
"command": [
"sh",
"-ce",
"mkdir /var/log/kolla/nova;
chown -R keystone: /var/log/kolla/nova;
chmod 755 /var/log/kolla/nova; "],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
- name: initialize-placement-api-logs
image: {{ .imageFull | quote }}
imagePullPolicy: {{ .imagePullPolicy | quote }}
command:
- sh
- -ce
- |
mkdir -p /var/log/kolla/nova;
chown -R keystone: /var/log/kolla/nova;
chmod 755 /var/log/kolla/nova;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla
{{- end }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "configFileName" $configFileName "configSectionName" $configSectionName "configListenHostParameter" $configListenHostParameter "configListenPortParameter" $configListenPortParameter "portName" $portName "imageFull" $imageFull "imagePullPolicy" $imagePullPolicy "checkPath" $checkPath "extraAnnotations" $extraAnnotations "privileged" $privileged "haproxy" $haproxy "Values" .Values "Release" .Release "searchPath" $searchPath }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "configFileName" $configFileName "configSectionName" $configSectionName "configListenHostParameter" $configListenHostParameter "configListenPortParameter" $configListenPortParameter "portName" $portName "imageFull" $imageFull "imagePullPolicy" $imagePullPolicy "checkPath" $checkPath "initContainers" $initContainers "privileged" $privileged "haproxy" $haproxy "Values" .Values "Release" .Release "searchPath" $searchPath }}
{{- include "common_api_apache_deployment" $env }}
{{- end }}

View File

@ -26,37 +26,29 @@ spec:
labels:
component: openvswitch
system: openvswitch-db-{{ $restype }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-ovs-db",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"mkdir -p /var/log/kolla/openvswitch;
DB=/etc/openvswitch/conf.db;
/usr/bin/ovsdb-tool create $DB;
echo $(date) >> /var/log/kolla/db-create.log;" ],
"volumeMounts": [
{
"name": "openvswitch-db",
"mountPath": "/etc/openvswitch/"
},
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-ovs-db
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
mkdir -p /var/log/kolla/openvswitch;
DB=/etc/openvswitch/conf.db;
/usr/bin/ovsdb-tool create $DB;
echo $(date) >> /var/log/kolla/db-create.log;
volumeMounts:
- name: openvswitch-db
mountPath: /etc/openvswitch/
- name: kolla-logs
mountPath: /var/log/kolla/
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -24,10 +24,8 @@
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- define "openvswitch_vswitchd_extra_dep_volume_mounts" }}
{
"name": "openvswitch-run",
"mountPath": "/var/run/openvswitch/"
}
- name: openvswitch-run
mountPath: /var/run/openvswitch/
{{- end }}
{{- $extraDepVolumeMounts := "openvswitch_vswitchd_extra_dep_volume_mounts" }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath "extraDepVolumeMounts" $extraDepVolumeMounts }}
@ -44,69 +42,51 @@ spec:
labels:
component: openvswitch
system: openvswitch-vswitchd-{{ $restype }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "reqdependencies",
"image": {{ include "kubernetes_entrypoint_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"env": [
{
"name": "DEPENDENCY_SOCKET",
"value": "/var/run/openvswitch/db.sock"
}
],
"volumeMounts": [
{
"name": "openvswitch-run",
"mountPath": "/var/run/openvswitch/"
}
]
},
{
"name": "initialize-ovs-vswitchd",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-xec",
"mkdir -p /var/log/kolla/openvswitch;
{{- if $localVals.setup_bridge }}
ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-br {{ $extBridgeName }} ;
{{- if $localVals.add_port }}
EXTERNAL_INTERFACE={{ $extInterfaceName }};
F=/var/lib/kolla-kubernetes/openvswitch-vswitchd/external_interface;
[ -f $F ] && EXTERNAL_INTERFACE=$(<$F);
ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-port {{ $extBridgeName }} $EXTERNAL_INTERFACE;
{{- end }}
{{- if $localVals.ext_bridge_up }}
ip link set {{ $extBridgeName }} up;
{{- end }}
{{- end }}
echo $(date) >> /var/log/kolla/vswitchd-init.log;" ],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla/"
},
{
"name": "openvswitch-run",
"mountPath": "/var/run/openvswitch/"
},
{
"name": "host-var-lib-kk",
"mountPath": "/var/lib/kolla-kubernetes"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True #Needed for pidfile.
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: reqdependencies
image: {{ include "kubernetes_entrypoint_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
env:
- name: DEPENDENCY_SOCKET
value: /var/run/openvswitch/db.sock
volumeMounts:
- name: openvswitch-run
mountPath: /var/run/openvswitch/
- name: initialize-ovs-vswitchd
image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -xec
- |
mkdir -p /var/log/kolla/openvswitch;
{{- if $localVals.setup_bridge }}
ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-br {{ $extBridgeName }};
{{- if $localVals.add_port }}
EXTERNAL_INTERFACE={{ $extInterfaceName }};
F=/var/lib/kolla-kubernetes/openvswitch-vswitchd/external_interface;
[ -f $F ] && EXTERNAL_INTERFACE=$(<$F);
ovs-vsctl --no-wait --db=unix:/var/run/openvswitch/db.sock add-port {{ $extBridgeName }} $EXTERNAL_INTERFACE;
{{- end }}
{{- if $localVals.ext_bridge_up }}
ip link set {{ $extBridgeName }} up;
{{- end }}
{{- end }}
echo $(date) >> /var/log/kolla/vswitchd-init.log;
volumeMounts:
- name: kolla-logs
mountPath: /var/log/kolla/
- name: openvswitch-run
mountPath: /var/run/openvswitch/
- name: host-var-lib-kk
mountPath: /var/lib/kolla-kubernetes
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -19,12 +19,11 @@ apiVersion: batch/v1
kind: Job
spec:
template:
{{- include "init_container_header" $env | indent 4 }}
{{- include "common_dependency_container_single" $env | indent 10 }}
{{- include "init_container_tail" $env | indent 4 }}
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -25,34 +25,25 @@ spec:
metadata:
labels:
service: {{ $elementName }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "update-config",
"image": "{{ include "kolla_toolbox_image_full" . }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
sed -i ''/^export ERL_EPMD_ADDRESS=0.0.0.0$/d'' /srv/pod-main-config/rabbitmq-env.conf;"
],
"volumeMounts": [
{
"name": "rabbitmq-config",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
sed -i '/^export ERL_EPMD_ADDRESS=0.0.0.0$/d' /srv/pod-main-config/rabbitmq-env.conf;
volumeMounts:
- name: rabbitmq-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -20,49 +20,37 @@ metadata:
name: test-ceph-init-mon
spec:
template:
metadata:
annotations:
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-mon/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i ''/^mon host.*/d;/^mon host/d;/^mon addr/d'' $CONF;
sed -i ''/^\\[global\\]/a mon host = ''$IP $CONF;
sed -i ''/^\\[global\\]/a mon addr = ''$IP'':6789'' $CONF;
sed -i ''/^\\[global\\]/a mon initial members = {{ $node }}'' $CONF;"
],
"volumeMounts": [
{
"name": "ceph-mon-config",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "ceph-mon",
"mountPath": "/var/lib/ceph/mon"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
nodeSelector:
kubernetes.io/hostname: {{ $node }}
initContainers:
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -xec
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-mon/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i '/^mon host.*/d;/^mon host/d;/^mon addr/d' $CONF;
sed -i '/^\[global\]/a mon host = '$IP $CONF;
sed -i '/^\[global\]/a mon addr = '$IP':6789' $CONF;
sed -i '/^\[global\]/a mon initial members = {{ $node }}' $CONF;
cat $CONF;
volumeMounts:
- name: ceph-mon-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: ceph-mon
mountPath: /var/lib/ceph/mon
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -18,49 +18,37 @@ apiVersion: v1
kind: Pod
metadata:
name: ceph-bootstrap-osd{{ $index }}
annotations:
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": "IfNotPresent",
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-osd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i ''/^mon host.*/d;/^mon host/d;/^mon addr/d'' $CONF;
sed -i ''/^\\[global\\]/a mon host = ''$IP $CONF;
sed -i ''/^\\[global\\]/a mon addr = ''$IP'':6789'' $CONF;
sed -i ''/^\\[global\\]/a mon initial members = {{ $initial_mon }}'' $CONF;"
],
"volumeMounts": [
{
"name": "ceph-osd-config",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "ceph-osd",
"mountPath": "/var/lib/ceph/osd"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
nodeSelector:
kubernetes.io/hostname: {{ $initial_mon }}
restartPolicy: Never
initContainers:
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-osd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i '/^mon host.*/d;/^mon host/d;/^mon addr/d' $CONF;
sed -i '/^\[global\]/a mon host = '$IP $CONF;
sed -i '/^\[global\]/a mon addr = '$IP':6789' $CONF;
sed -i '/^\[global\]/a mon initial members = {{ $initial_mon }}' $CONF;
volumeMounts:
- name: ceph-osd-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: ceph-osd
mountPath: /var/lib/ceph/osd
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy }}

View File

@ -33,54 +33,42 @@ spec:
labels:
component: ceph
system: mon
annotations:
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-mon/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F);
IP=$(ip addr list {{ $storageInterface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
found=0;
{{- range $localVals.monitors }}
[ $IP == ''{{ . }}'' ] && found=1 || true;
{{- end }}
echo $found > /srv/pod-main-config/inlist;
sed -i ''/^mon host.*/d;/^mon host/d;/^mon addr/d'' $CONF;
sed -i ''/^\\[global\\]/a mon host = ''$IP $CONF;
sed -i ''/^\\[global\\]/a mon addr = ''$IP'':6789'' $CONF;
sed -i ''/^\\[global\\]/a mon initial members = {{ $initialMember }}'' $CONF;
sed -i ''s/@MONID@/''$(hostname)''/;s/@MONADDR@/''$IP''/'' /srv/pod-main-config/config.json;"
],
"volumeMounts": [
{
"name": "ceph-mon-config",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "ceph-mon",
"mountPath": "/var/lib/ceph/mon"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-mon/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F);
IP=$(ip addr list {{ $storageInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
found=0;
{{- range $localVals.monitors }}
[ $IP == '{{ . }}' ] && found=1 || true;
{{- end }}
echo $found > /srv/pod-main-config/inlist;
sed -i '/^mon host.*/d;/^mon host/d;/^mon addr/d' $CONF;
sed -i '/^\[global\]/a mon host = '$IP $CONF;
sed -i '/^\[global\]/a mon addr = '$IP':6789' $CONF;
sed -i '/^\[global\]/a mon initial members = {{ $initialMember }}' $CONF;
sed -i 's/@MONID@/'$(hostname)'/;s/@MONADDR@/'$IP'/' /srv/pod-main-config/config.json;
volumeMounts:
- name: ceph-mon-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: ceph-mon
mountPath: /var/lib/ceph/mon
containers:
- image: {{ $imageFull | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}

View File

@ -18,50 +18,38 @@ apiVersion: v1
kind: Pod
metadata:
name: ceph-osd{{ $index }}
annotations:
#FIXME Once out of alpha, this should be converted to yaml.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "update-config",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": "IfNotPresent",
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-osd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i ''/^mon host.*/d;/^mon host/d;/^mon addr/d'' $CONF;
sed -i ''/^\\[global\\]/a mon host = ''$IP $CONF;
sed -i ''/^\\[global\\]/a mon addr = ''$IP'':6789'' $CONF;
sed -i ''/^\\[global\\]/a mon initial members = {{ $initial_mon }}'' $CONF;
sed -i ''s/@HOSTADDR@/''$IP''/g;s/@CLUSTERADDR@/''$IP''/g'' /srv/pod-main-config/config.json;"
],
"volumeMounts": [
{
"name": "ceph-osd-config",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
},
{
"name": "ceph-osd",
"mountPath": "/var/lib/ceph/osd"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
nodeSelector:
kubernetes.io/hostname: {{ $initial_mon }}
restartPolicy: Never
initContainers:
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-osd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i '/^mon host.*/d;/^mon host/d;/^mon addr/d' $CONF;
sed -i '/^\[global\]/a mon host = '$IP $CONF;
sed -i '/^\[global\]/a mon addr = '$IP':6789' $CONF;
sed -i '/^\[global\]/a mon initial members = {{ $initial_mon }}' $CONF;
sed -i 's/@HOSTADDR@/'$IP'/g;s/@CLUSTERADDR@/'$IP'/g' /srv/pod-main-config/config.json;
volumeMounts:
- name: ceph-osd-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: ceph-osd
mountPath: /var/lib/ceph/osd
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy }}

View File

@ -27,39 +27,31 @@ spec:
labels:
component: tgtd
system: tgtd
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-tgtd",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"-ce",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/tgtd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F);
storage_ip=$(ip addr list \"$STORAGE_INTERFACE\" | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
jq ''.command = \"tgtd -d 1 -f --iscsi portal=''$storage_ip'':3260\"'' /srv/configmap/..data/config.json > /srv/pod-main-config/config.json; "],
"volumeMounts": [
{
"name": "tgtd-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
initContainers:
{{- include "common_dependency_container" $env | indent 8 }}
- name: initialize-tgtd
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: {{ $imagePullPolicy | quote }}
command:
- sh
- -ce
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/tgtd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F);
storage_ip=$(ip addr list "$STORAGE_INTERFACE" | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
jq '.command = "tgtd -d 1 -f --iscsi portal='$storage_ip':3260"' /srv/configmap/..data/config.json > /srv/pod-main-config/config.json;
volumeMounts:
- name: tgtd-configmap
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}