Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solutions management #2279

Merged
merged 19 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildchain/buildchain/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
files=(
Path('common.sh'),
Path('iso-manager.sh'),
Path('solution-manager.sh'),
Path('solutions.sh'),
helper.TemplateFile(
task_name='downgrade.sh',
source=constants.ROOT/'scripts'/'downgrade.sh.in',
Expand Down
47 changes: 29 additions & 18 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ def _get_parts(self) -> Iterator[str]:
Path('salt/metalk8s/addons/ui/deployed/namespace.sls'),
Path('salt/metalk8s/addons/ui/deployed/ui.sls'),

Path('salt/metalk8s/addons/solutions/deployed.sls'),
Path('salt/metalk8s/addons/solutions/environment-crd.sls'),
Path('salt/metalk8s/addons/solutions/deployed/configmap.sls'),
Path('salt/metalk8s/addons/solutions/deployed/init.sls'),
Path('salt/metalk8s/addons/solutions/deployed/namespace.sls'),

Path('salt/metalk8s/addons/volumes/deployed.sls'),
targets.TemplateFile(
Expand Down Expand Up @@ -413,30 +414,37 @@ def _get_parts(self) -> Iterator[str]:

Path('salt/metalk8s/node/grains.sls'),

Path('salt/metalk8s/orchestrate/deploy_node.sls'),
Path('salt/metalk8s/orchestrate/etcd.sls'),
Path('salt/metalk8s/orchestrate/register_etcd.sls'),

Path('salt/metalk8s/orchestrate/bootstrap/init.sls'),
Path('salt/metalk8s/orchestrate/bootstrap/accept-minion.sls'),
Path('salt/metalk8s/orchestrate/deploy_node.sls'),

Path('salt/metalk8s/orchestrate/downgrade/init.sls'),
Path('salt/metalk8s/orchestrate/downgrade/precheck.sls'),
Path('salt/metalk8s/orchestrate/downgrade/pre.sls'),
Path('salt/metalk8s/orchestrate/solutions/available.sls'),
Path('salt/metalk8s/orchestrate/solutions/init.sls'),
Path('salt/metalk8s/orchestrate/etcd.sls'),

Path('salt/metalk8s/orchestrate/upgrade/init.sls'),
Path('salt/metalk8s/orchestrate/upgrade/precheck.sls'),
Path('salt/metalk8s/orchestrate/upgrade/pre.sls'),
Path('salt/metalk8s/orchestrate/register_etcd.sls'),

Path('salt/metalk8s/orchestrate/solutions/prepare-environment.sls'),
Path('salt/metalk8s/orchestrate/solutions/deploy-components.sls'),
Path('salt/metalk8s/orchestrate/solutions/files/operator/configmap.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/operator/deployment.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/operator/role.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/operator/role_binding.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/operator/service_account.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/ui/configmap.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/ui/deployment.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/ui/ingress.yaml'),
Path('salt/metalk8s/orchestrate/solutions/files/ui/service.yaml'),

Path('salt/metalk8s/archives/configured.sls'),
Path('salt/metalk8s/archives/init.sls'),
Path('salt/metalk8s/archives/mounted.sls'),

Path('salt/metalk8s/solutions/configured.sls'),
Path('salt/metalk8s/solutions/mounted.sls'),
Path('salt/metalk8s/solutions/unconfigured.sls'),
Path('salt/metalk8s/solutions/unmounted.sls'),
Path('salt/metalk8s/solutions/init.sls'),

Path('salt/metalk8s/repo/configured.sls'),
Path('salt/metalk8s/repo/deployed.sls'),
Path('salt/metalk8s/repo/files/apt.sources.list.j2'),
Expand Down Expand Up @@ -481,6 +489,9 @@ def _get_parts(self) -> Iterator[str]:
Path('salt/metalk8s/salt/minion/local.sls'),
Path('salt/metalk8s/salt/minion/running.sls'),

Path('salt/metalk8s/solutions/available.sls'),
Path('salt/metalk8s/solutions/init.sls'),

Path('salt/metalk8s/volumes/init.sls'),
Path('salt/metalk8s/volumes/prepared/init.sls'),
Path('salt/metalk8s/volumes/prepared/installed.sls'),
Expand All @@ -491,26 +502,26 @@ def _get_parts(self) -> Iterator[str]:

Path('salt/_modules/containerd.py'),
Path('salt/_modules/cri.py'),
Path('salt/_modules/metalk8s.py'),
Path('salt/_modules/metalk8s_cordon.py'),
Path('salt/_modules/metalk8s_drain.py'),
Path('salt/_modules/metalk8s_kubernetes.py'),
Path('salt/_modules/metalk8s_etcd.py'),
Path('salt/_modules/metalk8s_grafana.py'),
Path('salt/_modules/metalk8s_kubernetes.py'),
Path('salt/_modules/metalk8s_kubernetes_utils.py'),
Path('salt/_modules/metalk8s.py'),
Path('salt/_modules/metalk8s_network.py'),
Path('salt/_modules/metalk8s_package_manager_yum.py'),
Path('salt/_modules/metalk8s_package_manager_apt.py'),
Path('salt/_modules/metalk8s_volumes.py'),
Path('salt/_modules/metalk8s_solutions.py'),

Path('salt/_modules/metalk8s_solutions_k8s.py'),
Path('salt/_modules/metalk8s_volumes.py'),

Path('salt/_pillar/metalk8s.py'),
Path('salt/_pillar/metalk8s_endpoints.py'),
Path('salt/_pillar/metalk8s_etcd.py'),
Path('salt/_pillar/metalk8s_nodes.py'),
Path('salt/_pillar/metalk8s_private.py'),
Path('salt/_pillar/metalk8s_solutions.py'),
Path('salt/_pillar/metalk8s_etcd.py'),

Path('salt/_renderers/metalk8s_kubernetes.py'),

Expand Down
133 changes: 123 additions & 10 deletions docs/developer/solutions/deploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,137 @@ Deploying And Experimenting
============================

Given the solution ISO is correctly generated, a script utiliy has been
added to enable solution install and removal
added to manage Solutions.
This script is located at the root of Metalk8s archive:

Installation
------------
.. code::

/srv/scality/metalk8s-X.X.X/solutions.sh

Import a Solution
-----------------

Importing a Solution will mount its ISO and expose its container images.

To import a Solution into MetalK8s cluster, use the ``import`` subcommand:

.. code::

./solutions.sh import --archive </path/to/solution.iso>

The ``--archive`` option can be provided multiple times to import several
Solutions ISOs at the same time:

.. code::

./solutions.sh import --archive </path/to/solution1.iso> \
--archive </path/to/solution2.iso>

Unimport a Solution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unimport is probably not the right term, I would simply say remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not the right term, it's not even a term. :)
Anyway this stuff will not stay as is and will be changed soon when we'll integrate this script in a centralized CLI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be changed soon

soon can mean far future or never in IT 😛 (except if you mean it'll be tackled in your next PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost my next PR, it's not "maybe, someday... if we have time" :)

-------------------

To unimport a Solution from MetalK8s cluster, use the ``unimport`` subcommand:

.. warning::

Images of a Solution will no longer be available after an archive removal

.. code::

./solutions.sh unimport --archive </path/to/solution.iso>

Activate a Solution
-------------------

Activating a Solution version will deploy its CRDs.

To activate a Solution in MetalK8s cluster, use the ``activate`` subcommand:

.. code::

./solutions.sh activate --name <solution-name> --version <solution-version>

Deactivate a Solution
---------------------

To deactivate a Solution from Metalk8s cluster, use the ``deactivate``
subcommand:

.. code::

./solutions.sh deactivate --name <solution-name>

Create an Environment
---------------------

To create a Solution Environment, use the ``create-env`` subcommand:

.. code::

./solutions.sh create-env --name <environment-name>

By default, it will create a Namespace named after the ``<environment-name>``,
TeddyAndrieux marked this conversation as resolved.
Show resolved Hide resolved
but it can be changed, using the ``--namespace`` option:

.. code::

./solutions.sh create-env --name <environment-name> \
--namespace <namespace-name>

It's also possible to use the previous command to create multiple Namespaces
(one at a time) in this Environment, allowing Solutions to run in different
Namespaces.

Delete an Environment
---------------------

To delete an Environment, use the ``delete-env`` subcommand:

Use the `solution-manager.sh` script to install a new solution ISO using
the following command
.. warning::

This will destroy everything in the said Environment, with no way back

.. code::

/src/scality/metalk8s-X.X.X/solution-manager.sh -a/--add </path/to/new/ISO>
./solutions.sh delete-env --name <environment-name>

In case of multiple Namespaces inside an Environment, it's also possible
to only delete a single Namespace, using:

.. code::

./solutions.sh delete-env --name <environment-name> \
--namespace <namespace-name>

Add a Solution in an Environment
--------------------------------

Adding a Solution will deploy its UI and Operator resources in the Environment.

Removal
-------
To add a Solution in an Environment, use the ``add-solution`` subcommand:

To remove a solution from the cluster use the previous script by invoking
.. code::

./solutions.sh add-solution --name <environment-name> \
--solution <solution-name> --version <solution-version>

In case of non-default Namespace (not corresponding to ``<environment-name>``)
or multiple Namespaces in an Environment, Namespace in which the Solution will
be added must be precised, using the ``--namespace`` option:

.. code::

/src/scality/metalk8s-X.X.X/solution-manager.sh -d/--del </path/to/ISO>
./solutions.sh add-solution --name <environment-name> \
--solution <solution-name> --version <solution-version> \
--namespace <namespace-name>

Delete a Solution from an Environment
-------------------------------------

To delete a Solution from an Environment, use the ``delete-solution``
subcommand:

.. code::

./solutions.sh delete-solution --name <environment-name> \
--solution <solution-name>
Loading