Add cookied-cicd-k8s-calico and cookied-cicd-k8s-calico-sl
- Add new templates for k8s deployments using CICD
- In new templates, there is deploy-and-test.groovy script for
integration CI, which performs necessary steps for:
- prepare environment
- get the inventory details from environment (networks)
- generate cookied model for the environment (using inventory
details)
- create ISO config-drive (using the job created by D.Tyzhnenko)
- Bootstrap salt cluster on all nodes (using salt.yaml)
- Use Jenkins on salt-master to deploy 'core' and 'cicd' stacks
- Use Jenkins on CICD nodes to deploy 'k8s', 'calico' and
'stacklight'
- Run system tests from tcp-qa test directories, for this there
are two new pytest marks: 'k8s_calico' and 'k8s_calico_sl'
The script deploy-and-test.groovy can use the shared library
tcp_tests/templates/SharedPipeline.groovy at certain step for
common methods.
- fix replacing networks in shared-salt.yaml for cookied models
Change-Id: I958d183d8951b869877f0c36f4bd1000a5b7e6a9
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml
new file mode 100644
index 0000000..ceace31
--- /dev/null
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml
@@ -0,0 +1,38 @@
+{% from 'cookied-model-generator/underlay.yaml' import HOSTNAME_CFG01 with context %}
+{% from 'cookied-model-generator/underlay.yaml' import DOMAIN_NAME with context %}
+
+{% set LAB_CONFIG_NAME = 'cookied-cicd-k8s-calico' %}
+# Name of the context file (without extension, that is fixed .yaml) used to render the Environment model
+{% set ENVIRONMENT_MODEL_INVENTORY_NAME = os_env('ENVIRONMENT_MODEL_INVENTORY_NAME', LAB_CONFIG_NAME) %}
+# Path to the context files used to render Cluster and Environment models
+{%- set CLUSTER_CONTEXT_NAME = 'cookiecutter-context-k8s.yaml' %}
+{%- set ENVIRONMENT_CONTEXT_NAMES = ['environment-context-k8s.yaml'] %}
+
+{% import 'shared-salt.yaml' as SHARED with context %}
+
+{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+- description: Re-install all the fromulas
+ cmd: |
+ set -e;
+ apt-get install -y salt-formula-*
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
+
+{{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
+
+- description: "Workaround for combined roles: remove unnecessary classes"
+ cmd: |
+ set -e;
+ . /root/venv-reclass-tools/bin/activate;
+ # Workaround for compute nodes. Auto-registration for compute nodes cannot be used without external address inventory
+ reclass-tools add-key parameters._param.kubernetes_compute_node01_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
+ reclass-tools add-key parameters._param.kubernetes_compute_node02_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
+
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+{{ SHARED.MACRO_GENERATE_INVENTORY(RERUN_SALTMASTER_STATE=true) }}