Adding lioadm iscsi_helper support to master

Adding support for lioadm as iscsi_helper for iscsi lvm
backend for cinder and converting gate job for master branch
to use lioadm helper instead of tgtadm.

Change-Id: I8beabd10755bb04c4819263e54170a780b879716
This commit is contained in:
Serguei Bezverkhi 2017-07-07 12:12:23 -04:00
parent 2b8479b88d
commit 497269c3d8
15 changed files with 294 additions and 29 deletions

View File

@ -1066,14 +1066,6 @@ tgtd-daemonset:
all:
storage_interface: eth0
cinder-volume-lvm-daemonset:
global:
kolla:
cinder:
volume_lvm:
daemonset:
lvm_backends: []
helm-repo-svc:
global:
kolla:

View File

@ -20,6 +20,7 @@
{{- $_ := set $c1 "retDict" $localVals }}
{{- $_ := set $c1 "retKey" "lvm_backends" }}
{{- $_ := include "kolla_val_get_raw" $c1 }}
{{- $iscsiHelper := include "kolla_val_get_str" (dict "key" "iscsi_helper" "searchPath" $searchPath "Values" .Values ) | default "tgtadm"}}
{{- $elementName := include "kolla_val_get_str" (dict "key" "element_name" "searchPath" $searchPath "Values" .Values ) | default $resourceName }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "privileged" $privileged "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: extensions/v1beta1
@ -54,11 +55,12 @@ spec:
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 ''tgtadm'';
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 }} "],
{{- end }}
"],
"volumeMounts": [
{
"name": "cinder-volume-configmap",
@ -85,6 +87,30 @@ spec:
"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:
@ -117,6 +143,8 @@ spec:
name: cinder-volumes
- mountPath: /etc/iscsi
name: iscsi-info
- mountPath: /etc/target
name: iscsi-target
{{- include "common_containers" . | indent 8 }}
volumes:
{{- include "common_volumes" . | indent 8 }}
@ -142,5 +170,8 @@ spec:
path: /sys/fs/cgroup
- name: iscsi-info
hostPath:
path: /etc/iscsi
path: /var/lib/kolla/iscsi
- name: iscsi-target
hostPath:
path: /var/lib/kolla/target
{{- end }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
version: 0.7.0-1
description: iscsi target microservice layer
name: iscsi-target-daemonset
keywords:
- openstack
- iscsi-target
home: http://www.openstack.org
sources:
- http://github.com/openstack
engine: gotpl

View File

@ -0,0 +1,4 @@
dependencies:
- name: kolla-common
repository: file://../../kolla-common
version: 0.7.0-1

View File

@ -0,0 +1,132 @@
{{- $resourceName := "iscsi-target" }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- $elementName := .Values.element_name | default $resourceName }}
{{- $searchPath := printf ":global.kolla.%s.daemonset:global.kolla.iscsi-target.daemonset:global.kolla.iscsi-target.all:global.kolla.all" $elementName }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "cinder-volume" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorKey := include "kolla_val_get_str" (dict "key" "selector_key" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }}
{{- $storageInterface := include "kolla_val_get_str" (dict "key" "storage_interface" "searchPath" $searchPath "Values" .Values ) }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: {{ $elementName }}
labels:
component: iscsi-target
system: iscsi-target
spec:
template:
metadata:
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 }}
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy | quote }}
lifecycle:
preStop:
exec:
command:
- /bin/bash
- -c
- echo "Saving targets..."; ls /usr/bin; [ -f /etc/target/saveconfig.json ] && /usr/bin/targetctl save || true;
postStart:
exec:
command:
- /bin/bash
- -c
- echo "Restoring targets..."; ls /usr/bin;[ -f /etc/target/saveconfig.json ] && /usr/bin/targetctl restore || true;
name: main
securityContext:
privileged: true
runAsUser: 0
env:
{{- include "common_env_vars" $env | indent 12 }}
command:
- /bin/bash
- -ec
- |
modprobe iscsi_target_mod;
while true; do sleep 10000; done;
volumeMounts:
{{- include "common_volume_mounts" $env | indent 12 }}
- mountPath: /run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/lib/cinder
name: cinder-volumes
- mountPath: /etc/iscsi
name: iscsi-info
- mountPath: /etc/target
name: iscsi-target
{{- include "common_containers" . | indent 8 }}
volumes:
{{- include "common_volumes" . | indent 8 }}
- name: cinder-volumes
hostPath:
path: /var/lib/cinder
- name: lib-modules
hostPath:
path: /lib/modules
- name: run
hostPath:
path: /run
- name: dev
hostPath:
path: /dev
- name: sys-fs-cgroup
hostPath:
path: /sys/fs/cgroup
- name: iscsi-info
hostPath:
path: /var/lib/kolla/iscsi
- name: iscsi-target
hostPath:
path: /var/lib/kolla/target
{{- end }}

View File

@ -34,9 +34,12 @@ spec:
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"command": [
"sh",
"bash",
"-ce",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/; "],
"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",
@ -47,6 +50,35 @@ spec:
"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:
@ -99,5 +131,5 @@ spec:
path: /sys/fs/cgroup
- name: iscsi-info
hostPath:
path: /etc/iscsi
path: /var/lib/kolla/iscsi
{{- end }}

View File

@ -122,6 +122,30 @@ spec:
"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:
@ -151,6 +175,8 @@ spec:
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /etc/iscsi
name: iscsi-info
env:
{{- include "common_env_vars" $env | indent 12 }}
{{- include "common_containers" $env | indent 8 }}
@ -176,6 +202,9 @@ spec:
path: /sys/fs/cgroup
- name: nova-config
emptyDir: {}
- name: iscsi-info
hostPath:
path: /var/lib/kolla/iscsi
{{- if $localVals.ceph_backend }}
- name: ceph-conf
configMap:

View File

@ -2,7 +2,7 @@
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- $elementName := .Values.element_name | default $resourceName }}
{{- $searchPath := printf ":global.kolla.%s.daemonset:global.kolla.%s.daemonset:global.kolla.tgtd.daemonset:global.kolla.tgtd.all:global.kolla.tgtd.all:global.kolla.all" $elementName $elementName }}
{{- $searchPath := printf ":global.kolla.%s.daemonset:global.kolla.tgtd.daemonset:global.kolla.%s.all:global.kolla.tgtd.all:global.kolla.all" $elementName $elementName }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "tgtd" }}
{{- $_ := set $c "imageName" "image_full" }}

View File

@ -127,6 +127,8 @@ openstack volume create --size 1 test
wait_for_cinder test creating
openstack server add volume test test
wait_for_cinder test available
wait_for_cinder test attaching
FIP=$(openstack floating ip create external -f value -c floating_ip_address)
FIP2=$(openstack floating ip create external -f value -c floating_ip_address)

View File

@ -3,6 +3,7 @@ function common_iscsi_config {
echo " kolla:"
echo " all:"
echo " storage_provider: host"
echo " storage_interface: br-ex"
echo " storage_provider_fstype: xfs"
echo " ceph_backend: false"
echo " lvm_backends:"

View File

@ -7,14 +7,20 @@ function common_iscsi_config {
echo " install_type: source"
echo " storage_provider_fstype: xfs"
echo " ceph_backend: false"
echo " storage_interface: br-ex"
echo " iscsi_helper: tgtadm"
echo " lvm_backends:"
echo " - '172.18.0.1': 'cinder-volumes'"
echo " cinder:"
echo " all:"
echo " image_tag: 4.0.0"
echo " volume_lvm:"
echo " all:"
echo " daemonset:"
echo " element_name: cinder-volume"
echo " api:"
echo " all:"
echo " port_external: true"
echo " port: 8776"
echo " nova:"
echo " all:"
echo " image_tag: 4.0.0"

View File

@ -13,6 +13,7 @@ function common_iscsi_config {
echo " haproxy_image_tag: 5.0.0"
echo " fluentd_image_tag: 5.0.0"
echo " kubernetes_entrypoint_image_tag: 5.0.0"
echo " iscsi_helper: lioadm"
echo " lvm_backends:"
echo " - '172.18.0.1': 'cinder-volumes'"
echo " cinder:"

View File

@ -136,7 +136,7 @@ helm install kolla/nova-novncproxy-svc --version $VERSION \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-svc --debug --version $VERSION \
helm install kolla/nova-placement-svc --version $VERSION \
--namespace kolla --name nova-placement-svc \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -234,14 +234,14 @@ $DIR/tools/wait_for_pods.sh kolla
#
sudo ifconfig br-ex up
helm install kolla/keepalived-daemonset --debug --version $VERSION \
helm install kolla/keepalived-daemonset --version $VERSION \
--namespace kolla --name keepalived-daemonset \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
$DIR/tools/wait_for_pods.sh kolla
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-create-keystone-service-job --debug --version $VERSION \
helm install kolla/nova-placement-create-keystone-service-job --version $VERSION \
--namespace kolla --name nova-placement-create-keystone-service \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -269,7 +269,7 @@ helm install kolla/cinder-create-keystone-service-job --version $VERSION \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-create-keystone-user-job --debug --version $VERSION \
helm install kolla/nova-placement-create-keystone-user-job --version $VERSION \
--namespace kolla --name nova-placement-create-keystone-user \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -315,7 +315,7 @@ helm install kolla/nova-create-keystone-endpoint-public-job --version $VERSION \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-create-keystone-endpoint-public-job --debug --version $VERSION \
helm install kolla/nova-placement-create-keystone-endpoint-public-job --version $VERSION \
--namespace kolla --name nova-placement-create-keystone-endpoint-public \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -355,11 +355,11 @@ helm install kolla/cinder-manage-db-job --version $VERSION \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-create-keystone-endpoint-internal-job --debug --version $VERSION \
helm install kolla/nova-placement-create-keystone-endpoint-internal-job --version $VERSION \
--namespace kolla --name nova-placement-create-keystone-endpoint-internal \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
helm install kolla/nova-placement-create-keystone-endpoint-admin-job --debug --version $VERSION \
helm install kolla/nova-placement-create-keystone-endpoint-admin-job --version $VERSION \
--namespace kolla --name nova-placement-create-keystone-endpoint-admin \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -472,7 +472,7 @@ for x in nova-api nova-novncproxy; do
done
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-placement-deployment --debug --version $VERSION \
helm install kolla/nova-placement-deployment --version $VERSION \
--namespace kolla --name nova-placement-deployment \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
@ -525,13 +525,22 @@ helm install kolla/iscsid-daemonset --version $VERSION \
--namespace kolla --name iscsid-daemonset \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
helm install kolla/tgtd-daemonset --version $VERSION \
--namespace kolla --name tgtd-daemonset \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
if [ "x$branch" != "x2" -a "x$branch" != "x3" -a "x$branch" != "x4" ]; then
helm install kolla/iscsi-target-daemonset --version $VERSION \
--namespace kolla --name iscsi-target-daemonset \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
else
helm install kolla/tgtd-daemonset --version $VERSION \
--namespace kolla --name tgtd-daemonset \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml
fi
$DIR/tools/pull_containers.sh kolla
$DIR/tools/wait_for_pods.sh kolla
$DIR/tools/build_local_admin_keystonerc.sh
kubectl get pods -n kolla
. ~/keystonerc_admin
#

View File

@ -1,5 +1,13 @@
#!/bin/bash -xe
#
# Loading mirrors info for traffic optimization.
#
if [ -f /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
echo "Suggested proxy url: $NODEPOOL_TARBALLS_PROXY"
fi
PACKAGE_VERSION=0.7.0-1
DISTRO="$2"
TYPE="$3"

View File

@ -10,13 +10,20 @@ VERSION=0.7.0-1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
echo "Deploying registry for: $Distro - $Type - $Branch"
echo "Suggested tarball url for traffic optimization is: $NODEPOOL_TARBALLS_PROXY"
if [ "x$NODEPOOL_TARBALLS_PROXY" == "x" ]; then
tarball_url="http://tarballs.openstack.org/kolla/images/"
else
tarball_url="$NODEPOOL_TARBALLS_PROXY/kolla/images/"
fi
echo "Deploying registry for: $Distro - $Type - $Branch"
helm install kolla/registry-deployment --version $VERSION --debug \
--namespace kolla --name registry \
--set initial_load=true --set node_port=30401 \
--set tarball_url=$tarball_url \
--set distro=$Distro --set type=$Type
$DIR/wait_for_pods.sh kolla 600
$DIR/wait_for_pods.sh kolla 900
echo "Registry with images for: $Distro - $Type - $Branch is running..."