Skip to content

Commit 6704402

Browse files
author
Artem Murashkin
committed
[ePortal] add documentation for server tags
describe UI forms for tags management, add API usage examples for configuration management tools
1 parent afe9fea commit 6704402

File tree

4 files changed

+94
-30
lines changed

4 files changed

+94
-30
lines changed
31.2 KB
Loading
28.7 KB
Loading

docs/eportal-api/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,27 @@ Example:
563563
force_basic_auth: yes
564564
```
565565

566+
Example of server tagging:
567+
568+
```json
569+
- hosts: kernelcare
570+
vars:
571+
eportal_srv: http://192.168.246.110
572+
eportal_server_id: m9W4oTPfG52c0H1Z
573+
eportal_tags: 'staging;location:Boston'
574+
tasks:
575+
- name: set server tags using ePortal API
576+
uri:
577+
url: '{{ eportal_srv }}/admin/api/set_tags'
578+
method: POST
579+
headers:
580+
X-Api-Key: '{{ lookup("env", "EPORTAL_API_TOKEN") }}'
581+
body_format: form-urlencoded
582+
body:
583+
server_id: '{{eportal_server_id }}'
584+
tags: '{{ eportal_tags }}'
585+
```
586+
566587
Ad hoc run with:
567588

568589
```
@@ -613,6 +634,22 @@ http_request "kernelcare-unregister-api" do
613634
end
614635
```
615636

637+
Example of server tagging (kernelcare-tag-server.rb):
638+
639+
```json
640+
eportal_url = "http://192.168.246.110"
641+
eportal_api_key = "Lgk5-qWeBypejSEc6nYmalGbv11Kh_OyWi2_vigrTro"
642+
server_id = "102cb40fcdfbdfa"
643+
tags = "staging;location:Boston"
644+
645+
http_request "kernelcare-tag-server" do
646+
url "#{eportal_url}/admin/api/set_tags"
647+
action :post
648+
message ({'server_id' => server_id, 'tags' => tags}.to_json)
649+
headers({'X-Api-Key' => eportal_api_key, 'Content-Type' => 'application/json'})
650+
end
651+
```
652+
616653
Ad hoc run with:
617654

618655
```
@@ -671,6 +708,19 @@ fi
671708
curl -kL -u "${EPORTAL_API_PASSWORD}"':'"${EPORTAL_API_PASSWORD}" -X POST "${EPORTAL_URL}"'/admin/api/delete_server?ip='"${IP_TO_UNREGISTER}"
672709
```
673710

711+
Example of server tagging (tag_server.sh)
712+
713+
```
714+
#!/bin/bash
715+
716+
EPORTAL_URL='http://192.168.246.110'
717+
EPORTAL_SERVER_ID='m9W4oTPfG52c0H1Z'
718+
EPORTAL_TAGS='staging;location:Boston'
719+
EPORTAL_API_KEY='Lgk5-qWeBypejSEc6nYmalGbv11Kh_OyWi2_vigrTro'
720+
721+
curl -kL -H "X-Api-Key: ${EPORTAL_API_KEY}" --data-urlencode "server_id=${EPORTAL_SERVER_ID}" --data-urlencode "tags=${EPORTAL_TAGS}" "${EPORTAL_URL}/admin/api/set_tags"
722+
```
723+
674724
### Puppet Plan
675725

676726
If you prefer to have a plan rather than a task, then you can create one from this script with the following steps:

docs/eportal/README.md

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,50 @@ A new table is added to the starting page. This table displays the following:
821821

822822
The number of servers for each key is listed on the _Keys_ page.
823823

824+
## Managing server tags
825+
826+
You can use 'Server tags' page to deal with tags.
827+
828+
![server tags view](/images/tags_view.png)
829+
830+
Tagging is a convenient way to group servers by any criteria. For example OS, deployment environment, location, etc.
831+
You need to create a tag and then it can be assigned to a server from the [Managing Servers](#managing-servers) interface.
832+
833+
![tag assignment](/images/tag_assignment.png)
834+
835+
The tag may have an optional value. For example, this allows you to introduce a new geo location without creating a new tag for it.
836+
837+
### Using agent CLI to manage tags
838+
839+
To add an extra Tag field for the server, run:
840+
841+
```text
842+
# kcarectl --tag command
843+
```
844+
845+
where `command` is a parameter defined by a user. This parameter will be displayed in UI for the server. User could add multiple tags for each server. Each tag should be separated with `;` symbol.
846+
847+
Example:
848+
849+
```text
850+
# kcarectl --tag "env:prod;ubuntu"
851+
```
852+
853+
This server has two tags : `env:prod` and `ubuntu`.
854+
855+
`env:prod` is a parameter that has tag name `env` and the value `prod`.
856+
857+
![tags](/images/addingextratagfield_zoom88.png)
858+
859+
To remove all tags from a particular server, run:
860+
861+
```text
862+
# kcarectl --tag ""
863+
```
864+
865+
Where `""` is a parameter to delete the previously defined tag.
866+
867+
824868
## Feed Management
825869

826870
Feeds are intended to manage patchsets on the server, and they provide a possibility to bind a set of patches to a specific key. Possible use cases:
@@ -946,36 +990,6 @@ The API key is personal, meaning it is tied to a specific user and inherits thei
946990
A user with read-only permissions can only manage their own keys,
947991
while an administrator has access to any user's API keys.
948992

949-
## Adding extra Tag field
950-
951-
To add an extra Tag field for the server, run:
952-
953-
```text
954-
# kcarectl --tag command
955-
```
956-
957-
where `command` is a parameter defined by a user. This parameter will be displayed in UI for the server. User could add multiple tags for each server. Each tag should be separated with `;` symbol.
958-
959-
Example:
960-
961-
```text
962-
# kcarectl --tag "env:prod;ubuntu"
963-
```
964-
965-
This server has two tags : `env:prod` and `ubuntu`.
966-
967-
`env:prod` is a parameter that has tag name `env` and the value `prod`.
968-
969-
![tags](/images/addingextratagfield_zoom88.png)
970-
971-
To remove all tags from a particular server, run:
972-
973-
```text
974-
# kcarectl --tag ""
975-
```
976-
977-
Where `""` is a parameter to delete the previously defined tag.
978-
979993
## How to setup ePortal to use HTTPS
980994

981995
Some assumptions for a server where e-portal is deployed:

0 commit comments

Comments
 (0)