Upgrade environments

Cloud Composer 3  |  Cloud Composer 2 |  Cloud Composer 1

This page describes how to upgrade your environment to a new Cloud Composer or Airflow version.

About upgrade operations

You can upgrade the Cloud Composer version, the Airflow version, or both at the same time.

When you change the version of Airflow or Cloud Composer used by your environment:

  • Cloud Composer re-deploys your environment's components using new versions of Cloud Composer images .

  • Cloud Composer applies Airflow configuration changes, such as custom PyPI packages or Airflow configuration option overrides, if your environment had them before the upgrade.

  • Cloud Composer updates the Airflow airflow_db connection to point to the new Cloud SQL database.

Upgrading doesn't change how you connect to the resources in your environment, such as the URL of your environment's bucket, or Airflow web server.

Limitations of upgrade operations

Upgrade operations have the following limitations:

  • Cloud Composer releases are gradually rolled out to all regions supported by Cloud Composer over several days. The latest version from a release in progress might not be available in your region yet.

  • You can't downgrade to an earlier Cloud Composer or Airflow version.

  • In Google Cloud console, you can upgrade only to the latest supported versions of Cloud Composer 2.

  • In Google Cloud CLI, API, or Terraform, you can upgrade an environment to the latest supported versions, three previous versions of Cloud Composer 2, the last patch version of the previous minor version, and to versions with an extended upgrade timeline. It's not possible to upgrade to other versions of Cloud Composer 2, even if they are still supported and can be used to create a new environment.

    Example of upgrade choices for Google Cloud CLI, API, and Terraform:

    • Latest versions: composer-2.11.5-airflow-*
    • Three previous Cloud Composer 2 versions: composer-2.11.4-airflow-* , composer-2.11.3-airflow-* , composer-2.11.2-airflow-* .
    • Last patch of the previous Cloud Composer 2 minor version: composer-2.10.2-airflow-*
    • Cloud Composer 2 versions with an extended upgrade timeline: composer-2.10.2-airflow-* , composer-2.10.1-ariflow-* , composer-2.9.7-airflow-* , and other versions with an extended upgrade timeline.
  • The version that you upgrade to must support your environment's current Python version.

  • The Compute Engine API quota limits can prevent upgrades. In Google Cloud console, navigate to the IAM and Admin > Quotas and System Limitspage and check if the Compute Engine APIquota for CPU is not exceeded. If the quota threshold is being approached, request Quota extension before proceeding with upgrade operation.

  • You can't upgrade your environment if the Airflow database contains more than 16 GB of data. During an upgrade, a warning is shown if the Airflow database size is more than 16 GB. In this case, perform the database maintenance to reduce the database size.

  • If you use the XCom mechanism to transfer files, make sure that you use it according to Airflow's guidelines . Transferring big files or a large number of files using XCom impacts Airflow database's performance and can lead to failures when loading snapshots or upgrading your environment. Consider using alternatives such as Cloud Storage to transfer large volumes of data.

Before you begin

  • We recommend to create a new snapshot of the environment to be able to re-create the environment in case this is needed.

  • Your account must have a role that can trigger environment upgrade operations. In addition, the service account of the environment must have a role that has enough permissions to perform upgrade operations. For more information, see Access control .

  • You might notice Compute Engine metadata entries for the GKE clusters that belong to environments in your project. During GKE cluster creation and upgrades, Google Kubernetes Engine automatically adds project-level metadata entries ( google_compute_project_metadata ) to track secondary IP address range usage. Don't modify or remove these entries. Google Kubernetes Engine manages them automatically.

Check that your environment is up to date

Cloud Composer displays warnings when your environment's image approaches its end of full support date. You can use these warnings to always keep your environment supported .

A deprecation message is displayed on the Environment details page
Figure 1. A deprecation message is displayed on the Environment details page

Cloud Composer keeps track of the Cloud Composer image version that your environment is based on. When it approaches the end of support date , you can see a warning in the list of environments and on the Environment detailspage.

To check if your environment is up to date:

Console

  1. In Google Cloud console, go to the Environmentspage.

    Go to Environments

  2. In the list of environments, click the name of your environment. The Environment detailspage opens.

  3. Go to the Environment configurationtab.

  4. In the Image versionfield, one of the following messages is displayed:

    • Newest available version. Your environment image is fully supported.

    • New version available. Your environment image is fully supported and you can upgrade it to a later version.

    • Support for this image version ends in...Your environment image approaches the end of the full support period.

    • This version is not supported as of...Your environment is past the full support period.

gcloud

This functionality is not available through Google Cloud CLI. You can View suggested upgrades instead, which shows new versions that are available.

API

This functionality is not available through API. You can View suggested upgrades instead, which shows new versions that are available.

View suggested upgrades

Cloud Composer provides a list of Cloud Composer versions that you can upgrade your environment to.

To view Cloud Composer versions suggested for an upgrade:

Console

  1. In Google Cloud console, go to the Environmentspage.

    Go to Environments

  2. In the list of environments, click the name of your environment. The Environment detailspage opens.

  3. Go to the Environment configurationtab and click Upgrade Image Version.

  4. For the list of suggested versions, click the Cloud Composer Image versiondrop-down menu.

gcloud

 gcloud  
composer  
environments  
list-upgrades  
 \ 
  
 ENVIRONMENT_NAME 
  
 \ 
  
--location  
 LOCATION 
 

Replace:

  • ENVIRONMENT_NAME with the name of the environment.
  • LOCATION with the region where the environment is located.

Example:

 gcloud  
composer  
environments  
list-upgrades  
example-environment  
 \ 
  
--location  
us-central1 

API

You can view available versions for a location. To do so, construct an imageVersions.list API request.

For example:

  // GET https://composer.googleapis.com/v1/projects/example-project/ 
 // locations/us-central1/imageVersions 
 

Check for PyPI package conflicts before upgrading

You can check if PyPI packages installed in your environment have any conflicts with preinstalled packages in the new Cloud Composer image.

A successful check means that there are no conflicts in PyPI package dependencies between the current and the specified version. However, an upgrade operation might still not be successful because of other reasons.

Console

To run an upgrade check for your environment:

  1. In Google Cloud console, go to the Environmentspage.

    Go to Environments

  2. In the list of environments, click the name of your environment. The Environment detailspage opens.

  3. Go to the Environment configurationtab, locate the Image versionentry, and click Upgrade.

  4. In the Environment version upgradedialog, in the New versiondrop-down list, select a Cloud Composer version that you want to upgrade to.

  5. In the PyPI packages compatibilitysection, click Check for conflicts.

  6. Wait until the check is complete. If there are PyPI package dependency conflicts, then the displayed error messages contain details about conflicting packages and package versions.

gcloud

To run an upgrade check for your environment, run the environments check-upgrade command with the Cloud Composer image version. that you want to upgrade to.

 gcloud  
composer  
environments  
check-upgrade  
 \ 
  
 ENVIRONMENT_NAME 
  
 \ 
  
--location  
 LOCATION 
  
 \ 
  
--image-version  
 VERSION 
 

Replace:

  • ENVIRONMENT_NAME with the name of the environment.
  • LOCATION with the region where the environment is located.
  • VERSION with the new Cloud Composer image version that you want to upgrade to, in the composer-a.b.c-airflow-x.y.z format. You can also use all version aliases .

Example:

 gcloud  
composer  
environments  
check-upgrade  
example-environment  
 \ 
  
--location  
us-central1  
 \ 
  
--image-version  
composer-2.14.1-airflow-2.10.5 

Example output:

 Waiting for [projects/example-project/locations/us-central1/environments/
example-environment] to be checked for PyPI package conflicts when upgrading
to composer-2.14.1-airflow-2.10.5. Operation [projects/example-project/locations/
us-central1/operations/04d0e8b2-...]...done.
...

Response:
'@type': type.googleapis.com/
google.cloud.orchestration.airflow.service.v1.CheckUpgradeResponse
buildLogUri: https://console.cloud.google.com/cloud-build/builds/79738aa7-... containsPypiModulesConflict: CONFLICTpypiConflictBuildLogExtract: |-
The Cloud Build image build failed: Build failed; check build logs for
details. Full log can be found at https://console.cloud.google.com/
cloud-build/builds/79738aa7-... Error details: tensorboard 2.2.2 has requirement
setuptools>=41.0.0, but you have setuptools 40.3.0. 

As an alternative, you can run an upgrade check asynchronously. Use the --async argument to make an asynchronous call, then check the result with the gcloud composer operations describe command.

API

Construct an environments.checkUpgrade API request.

Specify the image version in the imageVersion field:

  { 
  
 "imageVersion" 
 : 
  
 " VERSION 
" 
 } 
 

Replace VERSION with the new version that you want to upgrade to, in the composer-a.b.c-airflow-x.y.z format.

Upgrade your environment

To upgrade your environment to a later version of Cloud Composer or Airflow:

Console

  1. In Google Cloud console, go to the Environmentspage.

    Go to Environments

  2. In the list of environments, click the name of your environment. The Environment detailspage opens.

  3. Go to the Environment configurationtab.

  4. Locate the Image versionitem and click Upgrade.

  5. From the Image versiondrop-down menu, select a Cloud Composer version that you want to upgrade to.

  6. Click Upgrade.

gcloud

 gcloud  
composer  
environments  
update  
 \ 
  
 ENVIRONMENT_NAME 
  
 \ 
  
--location  
 LOCATION 
  
 \ 
  
--image-version  
 VERSION 
 

Replace:

  • ENVIRONMENT_NAME with the name of the environment.
  • LOCATION with the region where the environment is located.
  • VERSION with the new Cloud Composer image version that you want to upgrade to, in the composer-a.b.c-airflow-x.y.z format. You can also use all version aliases .

For example:

 gcloud  
composer  
environments  
update  
example-environment  
 \ 
  
--location  
us-central1  
 \ 
  
--image-version  
composer-2.14.1-airflow-2.10.5 

API

  1. Construct an environments.patch API request.

  2. In this request:

    1. In the updateMask parameter, specify the config.softwareConfig.imageVersion mask.

    2. In the request body, in the imageVersion field, specify a new version that you want to upgrade to.

For example:

  // PATCH https://composer.googleapis.com/v1/projects/example-project/ 
 // locations/us-central1/environments/example-environment?updateMask= 
 // config.softwareConfig.imageVersion 
  
 { 
  
 "config" 
 : 
  
 { 
  
 "softwareConfig" 
 : 
  
 { 
  
 "imageVersion" 
 : 
  
 "composer-2.14.1-airflow-2.10.5" 
  
 } 
  
 } 
  
 } 
 

Terraform

The image_version field in the config.software_config block controls the Cloud Composer image of your environment. In this field, specify a new Cloud Composer image.

   
 resource 
  
 "google_composer_environment" 
  
 "example" 
  
 { 
  
 provider 
  
 = 
  
 google-beta 
  
 name 
  
 = 
  
 " ENVIRONMENT_NAME 
" 
  
 region 
  
 = 
  
 " LOCATION 
" 
  
 config 
  
 { 
  
 software_config 
  
 { 
  
 image_version 
  
 = 
  
 " VERSION 
" 
  
 } 
  
 } 
 } 
 

Replace:

  • ENVIRONMENT_NAME with the name of the environment.
  • LOCATION with the region where the environment is located. the new Cloud Composer image version that you want to upgrade to, in the composer-a.b.c-airflow-x.y.z format. You can also use all version aliases .

Example:

  resource 
  
 "google_composer_environment" 
  
 "example" 
  
 { 
  
 provider 
  
 = 
  
 google-beta 
  
 name 
  
 = 
  
 "example-environment" 
  
 region 
  
 = 
  
 "us-central1" 
  
 config 
  
 { 
  
 software_config 
  
 { 
  
 image_version 
  
 = 
  
 "composer-2.14.1-airflow-2.10.5" 
  
 } 
  
 } 
 } 
 

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: