diff --git a/cinder/templates/_helpers.tpl b/cinder/templates/_helpers.tpl new file mode 100644 index 0000000000..97ab3325eb --- /dev/null +++ b/cinder/templates/_helpers.tpl @@ -0,0 +1,45 @@ +# This file is required because we use a slightly different endpoint layout in +# the values yaml, until we can make this change for all services. + + +# this function returns the endpoint uri for a service, it takes an tuple +# input in the form: service-type, endpoint-class, port-name. eg: +# { tuple "orchestration" "public" "api" . | include "endpoint_type_lookup_addr" } +# will return the appropriate URI. Once merged this should phase out the above. + +{{- define "endpoint_type_lookup_addr" -}} +{{- $type := index . 0 -}} +{{- $endpoint := index . 1 -}} +{{- $port := index . 2 -}} +{{- $context := index . 3 -}} +{{- $endpointMap := index $context.Values.endpoints $type }} +{{- $fqdn := $context.Release.Namespace -}} +{{- if $context.Values.endpoints.fqdn -}} +{{- $fqdn := $context.Values.endpoints.fqdn -}} +{{- end -}} +{{- with $endpointMap -}} +{{- $endpointScheme := .scheme }} +{{- $endpointHost := index .hosts $endpoint | default .hosts.default}} +{{- $endpointPort := index .port $port }} +{{- $endpointPath := .path }} +{{- printf "%s://%s.%s:%1.f%s" $endpointScheme $endpointHost $fqdn $endpointPort $endpointPath | quote -}} +{{- end -}} +{{- end -}} + + +#------------------------------- +# endpoint name lookup +#------------------------------- + +# this function is used in endpoint management templates +# it returns the service type for an openstack service eg: +# { tuple orchestration . | include "ks_endpoint_type" } +# will return "heat" + +{{- define "endpoint_name_lookup" -}} +{{- $type := index . 0 -}} +{{- $context := index . 1 -}} +{{- $endpointMap := index $context.Values.endpoints $type }} +{{- $endpointName := index $endpointMap "name" }} +{{- $endpointName | quote -}} +{{- end -}} diff --git a/cinder/templates/job-ks-endpoints.yaml.yaml b/cinder/templates/job-ks-endpoints.yaml.yaml index e2e082bd64..999aed4e8d 100644 --- a/cinder/templates/job-ks-endpoints.yaml.yaml +++ b/cinder/templates/job-ks-endpoints.yaml.yaml @@ -32,9 +32,9 @@ spec: spec: restartPolicy: OnFailure containers: -{{- range $key1, $osServiceName := tuple "cinder" "cinderv2" "cinderv3" }} +{{- range $key1, $osServiceType := tuple "volume" "volumev2" "volumev3" }} {{- range $key2, $osServiceEndPoint := tuple "admin" "internal" "public" }} - - name: {{ $osServiceName }}-ks-endpoints-{{ $osServiceEndPoint }} + - name: {{ $osServiceType }}-ks-endpoints-{{ $osServiceEndPoint }} image: {{ $envAll.Values.images.ks_endpoints }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }} command: @@ -52,11 +52,11 @@ spec: - name: OS_SVC_ENDPOINT value: {{ $osServiceEndPoint }} - name: OS_SERVICE_NAME - value: {{ $osServiceName }} + value: {{ tuple $osServiceType $envAll | include "endpoint_name_lookup" }} - name: OS_SERVICE_TYPE - value: {{ tuple $osServiceName $envAll | include "endpoint_type_lookup" }} + value: {{ $osServiceType }} - name: OS_SERVICE_ENDPOINT - value: {{ tuple $osServiceName $osServiceEndPoint "api" $envAll | include "endpoint_addr_lookup" }} + value: {{ tuple $osServiceType $osServiceEndPoint "api" $envAll | include "endpoint_type_lookup_addr" }} {{- end }} {{- end }} volumes: diff --git a/cinder/templates/job-ks-service.yaml b/cinder/templates/job-ks-service.yaml index b22ee7aa3c..d7035eb834 100644 --- a/cinder/templates/job-ks-service.yaml +++ b/cinder/templates/job-ks-service.yaml @@ -32,8 +32,8 @@ spec: spec: restartPolicy: OnFailure containers: -{{- range $key1, $osServiceName := tuple "cinder" "cinderv2" "cinderv3" }} - - name: {{ $osServiceName }}-ks-service-registration +{{- range $key1, $osServiceType := tuple "volume" "volumev2" "volumev3" }} + - name: {{ $osServiceType }}-ks-service-registration image: {{ $envAll.Values.images.ks_service }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }} command: @@ -49,9 +49,9 @@ spec: {{- include "env_ks_openrc_tpl" $env | indent 12 }} {{- end }} - name: OS_SERVICE_NAME - value: {{ $osServiceName }} + value: {{ tuple $osServiceType $envAll | include "endpoint_name_lookup" }} - name: OS_SERVICE_TYPE - value: {{ tuple $osServiceName $envAll | include "endpoint_type_lookup" }} + value: {{ $osServiceType }} {{- end }} volumes: - name: ks-service-sh diff --git a/cinder/values.yaml b/cinder/values.yaml index e0d7e35522..c1956baa26 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -52,6 +52,16 @@ database: cinder_password: password cinder_user: cinder +ceph: + enabled: true + monitors: [] + cinder_user: "admin" + cinder_pool: "volumes" + # a null value for the keyring will + # attempt to use the key from + # common/secrets/ceph-client-key + cinder_keyring: null + backends: enabled: - rbd1 @@ -108,40 +118,45 @@ dependencies: service: - mariadb - keystone-api + volume: + service: + - keystone-api + - cinder-api +# We use a different layout of the endpoints here to account for versioning +# this swaps the service name and type, and should be rolled out to other +# services. endpoints: - keystone: + identity: + name: keystone hosts: default: keystone-api path: /v3 - type: identity scheme: 'http' port: admin: 35357 public: 5000 - cinder: + volume: + name: cinder hosts: default: cinder-api path: '/v1/%(tenant_id)s' - type: volume scheme: 'http' port: api: 8776 - cinderv2: + volumev2: name: cinder hosts: default: cinder-api path: '/v2/%(tenant_id)s' - type: volumev2 scheme: 'http' port: api: 8776 - cinderv3: + volumev3: name: cinder hosts: default: cinder-api path: '/v3/%(tenant_id)s' - type: volumev3 scheme: 'http' port: api: 8776