Merge "Helm Test Ceph Init OSD"

This commit is contained in:
Jenkins 2017-03-27 22:46:16 +00:00 committed by Gerrit Code Review
commit 8acb3ba322
5 changed files with 172 additions and 6 deletions

View File

@ -73,6 +73,12 @@ test-ceph-mon-daemonset:
all:
storage_interface: eth0
test-ceph-initial-osd-job:
global:
kolla:
all:
storage_interface: eth0
keystone-admin-svc:
global:
kolla:

View File

@ -0,0 +1,13 @@
name: test-ceph-init-osd-job
version: 0.6.0-1 #FIXME make this changable
description: ceph-init-osd job for kolla-kubernetes
keywords:
- openstack
- test
- ceph
- osd
- initial
sources:
- http://github.com/openstack
engine: gotpl
#icon: A URL to an SVG or PNG image to be used as an icon (optional). make this point to the new project icons when ready

View File

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

View File

@ -0,0 +1,129 @@
{{- $resourceName := "test-ceph-init-mon-job" }}
{{- $searchPath := ":global.kolla.ceph.osd.init.job:global.kolla.ceph.osd.all:global.kolla.ceph.all:global.kolla.all" }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "ceph-osd" }}
{{- $_ := 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 ) }}
{{- $storageInterface := include "kolla_val_get_str" (dict "key" "storage_interface" "searchPath" $searchPath "Values" .Values ) }}
{{- $node := include "kolla_val_get_str" (dict "key" "node" "searchPath" $searchPath "Values" .Values ) }}
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
{{- $index := .Values.index }}
{{- $initial_mon := .Values.initial_mon }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" false "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
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
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy }}
name: main
securityContext:
privileged: true
env:
{{- include "common_bootstrap_env_vars" . | indent 8 }}
- name: KOLLA_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: COPY_ONCE
- name: USE_EXTERNAL_JOURNAL
value: "True"
- name: JOURNAL_DEV
value: "/dev/loop{{ $index }}"
- name: JOURNAL_PARTITION_NUM
value: "1"
- name: JOURNAL_PARTITION
value: "/dev/loop{{ $index }}p1"
- name: OSD_DEV
value: "/dev/loop{{ $index }}"
- name: OSD_PARTITION_NUM
value: "2"
- name: OSD_PARTITION
value: "/dev/loop{{ $index }}p2"
- name: OSD_INITIAL_WEIGHT
value: "1"
- name: OSD_FILESYSTEM
value: "xfs"
- name: HOSTNAME
value: {{ $initial_mon }}
volumeMounts:
{{- include "common_volume_mounts" $env | indent 8 }}
- mountPath: {{ $containerConfigDirectory }}/ceph.conf
name: pod-main-config
readOnly: true
subPath: ceph.conf
- mountPath: {{ $containerConfigDirectory }}/config.json
name: pod-main-config
readOnly: true
subPath: config.json
- mountPath: /var/lib/ceph
name: ceph-osd
- mountPath: {{ $containerConfigDirectory }}/ceph.client.admin.keyring
subPath: data
name: ceph-client-admin-keyring
- mountPath: /dev
name: host-dev
volumes:
{{- include "common_volumes" $env | indent 4 }}
- name: pod-main-config
emptyDir: {}
- name: ceph-osd-config
configMap:
name: ceph-osd
- name: ceph-osd
hostPath:
path: /var/lib/kolla/volumes/ceph-osd
- name: host-dev
hostPath:
path: /dev
- name: ceph-client-admin-keyring
secret:
secretName: ceph-client-admin-keyring
{{- end }}

View File

@ -1,5 +1,7 @@
#!/bin/bash -xe
VERSION=0.6.0-1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
IP="$3"
base_distro="$2"
@ -16,6 +18,7 @@ function ceph_config {
echo "node: $(hostname -s)"
echo "storage_interface: $tunnel_interface"
echo "initial_member: $(hostname -s)"
echo "initial_mon: $(hostname -s)"
echo "ceph:"
echo " monitors:"
echo " - $IP"
@ -41,7 +44,7 @@ function wait_for_ceph_bootstrap {
kollakube res create configmap ceph-mon ceph-osd
helm install kolla/test-ceph-init-mon-job --version 0.6.0-1 \
helm install kolla/test-ceph-init-mon-job --version $VERSION \
--namespace kolla \
--name test-ceph-init-mon-job \
--values /tmp/general_config.yaml \
@ -52,7 +55,7 @@ $DIR/tools/wait_for_pods.sh kolla
$DIR/tools/setup-ceph-secrets.sh
helm install kolla/test-ceph-mon-daemonset --version 0.6.0-1 \
helm install kolla/test-ceph-mon-daemonset --version $VERSION \
--namespace kolla \
--name test-ceph-mon-daemonset \
--values /tmp/general_config.yaml \
@ -60,19 +63,30 @@ helm install kolla/test-ceph-mon-daemonset --version 0.6.0-1 \
$DIR/tools/wait_for_pods.sh kolla
kollakube res create pod ceph-bootstrap-osd0
helm install kolla/test-ceph-init-osd-job --version $VERSION \
--namespace kolla \
--name test-ceph-init-osd0-job \
--values /tmp/general_config.yaml \
--values /tmp/ceph_config.yaml \
--set index=0
$DIR/tools/pull_containers.sh kolla
$DIR/tools/wait_for_pods.sh kolla
wait_for_ceph_bootstrap kolla
kollakube res create pod ceph-bootstrap-osd1
helm install kolla/test-ceph-init-osd-job --version $VERSION \
--namespace kolla \
--name test-ceph-init-osd1-job \
--values /tmp/general_config.yaml \
--values /tmp/ceph_config.yaml \
--set index=1
$DIR/tools/wait_for_pods.sh kolla
wait_for_ceph_bootstrap kolla
kollakube res delete pod ceph-bootstrap-osd0
kollakube res delete pod ceph-bootstrap-osd1
helm delete --purge test-ceph-init-osd0-job
helm delete --purge test-ceph-init-osd1-job
kollakube res create pod ceph-osd0
kollakube res create pod ceph-osd1