Adding chart for docker registry and serving master images

Docker registry will be running as a pod, if configured, it will load
tarball with images and start serviceg then inside of a kubernetes cluster.

Change-Id: I9b0df3c27148b22b204403a38e8b49495e31e03f
This commit is contained in:
Serguei Bezverkhi 2017-07-14 14:30:38 -04:00
parent 13324268cd
commit 50fc348e39
9 changed files with 205 additions and 9 deletions

View File

@ -0,0 +1,11 @@
apiVersion: v1
version: 0.7.0-1
description: private docker registry
name: registry-deployment
keywords:
- docker
- registry
home: http://www.openstack.org
sources:
- http://github.com/openstack
engine: gotpl

View File

@ -0,0 +1,79 @@
{{- $replicas := .Values.replicas }}
{{- $svcName := .Values.svc_name }}
{{- $initLoad := .Values.initial_load }}
{{- $distro := .Values.distro }}
{{- $type := .Values.type }}
{{- $branch := .Values.branch }}
{{- $nodePort := .Values.node_port }}
{{- $initImage := .Values.init_image }}
{{- $initImageV := .Values.init_image_version }}
{{- $registryImage := .Values.registry_image }}
{{- $registryImageV := .Values.registry_image_version }}
{{- $tarballURL := .Values.tarball_url }}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ $svcName }}
spec:
replicas: {{ $replicas }}
template:
metadata:
labels:
service: {{ $svcName }}
spec:
initContainers:
- name: init-myservice
image: "{{ $initImage }}:{{ $initImageV }}"
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -ec
- |
{{- if $initLoad }}
fn='{{ $distro }}-{{ $type }}-registry-{{ $branch }}.tar.gz';
echo $fn;
curl {{ $tarballURL }}$fn | tar -C /var/lib/registry/ -xzvf -;
{{- end }}
echo Registry is all ready serving images...;
volumeMounts:
- name: image-store
mountPath: /var/lib/registry
containers:
- name: registry
image: "{{ $registryImage }}:{{ $registryImageV }}"
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 256Mi
env:
- name: REGISTRY_HTTP_ADDR
value: ":4000"
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
value: "/var/lib/registry"
volumeMounts:
- name: image-store
mountPath: /var/lib/registry
ports:
- containerPort: 4000
name: registry
protocol: TCP
volumes:
- name: image-store
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $svcName }}
spec:
selector:
service: {{ $svcName }}
ports:
- name: registry
port: 4000
protocol: TCP
nodePort: {{ $nodePort }}
type: NodePort
---

View File

@ -0,0 +1,12 @@
svc_name: kube-registry
node_port: 30400
initial_load: false
replicas: 1
distro: centos
type: source
branch: master
init_image: centos
init_image_version: latest
registry_image: registry
registry_image_version: 2
tarball_url: http://tarballs.openstack.org/kolla/images/

View File

@ -0,0 +1,48 @@
function common_iscsi_config {
echo "global:"
echo " kolla:"
echo " all:"
echo " docker_registry: 127.0.0.1:30401"
echo " docker_namespace: lokolla"
echo " image_tag: 5.0.0"
echo " storage_provider: host"
echo " install_type: source"
echo " storage_provider_fstype: xfs"
echo " ceph_backend: false"
echo " kolla_toolbox_image_tag: 5.0.0"
echo " haproxy_image_tag: 5.0.0"
echo " fluentd_image_tag: 5.0.0"
echo " kubernetes_entrypoint_image_tag: 5.0.0"
echo " lvm_backends:"
echo " - '172.18.0.1': 'cinder-volumes'"
echo " cinder:"
echo " all:"
echo " image_tag: 5.0.0"
echo " volume_lvm:"
echo " all:"
echo " element_name: cinder-volume"
echo " nova:"
echo " all:"
echo " image_tag: 5.0.0"
echo " placement_api_enabled: true"
echo " cell_enabled: true"
echo " api:"
echo " create_cell:"
echo " job:"
echo " cell_wait_compute: false"
echo " ironic:"
echo " all:"
echo " image_tag: 5.0.0"
echo " conductor:"
echo " all:"
echo " ironic_api_ip: 172.21.0.10"
echo " ironic_provision_cidr: 172.21.0.0/24"
echo " inspector:"
echo " all:"
echo " initramfs_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.gz"
echo " kernel_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.vmlinuz"
echo " ironic_dhcp_range: net2,172.22.0.10,172.22.0.20,255.255.255.0"
echo " horizon:"
echo " all:"
echo " image_tag: 5.0.0"
}

View File

@ -13,6 +13,7 @@ function iscsi_config {
function check_for_nova {
for service in nova-scheduler nova-conductor nova-compute;
do
nova service-list
str=$(nova service-list | grep $service | awk '{print $12}')
status=${str%%[[:space:]]*}
if [ "x$status" != "xup" ]; then
@ -27,7 +28,7 @@ function wait_for_openstack {
count=0
while true; do
[ $count -gt 60 ] && echo Wait for openstack services failed... \
&& return -1
&& return 1
echo "Check for nova"
check_for_nova
retcode=$?
@ -40,6 +41,7 @@ function wait_for_openstack {
fi
done
set -e
return 0
}
function deploy_iscsi_common {
@ -61,11 +63,15 @@ IRONIC_CONDUCTOR_IP=${6:-172.21.0.10}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
. "$DIR/tests/bin/common_workflow_config.sh"
if [ "x$branch" == "x4" ]; then
. "$DIR/tests/bin/common_iscsi_config_v4.sh"
else
. "$DIR/tests/bin/common_iscsi_config.sh"
fi
case "$branch" in
4) . "$DIR/tests/bin/common_iscsi_config_v4.sh"
;;
t) . "$DIR/tests/bin/common_iscsi_config_v5.sh"
;;
*) . "$DIR/tests/bin/common_iscsi_config.sh"
;;
esac
general_config $IP $base_distro $tunnel_interface $branch > /tmp/general_config.yaml
iscsi_config > /tmp/iscsi_config.yaml
@ -528,7 +534,14 @@ $DIR/tools/wait_for_pods.sh kolla
$DIR/tools/build_local_admin_keystonerc.sh
. ~/keystonerc_admin
wait_for_openstack
#
# NOTE(sbezverk) In current master nova service-list commands
# comes back empty if cell has not been already deployed.
# As a result we cannot wait for nova services to be up and
# need to deploy cell0 right away.
if [ "x$branch" != "xt" ]; then
wait_for_openstack
fi
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-cell0-create-db-job --version $VERSION \

View File

@ -194,6 +194,10 @@ def main():
merge_dict(pkg_values, values['common-mariadb'])
if package in values:
merge_dict(pkg_values, values[package])
if package == "registry-deployment":
sys.stdout.write("\rSkip registry chart")
sys.stdout.flush()
continue
with open(os.path.join(microdir, package, "values.yaml"), "w") as f:
f.write("# This file is generated. Please edit all_values.yaml\n")
f.write("# and rerun tools/helm_prebuild.py\n")

View File

@ -28,8 +28,12 @@ case "$BRANCH" in
sed -i 's/2\.0\.2/4.0.0/g' tests/conf/ceph-all-in-one/kolla_config
;;
"t" )
echo Version: $BRANCH is not implemented yet.
exit 1
sed -i 's/2\.0\.2/5.0.0/g' helm/all_values.yaml
sed -i 's/2\.0\.2/5.0.0/g' tests/conf/ceph-all-in-one/kolla_config
if [ "x$4" != "xiscsi" ]; then
echo CEPH workflow for branch "$BRANCH" is not implemented yet. Exiting...
exit 1
fi
;;
"2" )
sed -i 's/cell_enabled.*/cell_enabled: false/g' helm/service/nova-control/values.yaml

View File

@ -77,6 +77,9 @@ elif [ "x$4" == "xironic" ]; then
elif [ "x$4" == "xhelm-operator" ]; then
echo "Not yet implemented..." "$4" "$2" "$BRANCH"
else
if [ "x$BRANCH" == "xt" ]; then
tools/setup_registry.sh $DISTRO $TYPE $BRANCH
fi
tests/bin/iscsi_generic_workflow.sh "$4" "$2" "$BRANCH"
fi

22
tools/setup_registry.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash -e
#
# Passed parameters: $1 - Distro, $2 - Type,
# $3 - Branch
#
Distro="$1"
Type="$2"
Branch="$3"
VERSION=0.7.0-1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
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 distro=$Distro --set type=$Type
$DIR/wait_for_pods.sh kolla 600
echo "Registry with images for: $Distro - $Type - $Branch is running..."