- name: Distribute helm charts to infra node
block:
- name: Archive helm charts
- archive:
- path: "{{ app_helm_charts_install_directory }}/*"
- dest: "{{ app_helm_charts_install_directory }}.tgz"
+ command: tar -cvzf {{ app_helm_charts_install_directory }}.tgz -C {{ app_helm_charts_install_directory }} .
+ args:
+ warn: false
+ tags:
+ - skip_ansible_lint # Prevent '[303] tar used in place of unarchive module'
+ changed_when: false # for idempotency
delegate_to: localhost
- name: Create helm charts dir on infra
file:
rke_username: rke
rke_bin_dir: /usr/local/bin
kube_config_dir: "{{ ansible_env.HOME }}/.kube"
+kubernetes_config_dir: "/etc/kubernetes"
+kubelet:
+ static_config: "kubelet-static-config.yml"
+ runtime_request_timeout: "2m0s"
cluster_config_dir: "{{ app_data_path }}/cluster"
# Whether dashboard is exposed.
rke_dashboard_exposed: true
--- /dev/null
+../../../../group_vars/
\ No newline at end of file
- name: rke
purge_networks: true
- - name: kubernetes-node-2
- image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
- pre_build_image: true
- privileged: true
- override_command: false
- restart_policy: unless-stopped
- env:
- container: docker
- volumes:
- - /var/lib/kubelet
- - /var/lib/docker
- groups:
- - kubernetes
- - kubernetes-node
- networks:
- - name: rke
- purge_networks: true
-
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../test/roles
ANSIBLE_LIBRARY: ../../../../library
- inventory:
- links:
- group_vars: ../../../../group_vars
options:
e: "app_data_path=/opt/onap"
lint:
set_fact:
cluster_ip: "{{ ansible_default_ipv4.address }}"
+- name: Configure etcd (RKE)
+ hosts: kubernetes-etcd
+ roles:
+ - role: rke
+ vars:
+ mode: etcd
+
- name: Configure kubernetes cluster (RKE)
hosts: infrastructure
roles:
'metadata']['ownerReferences'][0]['kind'] == 'Job':
continue
assert host.run(
- 'kubectl wait --timeout=120s --for=condition=' + condition + ' -n ' +
+ 'kubectl wait --timeout=240s --for=condition=' + condition + ' -n ' +
namespace + ' pods/' + podname).rc == 0
--- /dev/null
+../../../../group_vars/
\ No newline at end of file
--- /dev/null
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: true
+ privileged: true
+ override_command: false
+ restart_policy: unless-stopped
+ volumes:
+ - /var/lib/kubelet
+ - /var/lib/docker
+ env:
+ container: docker
+ groups:
+ - infrastructure
+ - kubernetes-etcd
+ - kubernetes-control-plane
+ - kubernetes
+ networks:
+ - name: rke
+ purge_networks: true
+
+ - name: kubernetes-node-1
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: true
+ privileged: true
+ override_command: false
+ restart_policy: unless-stopped
+ env:
+ container: docker
+ volumes:
+ - /var/lib/kubelet
+ - /var/lib/docker
+ groups:
+ - kubernetes
+ - kubernetes-node
+ networks:
+ - name: rke
+ purge_networks: true
+
+provisioner:
+ name: ansible
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ group_vars:
+ all:
+ rke_etcd:
+ enabled_custom_etcd_storage: false
+ storage_path: /var/lib/etcd-custom
+ storage_mountpoint: /var/lib/rancher/etcd-custom
+ enabled_unsafe_volatile_storage: true
+ tmpfs_size: 5G
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+ destroy: ../default/destroy.yml
+ options:
+ e: "app_data_path=/opt/onap"
+ lint:
+ name: ansible-lint
+scenario:
+ name: etcd_storage
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
authorized_key:
user: "{{ rke_username }}"
key: "{{ hostvars[groups['infrastructure'][0]].cluster_public_key }}"
+
+- name: "Ensure that '{{ kubernetes_config_dir }}' is present"
+ file:
+ path: "{{ kubernetes_config_dir }}"
+ state: directory
+ mode: 0755
+
+- name: Prepare kubelet static config
+ template:
+ src: "kubelet-static-config.yml.j2"
+ dest: "{{ kubernetes_config_dir }}/{{ kubelet.static_config }}"
extra_env: []
kubelet:
image: ""
- extra_args: {}
- extra_binds: []
+ extra_args:
+ dynamic-config-dir: "/kubelet-dynamic-config-dir"
+ config: "/kubelet-static-config.yml"
+ extra_binds:
+ - "{{ kubernetes_config_dir }}/{{ kubelet.static_config }}:/kubelet-static-config.yml:ro"
extra_env: []
cluster_domain: cluster.local
infra_container_image: ""
--- /dev/null
+apiVersion: kubelet.config.k8s.io/v1beta1
+kind: KubeletConfiguration
+runtimeRequestTimeout: "{{ kubelet.runtime_request_timeout }}"
# COPYRIGHT NOTICE STARTS HERE
-# Copyright 2019 © Samsung Electronics Co., Ltd.
+# Copyright 2019-2020 © Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# COPYRIGHT NOTICE ENDS HERE
#
-# This is a main wrapper script to run Molecule tests
-# Main usage is for the CI usage to keep interface stable and the way to call
+# This is a main wrapper script to run Molecule tests.
+# Main usage is for the CI to keep interface stable and the way to call
# Molecule can be adjusted in this script independently.
#
echo "Build Molecule-dev docker container"
${LOCAL_PATH}/../molecule-docker/build.sh
MOLECULE_BINARY=${LOCAL_PATH}/../bin/molecule.sh
-
else # Install Molecule natively in the target platform
echo "Install Molecule with virtualenv"
source ${LOCAL_PATH}/../bin/install-molecule.sh
cd ${ROLE_PATH}
${MOLECULE_BINARY} --version
${MOLECULE_BINARY} test --all
+docker volume prune --force
cd -
-
---
-vnc_passwd: molecule
certificates:
organization_name: Molecule Testers
state_or_province_name: Finland
registry: "{{ molecule_test_registry }}"
path: "/library/alpine"
tag: "latest"
+vnc_server_image: alpine:latest
--- /dev/null
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
--- /dev/null
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: true
+ privileged: true
+ override_command: false
+ restart_policy: unless-stopped
+ volumes:
+ - /var/lib/docker
+ - /var/lib/kubelet
+ groups:
+ - infrastructure
+ - kubernetes-etcd
+ - kubernetes-control-plane
+ - kubernetes
+ networks:
+ - name: rke
+ purge_networks: true
+
+ - name: kubernetes-node-1
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: true
+ privileged: true
+ override_command: false
+ restart_policy: unless-stopped
+ volumes:
+ - /var/lib/docker
+ - /var/lib/kubelet
+ groups:
+ - kubernetes
+ - kubernetes-node
+ networks:
+ - name: rke
+ purge_networks: true
+
+provisioner:
+ name: ansible
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ lint:
+ name: ansible-lint
+scenario:
+ name: default
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
--- /dev/null
+---
+- name: Initialize
+ hosts: all
+ tasks:
+ - name: Set cluster_ip fact
+ set_fact:
+ cluster_ip: "{{ ansible_default_ipv4.address }}"
+ - name: Include variables
+ include_vars: vars.yml
+
+- import_playbook: ../../../../rke.yml
--- /dev/null
+---
+- name: Prepare for all
+ hosts: all
+ roles:
+ - prepare-docker-dind
+ - role: prepare-rke
+ vars:
+ mode: all
+
+- name: Prepare infra
+ hosts: infrastructure
+ pre_tasks:
+ - name: Include infrastructure group variables
+ include_vars: ../../../../group_vars/infrastructure.yml
+ roles:
+ - role: prepare-rke
+ vars:
+ mode: infra
+ - prepare-kubectl
+ - prepare-helm
+ vars_files:
+ vars.yml
--- /dev/null
+---
+app_name: moleculeapp
+app_data_path: "/opt/{{ app_name }}"
--- /dev/null
+jq
+screen
- kubernetes-etcd
- kubernetes-control-plane
-**NOTE:** kubernetes-* roles can be collocated directly with kubernetes nodes and not necessarily on infra node.
+**NOTE:** kubernetes-* roles can be collocated directly with kubernetes nodes and not necessarily on infra node.
- **kubernetes node 1-3**::
Kubernetes cluster overview
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-In El Alto we are using RKE as k8s orchestrator method, however everyone is free to diverge from this example and can set it up in own way omitting our rke playbook execution.
+In El Alto we are using RKE as k8s orchestrator method, however everyone is free to diverge from this example and can set it up in own way omitting our rke playbook execution.
=================== ================== ==================== ============== ============ ===============
KUBERNETES NODE OS NETWORK CPU RAM STORAGE
$ cd <app_data_path>/<app_name>/helm_charts/robot
$ ./ete-k8s.sh onap health
+For better work with terminal screen and jq packages were added . It can be installed from resources directory.
+
+Screen is a terminal multiplexer. With screen it is possible to have more terminal instances active. Screen as well keeps active SSH connections even terminal is closed.
+
+Jq can be used for editing json data format as output of kubectl. For example jq was used to troubleshoot `SDNC-739 (UEB - Listener in Crashloopback) <https://jira.onap.org/browse/SDNC-739/>`_ ::
+
+ $ kubectl -n onap get job onap-sdc-sdc-be-config-backend -o json | jq "del(.spec.selector)" | jq "del(.spec.template.metadata.labels)" | kubectl -n onap replace --force -f -
-----