From ab18375a629010525ac15bc11ce2d4e4cf393fe9 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 18 Aug 2018 03:46:13 +0200 Subject: [docker] Switch to containerized Salt Master * Refactor OPNFV salt-formulas mechanism to resemble upstream git structure: - git submodules: add new submodule for each formula we patch; - create salt-formula-x directories for OPNFV formulas; - move mcp/metadata/service contents to their each formula subdir; - use `make patches-import` for patches previously handled by patch.sh; - retire patch.sh * states: add virtual_init: - mostly based on old salt.sh, which is now obsolete; - exclude salt-master service restart (it would kill the container); * scenarios: cleanup (rm cfg01 virtual node def), adopt virtual_init; * reclass: align our model with prebuilt container's Salt config: - drop linux:network pillar data (handled by Docker); - stop applying linux.system state on cfg01; - align salt user homedir; - drop salt-formula packages (preprovisioned); * minor plumbing in deploy.sh and lib.sh; JIRA: FUEL-383 Change-Id: I28708a9b399d3f19012212c71966ebda9d6fc0ac Signed-off-by: Alexandru Avadanii --- .../opendaylight/files/jetty.xml | 132 +++++++++++++++++++++ .../opendaylight/files/setenv.shell | 21 ++++ .../opendaylight/init.sls | 12 ++ .../opendaylight/map.jinja | 28 +++++ .../opendaylight/server.sls | 113 ++++++++++++++++++ 5 files changed, 306 insertions(+) create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls (limited to 'mcp/salt-formulas/salt-formula-opendaylight/opendaylight') diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml new file mode 100644 index 000000000..de2ac677d --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml @@ -0,0 +1,132 @@ +{%- from "opendaylight/map.jinja" import server with context -%} + + + + + + + + + + + + + + + https + + + + 32768 + 8192 + 8192 + + + false + + false + 512 + + + + https + + + + 32768 + 8192 + 8192 + + + false + + false + 512 + + + + + + + + + + + + + + + + + + + + {{ server.odl_bind_ip }} + + + + + + + + + jetty-default + + + + + + + + + + + + + + + karaf + karaf + + + org.apache.karaf.jaas.boot.principal.RolePrincipal + + + + + + + + + + default + karaf + + + org.apache.karaf.jaas.boot.principal.RolePrincipal + + + + + + + diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell new file mode 100644 index 000000000..2921ade14 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell @@ -0,0 +1,21 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{%- from "opendaylight/map.jinja" import server with context -%} +# export JAVA_HOME # Location of Java installation +export JAVA_MIN_MEM={{ server.java_min_mem }} # Minimum memory for the JVM +export JAVA_MAX_MEM={{ server.java_max_mem }} # Maximum memory for the JVM +# export JAVA_PERM_MEM # Minimum perm memory for the JVM +export JAVA_MAX_PERM_MEM=512m # Maximum perm memory for the JVM +export EXTRA_JAVA_OPTS='{{ server.java_extra_opts }}' # Additional JVM options +# export KARAF_HOME # Karaf home folder +# export KARAF_DATA # Karaf data folder +# export KARAF_BASE # Karaf base folder +# export KARAF_ETC # Karaf etc folder +# export KARAF_OPTS # Additional available Karaf options +# export KARAF_DEBUG # Enable debug mode +# export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls new file mode 100644 index 000000000..132f69b33 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls @@ -0,0 +1,12 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +include: +{% if pillar.opendaylight.server is defined %} +- opendaylight.server +{% endif %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja new file mode 100644 index 000000000..38575111e --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja @@ -0,0 +1,28 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +{% set server = salt['grains.filter_by']({ + 'Debian': { + 'karaf_features': {'default': ['standard', 'wrap', 'ssh']}, + 'odl_rest_port': '8282', + 'odl_bind_ip': '0.0.0.0', + 'repo': 'odl-team/oxygen', + 'log_levels': {}, + 'enable_ha': false, + 'ha_node_ips': [], + 'ha_node_index': 0, + 'security_group_mode': 'stateful', + 'vpp_routing_node': '', + 'java_extra_opts': '-Djava.net.preferIPv4Stack=true -XX:+UseG1GC', + 'java_min_mem': '1g', + 'java_max_mem': '2g', + }, + 'RedHat': { + 'repo': 'opendaylight-6-testing' + }, +}, merge=salt['pillar.get']('opendaylight:server')) %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls new file mode 100644 index 000000000..206dc52a2 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls @@ -0,0 +1,113 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{% from "opendaylight/map.jinja" import server with context %} +{% from "linux/map.jinja" import system with context %} + +{%- if server.enabled %} + +opendaylight_repo_key: + cmd.run: + - name: "apt-key adv --keyserver keyserver.ubuntu.com --recv 44C05248" +{%- if system.proxy is defined and system.proxy.pkg is defined %} + - env: +{%- if system.proxy.pkg.http is defined %} + - http_proxy: {{ system.proxy.pkg.http }} +{%- endif %} +{%- if system.proxy.pkg.https is defined %} + - https_proxy: {{ system.proxy.pkg.https }} +{%- endif %} +{%- endif %} + +opendaylight_repo: + pkgrepo.managed: + # NOTE(armband): PPA handling behind proxy broken, define it explicitly + # https://github.com/saltstack/salt/pull/45224 + # - ppa: {{ server.repo }} + - human_name: opendaylight-ppa + - name: deb http://ppa.launchpad.net/odl-team/{{ server.version }}/ubuntu xenial main + - file: /etc/apt/sources.list.d/odl-team-ubuntu-{{ server.version }}-xenial.list + +{%- if grains['saltversioninfo'] < [2017, 7] %} +service.mask: + module.run: + - m_name: opendaylight +{%- else %} +opendaylight_service_mask: + service.masked: + - name: opendaylight +{%- endif %} + +opendaylight: + pkg.installed: + - require: + - pkgrepo: opendaylight_repo + - require_in: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg + - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg + service.running: + - enable: true +{%- if grains['saltversioninfo'] >= [2017, 7] %} + - unmask: true +{%- endif %} + - watch: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg + - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg + +/opt/opendaylight/etc/jetty.xml: + file.managed: + - source: salt://opendaylight/files/jetty.xml + - template: jinja + - user: odl + - group: odl + +/opt/opendaylight/bin/setenv: + file.managed: + - source: salt://opendaylight/files/setenv.shell + - mode: 0755 + - use: + - file: /opt/opendaylight/etc/jetty.xml + +{% set features %} +{%- for f in server.karaf_features.itervalues() -%} +{{ f | join(',') }}{%- if not loop.last %},{%- endif %} +{%- endfor %} +{% endset %} + +/opt/opendaylight/etc/org.apache.karaf.features.cfg: + ini.options_present: + - sections: + featuresBoot: {{ features }} + +/opt/opendaylight/etc/org.ops4j.pax.web.cfg: + ini.options_present: + - sections: + org.ops4j.pax.web.listening.addresses: {{ server.odl_bind_ip }} + org.osgi.service.http.port: {{ server.odl_rest_port }} + +{%- if server.get('router_enabled', false) %} +/opt/opendaylight/etc/custom.properties: + ini.options_present: + - sections: + ovsdb.l3.fwd.enabled: 'yes' + ovsdb.of.version: 1.3 + - require: + - pkg: opendaylight + - watch_in: + - service: opendaylight +{%- endif %} + +{%- if grains['cpuarch'] == 'aarch64' %} +opendaylight-leveldbjni: + pkg.installed +{%- endif %} + +{%- endif %} -- cgit 1.2.3-korg