aboutsummaryrefslogtreecommitdiffstats
path: root/docs/k8s/helm.rst
blob: 17e22555f50b6f1d3514b69ef74302dc66e6adc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) Anuket, Spirent, AT&T, Ixia  and others.

============================================================
Automated deployment of helm charts with python
============================================================

********************
Directory Structure
********************
.. code-block:: console


    ├── charts
    │   ├── mynet.yaml
    │   ├── pod.yaml
    │   ├── proxchart
    │   │   ├── Chart.yaml
    │   │   ├── templates
    │   │   │   ├── daemonset.yaml
    │   │   │   ├── deployment.yaml
    │   │   │   └── service.yaml
    │   │   └── values.yaml
    │   ├── testpmdchart
    │   │   ├── Chart.yaml
    │   │   ├── templates
    │   │   │   ├── daemonset.yaml
    │   │   │   ├── deployment.yaml
    │   │   │   └── service.yaml
    │   │   └── values.yaml
    │   └── trexchart
    │       ├── Chart.yaml
    │       ├── templates
    │       │   ├── daemonset.yaml
    │       │   ├── deployment.yaml
    │       │   └── service.yaml
    │       └── values.yaml
    └── pyscript
        ├── Pipfile
        ├── Pipfile.lock
        └── main.py


***************
Using the tool
***************

Charts folder contains three different charts - ``proxchart, testpmd chart and trex chart``. Any of the one can be used for testing.
Pyscript folder contains ``main.py`` - the main python script that depploys the helm chart of user's choice and returns important configuration of the charts, such as PodIP, Cluster IP, Interface IPs etc.

************************
Important Configurations
************************

In order to run the python script, we need to install Pipenv to create virtual environment.

Steps:

1. Install

.. code-block:: console

    pip install --user pipenv

2. To activate the environment

.. code-block:: console

    pipenv shell

The last command will automatically read Pipfile.lock and will create an virtual environment.

Once this configuration is done. We can move on to run our python script.

*************************************************
Procedure to automatically deploy the helm chart
*************************************************

Steps:

1. After activating your virtual environment, run the ``main.py``.

.. code-block:: console

    python main.python

2. Enter the location of the chart you want to deploy.

For example, lets deploy proxchart

.. code-block:: console

    Enter the location of helm chart: ../charts/proxchart

3. The last command will execute the entire ``main.py`` and will return all the required information about the chart.

*******
Output
*******

.. code-block:: console

    Status of helm charts

    NAME     	NAMESPACE	REVISION	UPDATED                             	STATUS  	CHART          	APP VERSION
    proxchart	default  	1       	2021-09-27 13:22:21.864816 +0530 IST	deployed	proxchart-0.1.0	1.0
    ----------------------------------------------------------------------------------------------------

    POD DETAILS

    ┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳
    ┃ POD NAME              ┃ NAMESPACE ┃ HOST-IP      ┃ PHASE   ┃ POD-IP     ┃ POD-IPs                ┃
    ┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
    │ prox-6db7c6dc9b-l42v4 │ default   │ 192.168.49.2 │ Running │ 172.17.0.4 │ [{'ip': '172.17.0.4'}] │
    └───────────────────────┴───────────┴──────────────┴─────────┴────────────┴────────────────────────┴
    ┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
    ┃ POD NAME              ┃ INTERFACE IPs                                                     ┃
    ┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
    │ prox-6db7c6dc9b-l42v4 │ 127.0.0.1/8, 172.17.0.4/16, 127.0.0.1, 172.17.0.4, 172.17.255.255 │
    └───────────────────────┴───────────────────────────────────────────────────────────────────┘

    DEPLOYMENT DETAILS

    ┏━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
    ┃ NAME      ┃ Type     ┃ CLUSTER-IP    ┃ EXTERNAL-IP ┃ PORT(S)        ┃
    ┡━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
    │ proxchart │ NodePort │ 10.103.156.83 │ {}          │ 8081:31036/TCP │
    └───────────┴──────────┴───────────────┴─────────────┴────────────────┘

********************
Future Enhancements
********************

In future, more information can be extracted by adding new functions to the file. The process of getting interfaces using regex can be made more proficient.