tripleo-heat-templates/extraconfig/services/openshift-cns.yaml
Martin André b3eca20d2e Configure registry to use gluster
We're deploying an additional glusterfs cluster on infra nodes with
Ife73d7c50c304cff7cd05e08f74855cb107f3c46 but never actually enabled
the registry to make use of it. This is controlled by the
openshift_hosted_registry_storage_kind variable which needs to be set
to 'glusterfs'.

Change-Id: I67ae122447fdf0ae32f576b849dfa65cce4f30a3
Closes-Bug: #1804154
2018-11-21 10:46:39 +01:00

163 lines
6.1 KiB
YAML

heat_template_version: rocky
description: External tasks definition for OpenShift
parameters:
RoleNetIpMap:
default: {}
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
OpenShiftGlusterNodeVars:
default: {}
description: OpenShift node vars specific for the gluster nodes
type: json
OpenShiftGlusterDisks:
default:
- /dev/vdb
description: List of disks for openshift_glusterfs service to use
type: comma_delimited_list
tags:
- role_specific
OpenShiftNodeGroupName:
default: node-config-all-in-one
description: The group the nodes belong to.
type: string
tags:
- role_specific
DockerOpenShiftGlusterFSImage:
description: Container image to use for GlusterFS pod
type: string
DockerOpenShiftGlusterFSBlockImage:
description: Container image to use for glusterblock-provisioner pod
type: string
DockerOpenShiftGlusterFSHeketiImage:
description: Container image to use for heketi pods
type: string
resources:
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- OpenShiftGlusterDisks: OpenShiftGlusterDisks
OpenShiftNodeGroupName: OpenShiftNodeGroupName
- values: {get_param: [RoleParameters]}
- values:
OpenShiftGlusterDisks: {get_param: OpenShiftGlusterDisks}
OpenShiftNodeGroupName: {get_param: OpenShiftNodeGroupName}
outputs:
role_data:
description: Role data for the Openshift Service
value:
# This service template essentially tags the nodes that we want
# as cns. The actual installation is performed in
# openshift-master service template.
service_name: openshift_glusterfs
upgrade_tasks: []
step_config: ''
external_deploy_tasks:
- name: openshift_cns step 2 Generate Inventory
when: step == '2'
block:
- name: set openshift global vars fact
set_fact:
openshift_gluster_disks: {get_attr: [RoleParametersValue, value, OpenShiftGlusterDisks]}
tripleo_node_group_name: {get_attr: [RoleParametersValue, value, OpenShiftNodeGroupName]}
tripleo_role_name: {get_param: RoleName}
- name: set openshift gluster global vars fact
set_fact:
openshift_gluster_global_vars:
map_merge:
- openshift_storage_glusterfs_storageclass_default: true
openshift_hosted_registry_storage_kind: glusterfs
- {get_param: OpenShiftGlusterNodeVars}
- openshift_storage_glusterfs_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSImage}
openshift_storage_glusterfs_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSImage}
openshift_storage_glusterfs_block_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSBlockImage}
openshift_storage_glusterfs_block_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSBlockImage}
openshift_storage_glusterfs_heketi_image:
yaql:
expression:
$.data.image.rightSplit(":", 1)[0]
data:
image: {get_param: DockerOpenShiftGlusterFSHeketiImage}
openshift_storage_glusterfs_heketi_version:
yaql:
expression:
$.data.image.rightSplit(":", 1)[1]
data:
image: {get_param: DockerOpenShiftGlusterFSHeketiImage}
- name: generate openshift gluster global vars
copy:
dest: "{{playbook_dir}}/openshift/global_gluster_vars.yml"
content: "{{openshift_gluster_global_vars|to_nice_yaml}}"
- name: generate openshift inventory for Role
copy:
dest: "{{playbook_dir}}/openshift/inventory/{{tripleo_role_name}}_openshift_glusterfs.yml"
content: |
{% if tripleo_node_group_name == "node-config-infra" -%}
glusterfs_registry:
{% else -%}
glusterfs:
{% endif %}
hosts:
{% for host in groups[tripleo_role_name] | default([]) -%}
{{ hostvars.raw_get(host)['ansible_hostname'] }}:
glusterfs_ip: {{hostvars.raw_get(host)['storage_ip']}}
glusterfs_devices:
{{openshift_gluster_disks | to_nice_yaml() | indent(8) }}
{% endfor %}