Adding support for glance serivce.

Signed-off-by: DTadrzak <daniel.tadrzak@intel.com>
This commit is contained in:
DTadrzak 2016-12-06 17:21:39 +01:00
parent 7c0b031035
commit ba37e1cabe
19 changed files with 593 additions and 0 deletions

3
glance/Chart.yaml Normal file
View File

@ -0,0 +1,3 @@
description: A Helm chart for glance
name: glance
version: 0.1.0

19
glance/requirements.yaml Normal file
View File

@ -0,0 +1,19 @@
dependencies:
- name: common
repository: http://localhost:8879/charts
version: 0.1.0
- name: mariadb
repository: http://localhost:8879/charts
version: 0.1.0
- name: rabbitmq
repository: http://localhost:8879/charts
version: 0.1.0
- name: memcached
repository: http://localhost:8879/charts
version: 0.1.0
- name: keystone
repository: http://localhost:8879/charts
version: 0.1.0
- name: keystone
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,5 @@
{{- define "joinListWithColon" -}}
{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }}
{{- end -}}
{{ define "keystone_auth" }}auth: "{'auth_url':'{{ .Values.keystone.auth_url }}', 'username':'{{ .Values.keystone.admin_user }}','password':'{{ .Values.keystone.admin_password }}','project_name':'{{ .Values.keystone.admin_project_name }}','domain_name':'default'}"{{end}}

80
glance/templates/api.yaml Normal file
View File

@ -0,0 +1,80 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: glance-api
spec:
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: glance-api
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",
"image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
"env": [
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" .Values.dependencies.api.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" .Values.dependencies.api.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
]'
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: glance-api
image: {{ .Values.images.api }}
imagePullPolicy: Always
command:
- bash
- /tmp/start.sh
ports:
- containerPort: {{ .Values.network.port.api }}
readinessProbe:
tcpSocket:
port: {{ .Values.network.port.api }}
volumeMounts:
- name: glanceapiconf
mountPath: /etc/glance/glance-api.conf
subPath: glance-api.conf
- name: startsh
mountPath: /tmp/start.sh
subPath: start.sh
- name: etcglance
mountPath: /etc/glance
- name: cephconf
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
- name: cephclientglancekeyring
mountPath: /etc/ceph/ceph.client.{{ .Values.ceph.glance_user }}.keyring
subPath: ceph.client.{{ .Values.ceph.glance_user }}.keyring
volumes:
- name: glanceapiconf
configMap:
name: glance-glanceapiconf
- name: startsh
configMap:
name: glance-startsh
- name: cephconf
configMap:
name: glance-cephconf
- name: cephclientglancekeyring
configMap:
name: glance-cephclientglancekeyring
- name: etcglance
emptyDir: {}

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-cephclientglancekeyring
data:
ceph.client.{{ .Values.ceph.glance_user }}.keyring: |+
[client.{{ .Values.ceph.glance_user }}]
key = {{ .Values.ceph.glance_keyring }}

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-cephconf
data:
ceph.conf: |+
[global]
rgw_thread_pool_size = 1024
rgw_num_rados_handles = 100
[mon]
{{ range .Values.ceph.monitors }}
[mon.{{ . }}]
host = {{ . }}
mon_addr = {{ . }}
{{ end }}
[client]
rbd_cache_enabled = true
rbd_cache_writethrough_until_flush = true

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-dbsyncsh
data:
db-sync.sh: |+
#!/bin/bash
set -ex
glance-manage db_sync

View File

@ -0,0 +1,55 @@
apiVersion: batch/v1
kind: Job
metadata:
name: glance-db-sync
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",
"image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
"env": [
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
]'
spec:
restartPolicy: OnFailure
containers:
- name: glance-db-sync
image: {{ .Values.images.db_sync }}
imagePullPolicy: Always
command:
- bash
- /tmp/db-sync.sh
volumeMounts:
- name: glanceapiconf
mountPath: /etc/glance/glance-api.conf
subPath: glance-api.conf
- name: dbsyncsh
mountPath: /tmp/db-sync.sh
subPath: db-sync.sh
volumes:
- name: glanceapiconf
configMap:
name: glance-glanceapiconf
- name: dbsyncsh
configMap:
name: glance-dbsyncsh

View File

@ -0,0 +1,47 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-glanceapiconf
data:
glance-api.conf: |+
[DEFAULT]
debug = {{ .Values.misc.debug }}
use_syslog = False
use_stderr = True
bind_port = {{ .Values.network.port.api }}
workers = {{ .Values.misc.workers }}
registry_host = glance-registry
# Enable Copy-on-Write
show_image_direct_url = True
[database]
connection = mysql+pymysql://{{ .Values.database.glance_user }}:{{ .Values.database.glance_password }}@{{ .Values.database.address }}/{{ .Values.database.glance_database_name }}
max_retries = -1
[keystone_authtoken]
auth_uri = {{ .Values.keystone.auth_uri }}
auth_url = {{ .Values.keystone.auth_url }}
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = {{ .Values.keystone.glance_user }}
password = {{ .Values.keystone.glance_password }}
[paste_deploy]
flavor = keystone
[oslo_messaging_notifications]
driver = noop
[glance_store]
filesystem_store_datadir = /var/lib/glance/images/
stores = file, http, rbd
default_store = rbd
rbd_store_pool = {{ .Values.ceph.glance_pool }}
rbd_store_user = {{ .Values.ceph.glance_user }}
rbd_store_ceph_conf = /etc/ceph/ceph.conf
rbd_store_chunk_size = 8

View File

@ -0,0 +1,34 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-glanceregistryconf
data:
glance-registry.conf: |+
[DEFAULT]
debug = {{ .Values.misc.debug }}
use_syslog = False
use_stderr = True
bind_port = {{ .Values.network.port.registry }}
workers = {{ .Values.misc.workers }}
[database]
connection = mysql+pymysql://{{ .Values.database.glance_user }}:{{ .Values.database.glance_password }}@{{ .Values.database.address }}/{{ .Values.database.glance_database_name }}
max_retries = -1
[keystone_authtoken]
auth_uri = {{ .Values.keystone.auth_uri }}
auth_url = {{ .Values.keystone.auth_url }}
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = {{ .Values.keystone.glance_user }}
password = {{ .Values.keystone.glance_password }}
[paste_deploy]
flavor = keystone
[oslo_messaging_notifications]
driver = noop

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-initsh
data:
init.sh: |+
#!/bin/bash
set -ex
export HOME=/tmp
ansible localhost -vvv -m mysql_db -a "login_host='{{ .Values.database.address }}' login_port='{{ .Values.database.port }}' login_user='{{ .Values.database.root_user }}' login_password='{{ .Values.database.root_password }}' name='{{ .Values.database.glance_database_name }}'"
ansible localhost -vvv -m mysql_user -a "login_host='{{ .Values.database.address }}' login_port='{{ .Values.database.port }}' login_user='{{ .Values.database.root_user }}' login_password='{{ .Values.database.root_password }}' name='{{ .Values.database.glance_user }}' password='{{ .Values.database.glance_password }}' host='%' priv='{{ .Values.database.glance_database_name }}.*:ALL' append_privs='yes'"

View File

@ -0,0 +1,52 @@
apiVersion: batch/v1
kind: Job
metadata:
name: glance-init
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",
"image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
"env": [
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" .Values.dependencies.init.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" .Values.dependencies.init.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
]'
spec:
restartPolicy: OnFailure
containers:
- name: glance-init
image: {{ .Values.images.init }}
imagePullPolicy: Always
env:
- name: ANSIBLE_LIBRARY
value: /usr/share/ansible/
command:
- bash
- /tmp/init.sh
volumeMounts:
- name: initsh
mountPath: /tmp/init.sh
subPath: init.sh
volumes:
- name: initsh
configMap:
name: glance-initsh

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-postsh
data:
post.sh: |+
#!/bin/bash
set -ex
export HOME=/tmp
ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=admin region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }"
ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=internal region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }"
ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=public region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}' " -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }"
ansible localhost -vvv -m kolla_keystone_user -a "project=service user={{ .Values.keystone.glance_user }} password={{ .Values.keystone.glance_password }} role=admin region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{'openstack_glance_auth': {{ include "keystone_auth" .}}}"

View File

@ -0,0 +1,49 @@
apiVersion: batch/v1
kind: Job
metadata:
name: glance-post
spec:
template:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",
"image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
"env": [
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" .Values.dependencies.post.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" .Values.dependencies.post.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
]'
spec:
restartPolicy: OnFailure
containers:
- name: glance-post
image: {{ .Values.images.post }}
imagePullPolicy: Always
command:
- bash
- /tmp/post.sh
volumeMounts:
- name: postsh
mountPath: /tmp/post.sh
subPath: post.sh
volumes:
- name: postsh
configMap:
name: glance-postsh

View File

@ -0,0 +1,57 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: glance-registry
spec:
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: glance-registry
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",
"image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
"env": [
{
"name": "NAMESPACE",
"value": "{{ .Release.Namespace }}"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" .Values.dependencies.registry.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" .Values.dependencies.registry.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
]'
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: glance-registry
image: {{ .Values.images.registry }}
imagePullPolicy: Always
command:
- glance-registr
ports:
- containerPort: {{ .Values.network.port.registry }}
readinessProbe:
tcpSocket:
port: {{ .Values.network.port.registry }}
volumeMounts:
- name: glanceregistryconf
mountPath: /etc/glance/glance-registry.conf
subPath: glance-registry.conf
volumes:
- name: glanceregistryconf
configMap:
name: glance-glanceregistryconf

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: glance-api
spec:
ports:
- port: {{ .Values.network.port.api }}
selector:
app: glance-api

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: glance-registry
spec:
ports:
- port: {{ .Values.network.port.registry }}
selector:
app: glance-registry

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-startsh
data:
start.sh: |+
#!/bin/bash
set -ex
cp `find / -not -path "/etc/*" -name glance-api-paste.ini` /etc/glance/
glance-api

99
glance/values.yaml Normal file
View File

@ -0,0 +1,99 @@
# Default values for keystone.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
replicas: 1
labels:
node_selector_key: openstack-control-plane
node_selector_value: enabled
images:
db_sync: quay.io/stackanetes/stackanetes-glance-api:newton
api: quay.io/stackanetes/stackanetes-glance-api:newton
init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
registry: quay.io/stackanetes/stackanetes-glance-registry:newton
post: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
keystone:
auth_uri: "http://keystone-api:5000"
auth_url: "http://keystone-api:35357"
admin_user: "admin"
admin_password: "password"
admin_project_name: "admin"
admin_region_name: "RegionOne"
glance_user: "glance"
glance_password: "password"
glance_region_name: "RegionOne"
network:
port:
api: 9292
registry: 9191
ip_address: "{{ .IP }}"
database:
address: mariadb
port: 3306
root_user: root
root_password: password
glance_database_name: glance
glance_password: password
glance_user: glance
ceph:
enabled: true
monitors: []
glance_user: "glance"
glance_pool: "images"
glance_keyring: ""
misc:
workers: 8
debug: false
dependencies:
api:
jobs:
- glance-init
- glance-db-sync
- keystone-db-sync
service:
- keystone-api
- mariadb
registry:
jobs:
- glance-init
- glance-db-sync
- keystone-db-sync
service:
- keystone-api
- mariadb
- glance-api
db_sync:
jobs:
- keystone-init
- keystone-db-sync
- glance-init
- mariadb-seed
service:
- mariadb
init:
jobs:
- mariadb-seed
service:
- mariadb
post:
jobs:
- glance-init
- glance-db-sync
- keystone-db-sync
- keystone-init
- mariadb-init
service:
- mariadb
- keystone-api
- glance-api
- glance-registry