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

Tencent Cloud 201921 #54526

Merged
merged 32 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6909e37
add tencentcloud conf example
likexian Sep 18, 2019
a4b1d28
add tencentcloud testing
likexian Sep 18, 2019
24c9c15
fixed python and doc lint check
likexian Sep 18, 2019
4270f32
Leave password blank in conf
Akm0d Sep 19, 2019
612b49d
fixed spelling and formatting
Akm0d Sep 19, 2019
249b545
fixed all the formatting
Akm0d Sep 20, 2019
f925ff7
Typo and formatting fixes.
waynew Sep 20, 2019
c015e46
fixed doc build errors
Akm0d Sep 30, 2019
7e0750d
fixed incorrect merge
Akm0d Nov 7, 2019
3321997
added tencentcloud to the toctree and fixed linter
Akm0d Dec 11, 2019
7fd7bb7
added tencentcloud to the toctree and fixed linter
Akm0d Dec 11, 2019
f211e37
Merge branch 'master' of https://github.com/saltstack/salt into tenen…
Akm0d Dec 11, 2019
ac74e47
fixed linter error
Akm0d Dec 11, 2019
ddf381d
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 12, 2019
b027ceb
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 12, 2019
5ee3956
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 14, 2019
7083882
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 15, 2019
1f68f10
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 16, 2019
a8c17e4
Merge branch 'master' into tenentcloud_201921
Akm0d Dec 17, 2019
0ef17ea
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 1, 2020
ea19e24
Merge branch 'master' of https://github.com/saltstack/salt into tenen…
Akm0d Jan 3, 2020
7aba845
use RUNTIME_VARS for test root dir
Akm0d Jan 3, 2020
fa04322
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 4, 2020
8e529ca
Merge branch 'master' of https://github.com/saltstack/salt into tenen…
Akm0d Jan 4, 2020
2ef14bb
updated version-added for tencentcloud
Akm0d Jan 4, 2020
916ce3d
Merge branch 'tenentcloud_201921' of github.com:Akm0d/salt into tenen…
Akm0d Jan 4, 2020
ad93fa7
Disable pylint no-name-in-module for tried import
Akm0d Jan 4, 2020
ea35816
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 6, 2020
556db16
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 6, 2020
a3c017d
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 6, 2020
c244c16
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 7, 2020
59aad06
Merge branch 'master' into tenentcloud_201921
Akm0d Jan 8, 2020
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
11 changes: 11 additions & 0 deletions conf/cloud.profiles
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,14 @@
# script: Fedora
# minion:
# cheese: edam

#tencentcloud-guangzhou-s1sm1:
# provider: my-tencentcloud-config
# availability_zone: ap-guangzhou-3
# image: img-31tjrtph
# size: S1.SMALL1
# allocate_public_ip: True
# internet_max_bandwidth_out: 1
# password: '153e41ec96140152'
# securitygroups:
# - sg-5e90804b
10 changes: 10 additions & 0 deletions conf/cloud.profiles.d/tencentcloud-guangzhou-s1sm1.profiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#tencentcloud-guangzhou-s1sm1:
# provider: my-tencentcloud-config
# availability_zone: ap-guangzhou-3
# image: img-31tjrtph
# size: S1.SMALL1
# allocate_public_ip: True
# internet_max_bandwidth_out: 1
# password: '153e41ec96140152'
# securitygroups:
# - sg-5e90804b
9 changes: 9 additions & 0 deletions conf/cloud.providers
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,12 @@

#my-scaleway-config:
# driver: scaleway

#my-tencentcloud-config:
# driver: tencentcloud
# Tencent Cloud Secret Id
# id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
# key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
# location: ap-guangzhou
8 changes: 8 additions & 0 deletions conf/cloud.providers.d/tencent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#my-tencentcloud-config:
# driver: tencentcloud
# Tencent Cloud Secret Id
# id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
# key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
# location: ap-guangzhou
1 change: 1 addition & 0 deletions doc/ref/clouds/all/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cloud modules
scaleway
softlayer
softlayer_hw
tencentcloud
vagrant
virtualbox
vmware
Expand Down
6 changes: 6 additions & 0 deletions doc/ref/clouds/all/salt.cloud.clouds.tencentcloud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
==============================
salt.cloud.clouds.tencentcloud
==============================

.. automodule:: salt.cloud.clouds.tencentcloud
:members:
276 changes: 138 additions & 138 deletions doc/topics/cloud/features.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/topics/cloud/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Cloud Provider Specifics
Getting Started With Scaleway <scaleway>
Getting Started With Saltify <saltify>
Getting Started With SoftLayer <softlayer>
Getting Started With Tencent Cloud <tencentcloud>
Getting Started With Vagrant <vagrant>
Getting Started With Vexxhost <vexxhost>
Getting Started With Virtualbox <virtualbox>
Expand Down
309 changes: 309 additions & 0 deletions doc/topics/cloud/tencentcloud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
==================================
Getting Started With Tencent Cloud
==================================

Tencent Cloud is a secure, reliable and high-performance cloud compute service
provided by Tencent. It is the 2nd largest Cloud Provider in China.


Dependencies
============
The Tencent Cloud driver for Salt Cloud requires the ``tencentcloud-sdk-python`` package,
which is available at PyPI:

https://pypi.org/project/tencentcloud-sdk-python/

This package can be installed using ``pip`` or ``easy_install``:

.. code-block:: bash

# pip install tencentcloud-sdk-python
# easy_install tencentcloud-sdk-python


Provider Configuration
======================
To use this module, set up the cloud configuration at
``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/*.conf``:

.. code-block:: yaml

my-tencentcloud-config:
driver: tencentcloud
# Tencent Cloud Secret Id
id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
location: ap-guangzhou

Configuration Parameters
~~~~~~~~~~~~~~~~~~~~~~~~

driver
------
**Required**. ``tencentcloud`` to use this module.

id
--
**Required**. Your Tencent Cloud secret id.

key
---
**Required**. Your Tencent Cloud secret key.

location
--------
**Optional**. If this value is not specified, the default is ``ap-guangzhou``.
Available locations can be found using the ``--list-locations`` option:

.. code-block:: bash

# salt-cloud --list-location my-tencentcloud-config


Profile Configuration
=====================

Tencent Cloud profiles require a ``provider``, ``availability_zone``, ``image`` and ``size``.
Set up an initial profile at ``/etc/salt/cloud.profiles`` or ``/etc/salt/cloud.profiles.d/*.conf``:

.. code-block:: yaml

tencentcloud-guangzhou-s1sm1:
provider: my-tencentcloud-config
availability_zone: ap-guangzhou-3
image: img-31tjrtph
size: S1.SMALL1
allocate_public_ip: True
internet_max_bandwidth_out: 1
password: '153e41ec96140152'
securitygroups:
- sg-5e90804b

Configuration Parameters
~~~~~~~~~~~~~~~~~~~~~~~~

provider
--------
**Required**. Name of entry in ``salt/cloud.providers.d/???`` file.

availability_zone
-----------------
**Required**. The availability zone that the instance is located in.
Available zones can be found using the ``list_availability_zones`` function:

.. code-block:: bash

# salt-cloud -f list_availability_zones my-tencentcloud-config

image
-----
**Required**. The image id to use for the instance.
Available images can be found using the ``--list-images`` option:

.. code-block:: bash

# salt-cloud --list-images my-tencentcloud-config

size
----
**Required**. Instance type for instance can be found using the ``--list-sizes`` option.

.. code-block:: bash

# salt-cloud --list-sizes my-tencentcloud-config

securitygroups
--------------
**Optional**. A list of security group ids to associate with.
Available security group ids can be found using the ``list_securitygroups`` function:

.. code-block:: bash

# salt-cloud -f list_securitygroups my-tencentcloud-config

Multiple security groups are supported:

.. code-block:: yaml

tencentcloud-guangzhou-s1sm1:
securitygroups:
- sg-5e90804b
- sg-8kpynf2t

hostname
--------
**Optional**. The hostname of the instance.

instance_charge_type
--------------------
**Optional**. The charge type of the instance. Valid values are ``PREPAID``,
``POSTPAID_BY_HOUR`` and ``SPOTPAID``. The default is ``POSTPAID_BY_HOUR``.

instance_charge_type_prepaid_renew_flag
---------------------------------------
**Optional**. When enabled, the instance will be renew automatically
when it reaches the end of the prepaid tenancy.
Valid values are ``NOTIFY_AND_AUTO_RENEW``, ``NOTIFY_AND_MANUAL_RENEW`` and ``DISABLE_NOTIFY_AND_MANUAL_RENEW``.

.. note::

This value is only used when ``instance_charge_type`` is set to ``PREPAID``.

instance_charge_type_prepaid_period
-----------------------------------
**Optional**. The tenancy time in months of the prepaid instance,
Valid values are ``1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36``.

.. note::

This value is only used when ``instance_charge_type`` is set to ``PREPAID``.

allocate_public_ip
------------------
**Optional**. Associate a public ip address with an instance
in a VPC or Classic. Boolean value, default is ``false``.

internet_max_bandwidth_out
--------------------------
**Optional**. Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bits per second).
Value range: ``[0, 100]``. If this value is not specified, the default is ``0`` Mbps.

internet_charge_type
--------------------
**Optional**. Internet charge type of the instance. Valid values are ``BANDWIDTH_PREPAID``,
``TRAFFIC_POSTPAID_BY_HOUR``, ``BANDWIDTH_POSTPAID_BY_HOUR`` and ``BANDWIDTH_PACKAGE``.
The default is ``TRAFFIC_POSTPAID_BY_HOUR``.

key_name
--------
**Optional**. The key pair to use for the instance, for example ``skey-16jig7tx``.

password
--------
**Optional**. Login password for the instance.

private_ip
----------
**Optional**. The private ip to be assigned to this instance,
must be in the provided subnet and available.

project_id
----------
**Optional**. The project this instance belongs to, defaults to ``0``.

vpc_id
------
**Optional**. The id of a VPC network.
If you want to create instances in a VPC network, this parameter must be set.

subnet_id
---------
**Optional**. The id of a VPC subnet.
If you want to create instances in VPC network, this parameter must be set.

system_disk_size
----------------
**Optional**. Size of the system disk.
Value range: ``[50, 1000]``, and unit is ``GB``. Default is ``50`` GB.

system_disk_type
----------------
**Optional**. Type of the system disk.
Valid values are ``CLOUD_BASIC``, ``CLOUD_SSD`` and ``CLOUD_PREMIUM``, default value is ``CLOUD_BASIC``.


Actions
=======
The following actions are supported by the Tencent Cloud Salt Cloud driver.

show_instance
~~~~~~~~~~~~~
This action is a thin wrapper around ``--full-query``, which displays details on a
single instance only. In an environment with several machines, this will save a
user from having to sort through all instance data, just to examine a single
instance.

.. code-block:: bash

$ salt-cloud -a show_instance myinstance

show_disk
~~~~~~~~~
Return disk details about a specific instance.

.. code-block:: bash

$ salt-cloud -a show_disk myinstance

destroy
~~~~~~~
Destroy a Tencent Cloud instance.

.. code-block:: bash

$ salt-cloud -a destroy myinstance

start
~~~~~
Start a Tencent Cloud instance.

.. code-block:: bash

$ salt-cloud -a start myinstance

stop
~~~~
Stop a Tencent Cloud instance.

.. code-block:: bash

$ salt-cloud -a stop myinstance

reboot
~~~~~~
Reboot a Tencent Cloud instance.

.. code-block:: bash

$ salt-cloud -a reboot myinstance


Functions
=========
The following functions are currently supported by the Tencent Cloud Salt Cloud driver.

list_securitygroups
~~~~~~~~~~~~~~~~~~~
Lists all Tencent Cloud security groups in current region.

.. code-block:: bash

$ salt-cloud -f list_securitygroups my-tencentcloud-config

list_availability_zones
~~~~~~~~~~~~~~~~~~~~~~~
Lists all Tencent Cloud availability zones in current region.

.. code-block:: bash

$ salt-cloud -f list_availability_zones my-tencentcloud-config

list_custom_images
~~~~~~~~~~~~~~~~~~
Lists any custom images associated with the account. These images can
be used to create a new instance.

.. code-block:: bash

$ salt-cloud -f list_custom_images my-tencentcloud-config

show_image
~~~~~~~~~~
Return details about a specific image. This image can be used
to create a new instance.

.. code-block:: bash

$ salt-cloud -f show_image tencentcloud image=img-31tjrtph
Loading