Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Commit bab88b8

Browse files
authored
Merge pull request #78 from portdirect/cinder
OpenStack Cinder Initial Commit
2 parents 8bcc3bc + 831f63d commit bab88b8

25 files changed

Lines changed: 1195 additions & 3 deletions

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
.PHONY: ceph bootstrap mariadb keystone memcached rabbitmq common openstack neutron heat maas all clean
1+
.PHONY: ceph bootstrap mariadb keystone memcached rabbitmq common openstack neutron cinder heat maas all clean
22

33
B64_DIRS := common/secrets
44
B64_EXCLUDE := $(wildcard common/secrets/*.b64)
55

6-
CHARTS := ceph mariadb rabbitmq GLANCE memcached keystone glance horizon neutron heat maas openstack
6+
CHARTS := ceph mariadb rabbitmq memcached keystone glance horizon neutron cinder heat maas openstack
77
COMMON_TPL := common/templates/_globals.tpl
88

9-
all: common ceph bootstrap mariadb rabbitmq memcached keystone glance horizon neutron heat maas openstack
9+
all: common ceph bootstrap mariadb rabbitmq memcached keystone glance horizon neutron cinder heat maas openstack
10+
1011

1112
common: build-common
1213

@@ -19,6 +20,8 @@ mariadb: build-mariadb
1920

2021
keystone: build-keystone
2122

23+
cinder: build-cinder
24+
2225
horizon: build-horizon
2326

2427
rabbitmq: build-rabbitmq

cinder/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: A Helm chart for cinder
2+
name: cinder
3+
version: 0.1.0

cinder/requirements.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dependencies:
2+
- name: common
3+
repository: http://localhost:8879/charts
4+
version: 0.1.0

cinder/templates/_helpers.tpl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file is required because we use a slightly different endpoint layout in
2+
# the values yaml, until we can make this change for all services.
3+
4+
5+
# this function returns the endpoint uri for a service, it takes an tuple
6+
# input in the form: service-type, endpoint-class, port-name. eg:
7+
# { tuple "orchestration" "public" "api" . | include "endpoint_type_lookup_addr" }
8+
# will return the appropriate URI. Once merged this should phase out the above.
9+
10+
{{- define "endpoint_type_lookup_addr" -}}
11+
{{- $type := index . 0 -}}
12+
{{- $endpoint := index . 1 -}}
13+
{{- $port := index . 2 -}}
14+
{{- $context := index . 3 -}}
15+
{{- $endpointMap := index $context.Values.endpoints $type }}
16+
{{- $fqdn := $context.Release.Namespace -}}
17+
{{- if $context.Values.endpoints.fqdn -}}
18+
{{- $fqdn := $context.Values.endpoints.fqdn -}}
19+
{{- end -}}
20+
{{- with $endpointMap -}}
21+
{{- $endpointScheme := .scheme }}
22+
{{- $endpointHost := index .hosts $endpoint | default .hosts.default}}
23+
{{- $endpointPort := index .port $port }}
24+
{{- $endpointPath := .path }}
25+
{{- printf "%s://%s.%s:%1.f%s" $endpointScheme $endpointHost $fqdn $endpointPort $endpointPath | quote -}}
26+
{{- end -}}
27+
{{- end -}}
28+
29+
30+
#-------------------------------
31+
# endpoint name lookup
32+
#-------------------------------
33+
34+
# this function is used in endpoint management templates
35+
# it returns the service type for an openstack service eg:
36+
# { tuple orchestration . | include "ks_endpoint_type" }
37+
# will return "heat"
38+
39+
{{- define "endpoint_name_lookup" -}}
40+
{{- $type := index . 0 -}}
41+
{{- $context := index . 1 -}}
42+
{{- $endpointMap := index $context.Values.endpoints $type }}
43+
{{- $endpointName := index $endpointMap "name" }}
44+
{{- $endpointName | quote -}}
45+
{{- end -}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -ex
3+
export HOME=/tmp
4+
5+
ansible localhost -vvv \
6+
-m mysql_db -a "login_host='{{ .Values.database.address }}' \
7+
login_port='{{ .Values.database.port }}' \
8+
login_user='{{ .Values.database.root_user }}' \
9+
login_password='{{ .Values.database.root_password }}' \
10+
name='{{ .Values.database.cinder_database_name }}'"
11+
12+
ansible localhost -vvv \
13+
-m mysql_user -a "login_host='{{ .Values.database.address }}' \
14+
login_port='{{ .Values.database.port }}' \
15+
login_user='{{ .Values.database.root_user }}' \
16+
login_password='{{ .Values.database.root_password }}' \
17+
name='{{ .Values.database.cinder_user }}' \
18+
password='{{ .Values.database.cinder_password }}' \
19+
host='%' \
20+
priv='{{ .Values.database.cinder_database_name }}.*:ALL' \
21+
append_privs='yes'"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: cinder-bin
5+
data:
6+
db-init.sh: |+
7+
{{ tuple "bin/_db-init.sh.tpl" . | include "template" | indent 4 }}
8+
ks-service.sh: |+
9+
{{- include "common_keystone_service" . | indent 4 }}
10+
ks-endpoints.sh: |+
11+
{{- include "common_keystone_endpoints" . | indent 4 }}
12+
ks-user.sh: |+
13+
{{- include "common_keystone_user" . | indent 4 }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: cinder-etc
5+
data:
6+
cinder.conf: |+
7+
{{ tuple "etc/_cinder.conf.tpl" . | include "template" | indent 4 }}
8+
api-paste.ini: |+
9+
{{ tuple "etc/_cinder-api-paste.ini.tpl" . | include "template" | indent 4 }}
10+
policy.json: |+
11+
{{ tuple "etc/_policy.json.tpl" . | include "template" | indent 4 }}
12+
ceph.conf: |+
13+
{{ tuple "etc/_ceph.conf.tpl" . | include "template" | indent 4 }}
14+
ceph.client.{{ .Values.ceph.cinder_user }}.keyring: |+
15+
{{ tuple "etc/_ceph-cinder.keyring.tpl" . | include "template" | indent 4 }}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: cinder-api
5+
spec:
6+
replicas: {{ .Values.replicas.api }}
7+
revisionHistoryLimit: {{ .Values.upgrades.revision_history }}
8+
strategy:
9+
type: {{ .Values.upgrades.pod_replacement_strategy }}
10+
{{ if eq .Values.upgrades.pod_replacement_strategy "RollingUpdate" }}
11+
rollingUpdate:
12+
maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }}
13+
maxSurge: {{ .Values.upgrades.rolling_update.max_surge }}
14+
{{ end }}
15+
template:
16+
metadata:
17+
labels:
18+
app: cinder-api
19+
annotations:
20+
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
21+
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
22+
pod.beta.kubernetes.io/init-containers: '[
23+
{
24+
"name": "init",
25+
"image": {{ .Values.images.dep_check | quote }},
26+
"imagePullPolicy": {{ .Values.images.pull_policy | quote }},
27+
"env": [
28+
{
29+
"name": "NAMESPACE",
30+
"value": "{{ .Release.Namespace }}"
31+
},
32+
{
33+
"name": "DEPENDENCY_SERVICE",
34+
"value": "{{ include "joinListWithColon" .Values.dependencies.api.service }}"
35+
},
36+
{
37+
"name": "DEPENDENCY_JOBS",
38+
"value": "{{ include "joinListWithColon" .Values.dependencies.api.jobs }}"
39+
},
40+
{
41+
"name": "COMMAND",
42+
"value": "echo done"
43+
}
44+
]
45+
}
46+
]'
47+
spec:
48+
nodeSelector:
49+
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
50+
containers:
51+
- name: cinder-api
52+
image: {{ .Values.images.api }}
53+
imagePullPolicy: {{ .Values.images.pull_policy }}
54+
command:
55+
- cinder-api
56+
- --config-dir
57+
- /etc/cinder/conf
58+
ports:
59+
- containerPort: {{ .Values.service.api.port }}
60+
readinessProbe:
61+
tcpSocket:
62+
port: {{ .Values.service.api.port }}
63+
volumeMounts:
64+
- name: pod-etc-cinder
65+
mountPath: /etc/cinder
66+
- name: pod-var-cache-cinder
67+
mountPath: /var/cache/cinder
68+
- name: cinderconf
69+
mountPath: /etc/cinder/conf/cinder.conf
70+
subPath: cinder.conf
71+
readOnly: true
72+
- name: cinderpaste
73+
mountPath: /etc/cinder/api-paste.ini
74+
subPath: api-paste.ini
75+
readOnly: true
76+
- name: cinderpolicy
77+
mountPath: /etc/cinder/policy.json
78+
subPath: policy.json
79+
readOnly: true
80+
volumes:
81+
- name: pod-etc-cinder
82+
emptyDir: {}
83+
- name: pod-var-cache-cinder
84+
emptyDir: {}
85+
- name: cinderconf
86+
configMap:
87+
name: cinder-etc
88+
- name: cinderpaste
89+
configMap:
90+
name: cinder-etc
91+
- name: cinderpolicy
92+
configMap:
93+
name: cinder-etc
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: cinder-scheduler
5+
spec:
6+
replicas: {{ .Values.replicas.scheduler }}
7+
revisionHistoryLimit: {{ .Values.upgrades.revision_history }}
8+
strategy:
9+
type: {{ .Values.upgrades.pod_replacement_strategy }}
10+
{{ if eq .Values.upgrades.pod_replacement_strategy "RollingUpdate" }}
11+
rollingUpdate:
12+
maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }}
13+
maxSurge: {{ .Values.upgrades.rolling_update.max_surge }}
14+
{{ end }}
15+
template:
16+
metadata:
17+
labels:
18+
app: cinder-scheduler
19+
annotations:
20+
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
21+
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
22+
pod.beta.kubernetes.io/init-containers: '[
23+
{
24+
"name": "init",
25+
"image": {{ .Values.images.dep_check | quote }},
26+
"imagePullPolicy": {{ .Values.images.pull_policy | quote }},
27+
"env": [
28+
{
29+
"name": "NAMESPACE",
30+
"value": "{{ .Release.Namespace }}"
31+
},
32+
{
33+
"name": "DEPENDENCY_SERVICE",
34+
"value": "{{ include "joinListWithColon" .Values.dependencies.scheduler.service }}"
35+
},
36+
{
37+
"name": "DEPENDENCY_JOBS",
38+
"value": "{{ include "joinListWithColon" .Values.dependencies.scheduler.jobs }}"
39+
},
40+
{
41+
"name": "COMMAND",
42+
"value": "echo done"
43+
}
44+
]
45+
}
46+
]'
47+
spec:
48+
nodeSelector:
49+
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
50+
containers:
51+
- name: cinder-scheduler
52+
image: {{ .Values.images.scheduler }}
53+
imagePullPolicy: {{ .Values.images.pull_policy }}
54+
command:
55+
- cinder-scheduler
56+
- --config-dir
57+
- /etc/cinder/conf
58+
volumeMounts:
59+
- name: pod-etc-cinder
60+
mountPath: /etc/cinder
61+
- name: pod-var-cache-cinder
62+
mountPath: /var/cache/cinder
63+
- name: cinderconf
64+
mountPath: /etc/cinder/conf/cinder.conf
65+
subPath: cinder.conf
66+
readOnly: true
67+
- name: cinderpaste
68+
mountPath: /etc/cinder/api-paste.ini
69+
subPath: api-paste.ini
70+
readOnly: true
71+
- name: cinderpolicy
72+
mountPath: /etc/cinder/policy.json
73+
subPath: policy.json
74+
readOnly: true
75+
volumes:
76+
- name: pod-etc-cinder
77+
emptyDir: {}
78+
- name: pod-var-cache-cinder
79+
emptyDir: {}
80+
- name: cinderconf
81+
configMap:
82+
name: cinder-etc
83+
- name: cinderpaste
84+
configMap:
85+
name: cinder-etc
86+
- name: cinderpolicy
87+
configMap:
88+
name: cinder-etc

0 commit comments

Comments
 (0)