flatten tripleo-ui service configuration

This change combines the previous puppet and docker files
into a single file that performs the docker service installation
and configuration.

Change-Id: If4a312ca8280b28156367a5fc8cbdde34ffd4f85
This commit is contained in:
Jill Rouleau 2019-02-11 11:20:54 -07:00
parent 2399828ca1
commit cab93fd314
3 changed files with 94 additions and 160 deletions

View File

@ -1,9 +1,25 @@
heat_template_version: rocky
description: >
OpenStack TripleO UI service configured with Puppet
Openstack containerized TripleO UI service
parameters:
DockerTripleoUIImage:
description: image
type: string
DockerTripleoUIConfigImage:
description: The container image to use for the tripleo-ui config_volume
type: string
TripleoUILoggingSource:
type: json
default:
tag: openstack.tripleo.ui
path: /var/log/containers/httpd/tripleo-ui/ui.log
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
@ -11,8 +27,8 @@ parameters:
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
@ -25,27 +41,29 @@ parameters:
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
EnableInternalTLS:
type: boolean
default: false
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
type: boolean
NovaCorsAllowedOrigin:
type: string
default: ''
description: Indicate whether this resource may be shared with the domain received in the request
"origin" header.
conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
cors_allowed_origin_unset: {equals : [{get_param: NovaCorsAllowedOrigin}, '']}
resources:
ContainersCommon:
type: ../../docker/services/containers-common.yaml
ApacheServiceBase:
type: ./apache.yaml
type: ../../puppet/services/apache.yaml
properties:
ServiceData: {get_param: ServiceData}
ServiceNetMap: {get_param: ServiceNetMap}
@ -94,9 +112,71 @@ outputs:
"%{hiera('$NETWORK')}"
params:
$NETWORK: {get_param: [ServiceNetMap, TripleoUINetwork]}
step_config: |
include ::tripleo::ui
- apache::default_vhost: false
service_config_settings: {}
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: tripleo-ui
step_config: include ::tripleo::ui
config_image: {get_param: DockerTripleoUIConfigImage}
kolla_config:
/var/lib/kolla/config_files/tripleo_ui.json:
command: /usr/sbin/httpd -DFOREGROUND
config_files:
- source: "/var/lib/kolla/config_files/src/etc/httpd/conf.d"
dest: "/etc/httpd/conf.d"
merge: false
preserve_properties: true
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
docker_config:
step_4:
tripleo_ui:
image: {get_param: DockerTripleoUIImage}
net: host
privileged: false
restart: always
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/tripleo_ui.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/tripleo-ui/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/httpd/tripleo-ui:/var/log/httpd
-
if:
- internal_tls_enabled
- /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
- ''
-
if:
- internal_tls_enabled
- /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- ''
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/httpd/tripleo-ui
upgrade_tasks:
- when: step|int == 2
block:
- name: Remove openstack-tripleo-ui package if operator requests it
package: name=openstack-tripleo-ui state=removed
ignore_errors: True
when: {get_param: UpgradeRemoveUnusedPackages}
post_upgrade_tasks:
- when: step|int == 1
import_role:
name: tripleo-docker-rm
vars:
containers_to_rm:
- tripleo_ui
metadata_settings:
get_attr: [ApacheServiceBase, role_data, metadata_settings]
upgrade_tasks: {}

View File

@ -1,146 +0,0 @@
heat_template_version: rocky
description: >
Openstack containerized TripleO UI service
parameters:
DockerTripleoUIImage:
description: image
type: string
DockerTripleoUIConfigImage:
description: The container image to use for the tripleo-ui config_volume
type: string
TripleoUILoggingSource:
type: json
default:
tag: openstack.tripleo.ui
path: /var/log/containers/httpd/tripleo-ui/ui.log
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
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
EnableInternalTLS:
type: boolean
default: false
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
type: boolean
conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
resources:
ContainersCommon:
type: ./containers-common.yaml
TripleoUIPuppetBase:
type: ../../puppet/services/tripleo-ui.yaml
properties:
EndpointMap: {get_param: EndpointMap}
ServiceData: {get_param: ServiceData}
ServiceNetMap: {get_param: ServiceNetMap}
DefaultPasswords: {get_param: DefaultPasswords}
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
outputs:
role_data:
description: Role data for the TripleO UI role.
value:
service_name: {get_attr: [TripleoUIPuppetBase, role_data, service_name]}
config_settings:
map_merge:
- get_attr: [TripleoUIPuppetBase, role_data, config_settings]
- apache::default_vhost: false
service_config_settings: {get_attr: [TripleoUIPuppetBase, role_data, service_config_settings]}
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: tripleo-ui
step_config: {get_attr: [TripleoUIPuppetBase, role_data, step_config]}
config_image: {get_param: DockerTripleoUIConfigImage}
kolla_config:
/var/lib/kolla/config_files/tripleo_ui.json:
command: /usr/sbin/httpd -DFOREGROUND
config_files:
- source: "/var/lib/kolla/config_files/src/etc/httpd/conf.d"
dest: "/etc/httpd/conf.d"
merge: false
preserve_properties: true
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
docker_config:
step_4:
tripleo_ui:
image: {get_param: DockerTripleoUIImage}
net: host
privileged: false
restart: always
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/tripleo_ui.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/tripleo-ui/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/httpd/tripleo-ui:/var/log/httpd
-
if:
- internal_tls_enabled
- /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
- ''
-
if:
- internal_tls_enabled
- /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- ''
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/httpd/tripleo-ui
upgrade_tasks:
- when: step|int == 2
block:
- name: Remove openstack-tripleo-ui package if operator requests it
package: name=openstack-tripleo-ui state=removed
ignore_errors: True
when: {get_param: UpgradeRemoveUnusedPackages}
post_upgrade_tasks:
- when: step|int == 1
import_role:
name: tripleo-docker-rm
vars:
containers_to_rm:
- tripleo_ui
metadata_settings:
get_attr: [TripleoUIPuppetBase, role_data, metadata_settings]

View File

@ -1,2 +1,2 @@
resource_registry:
OS::TripleO::Services::TripleoUI: ../../docker/services/tripleo-ui.yaml
OS::TripleO::Services::TripleoUI: ../../deployment/tripleo-ui/tripleo-ui-container-puppet.yaml