-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Environment Migration script for encryption (#1732)
* Fix Environment Migration script for encryption Add ability for Composer Environment Migration script to decrypt and reencrypt variables and connections using the new fernet key. * Fix lint errors. Add README.
- Loading branch information
Showing
4 changed files
with
272 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
.. This file is automatically generated. Do not edit this file directly. | ||
Google Cloud Composer Python Samples | ||
=============================================================================== | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=composer/tools/README.rst | ||
|
||
|
||
This directory contains samples for Google Cloud Composer. `Google Cloud Composer`_ is a managed Apache Airflow service that helps you create, schedule, monitor and manage workflows. Cloud Composer automation helps you create Airflow environments quickly and use Airflow-native tools, such as the powerful Airflow web interface and command line tools, so you can focus on your workflows and not your infrastructure. | ||
|
||
|
||
|
||
|
||
.. _Google Cloud Composer: https://cloud.google.com/composer/docs | ||
|
||
Setup | ||
------------------------------------------------------------------------------- | ||
|
||
|
||
Authentication | ||
++++++++++++++ | ||
|
||
This sample requires you to have authentication setup. Refer to the | ||
`Authentication Getting Started Guide`_ for instructions on setting up | ||
credentials for applications. | ||
|
||
.. _Authentication Getting Started Guide: | ||
https://cloud.google.com/docs/authentication/getting-started | ||
|
||
Install Dependencies | ||
++++++++++++++++++++ | ||
|
||
#. Clone python-docs-samples and change directory to the sample directory you want to use. | ||
|
||
.. code-block:: bash | ||
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git | ||
#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. | ||
|
||
.. _Python Development Environment Setup Guide: | ||
https://cloud.google.com/python/setup | ||
|
||
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. | ||
|
||
.. code-block:: bash | ||
$ virtualenv env | ||
$ source env/bin/activate | ||
#. Install the dependencies needed to run the samples. | ||
|
||
.. code-block:: bash | ||
$ pip install -r requirements.txt | ||
.. _pip: https://pip.pypa.io/ | ||
.. _virtualenv: https://virtualenv.pypa.io/ | ||
|
||
Samples | ||
------------------------------------------------------------------------------- | ||
|
||
Create a new Composer environment based on an existing environment | ||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
.. image:: https://gstatic.com/cloudssh/images/open-btn.png | ||
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=composer/tools/copy_environment.py,composer/tools/README.rst | ||
|
||
|
||
|
||
|
||
To run this sample: | ||
|
||
.. code-block:: bash | ||
$ python copy_environment.py | ||
usage: copy_environment.py [-h] [--running_as_service_account] | ||
[--override_machine_type OVERRIDE_MACHINE_TYPE] | ||
[--override_disk_size_gb OVERRIDE_DISK_SIZE_GB] | ||
[--override_network OVERRIDE_NETWORK] | ||
[--override_subnetwork OVERRIDE_SUBNETWORK] | ||
project location existing_env_name new_env_name | ||
Clone a composer environment. | ||
positional arguments: | ||
project Google Cloud Project containing existing Composer | ||
Environment. | ||
location Google Cloud region containing existing Composer | ||
Environment. For example `us-central1`. | ||
existing_env_name The name of the existing Composer Environment. | ||
new_env_name The name to use for the new Composer Environment. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
--running_as_service_account | ||
Set this flag if the script is running on a VM with | ||
same service account as used in the Composer | ||
Environment. This avoids creating extra credentials. | ||
--override_machine_type OVERRIDE_MACHINE_TYPE | ||
Optional. Overrides machine type used for Cloud | ||
Composer Environment. Must be a fully specified | ||
machine type URI. | ||
--override_disk_size_gb OVERRIDE_DISK_SIZE_GB | ||
Optional. Overrides the disk size in GB used for Cloud | ||
Composer Environment. | ||
--override_network OVERRIDE_NETWORK | ||
Optional. Overrides the network used for Cloud | ||
Composer Environment. | ||
--override_subnetwork OVERRIDE_SUBNETWORK | ||
Optional. Overrides the subnetwork used for Cloud | ||
Composer Environment. | ||
.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This file is used to generate README.rst | ||
|
||
product: | ||
name: Google Cloud Composer | ||
short_name: Cloud Composer | ||
url: https://cloud.google.com/composer/docs | ||
description: > | ||
`Google Cloud Composer`_ is a managed Apache Airflow service that helps | ||
you create, schedule, monitor and manage workflows. Cloud Composer | ||
automation helps you create Airflow environments quickly and use | ||
Airflow-native tools, such as the powerful Airflow web interface and | ||
command line tools, so you can focus on your workflows and not your | ||
infrastructure. | ||
|
||
setup: | ||
- auth | ||
- install_deps | ||
|
||
samples: | ||
- name: Create a new Composer environment based on an existing environment | ||
file: copy_environment.py | ||
show_help: True | ||
|
||
cloud_client_library: false | ||
|
||
folder: composer/tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
cryptography==2.3.1 | ||
google-api-python-client==1.6.4 | ||
google-auth==1.5.1 | ||
google-cloud-storage==1.11.0 | ||
kubernetes==7.0.0 | ||
mysql-connector-python==8.0.12 |