Manage services and workloads

When you set up App Hub, you create an administrative boundary for your applications. This boundary is either the management project or the collection of host and service projects you configured for application management, depending on your setup model. Services and workloads are registered as applications inside this administrative boundary.

To avoid configuration drift and maintain a clear source of truth, we recommend that you manage your application resources in the environment where they were originally defined:

  • For applications deployed from an Application Design Center template: Use Application Design Center to manage and update the application. You can either revise the template for application design changes or create an application revision to update settings such as application and component details.

    Go to Application Design Center

  • For applications created by registering resources in App Hub: Manage the application, its services, and workloads directly within App Hub.

    Go to App Hub

This page describes how to manage services and workloads that are discovered or registered directly within App Hub as applications. You can perform these actions using either the Google Cloud console or the Google Cloud CLI. For applications deployed from a template, see Application Design Center documentation.

Before you begin

Before you can view, update, and unregister services and workloads in App Hub, complete the following steps:

  1. Set up App Hub using one of the supported setup models.
  2. Register supported resources to an application.

Required roles

To get the permissions that you need to manage services and workloads in App Hub, ask your administrator to grant you the following IAM roles on the application administrative boundary from your setup model (the management project or the host and service projects) :

  • Update and unregister services and workloads: App Hub Editor (roles/apphub.editor)
  • View services and workloads: App Hub Viewer (roles/apphub.viewer)

For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

For more information about App Hub roles, see App Hub IAM roles and permissions.

View services and workloads

Follow these steps to view all discovered and registered services and workloads within your App Hub administrative boundary:

Console

  1. In the Welcome page of the Google Cloud console, use the project picker to select your management project or host project:

    Go to Welcome

  2. Navigate to the App Hub Services and workloads page:

    Go to Services and workloads

    The page displays a list of all discovered and registered services and workloads.

  3. Use the Filter field to narrow the results by attributes like Environment or Registration status.

gcloud

  1. Find the project ID of your management project or host project.

  2. Use different commands to list discovered or registered resources to an application.

List discovered resources

Discovered resources are available to be registered to an application. Follow these steps to list discovered resources:

  1. List discovered services:

    gcloud apphub discovered-services list \
        --project=PROJECT_ID \
        --location=LOCATION
    

    Replace the following:

    • PROJECT_ID: the ID of your host project or management project.
    • LOCATION: the location where you want to discover resources. Use global for global resources or a specific region, such as us-east1, for regional resources.
  2. List discovered workloads:

    gcloud apphub discovered-workloads list \
        --project=PROJECT_ID \
        --location=LOCATION
    

List registered resources

Registered resources are part of an application. Follow these steps to list registered resources of a particular application. You can filter the list based on attributes, using the --filter flag:

  1. List registered services in an application:

    gcloud apphub applications services list \
        --application=APPLICATION_NAME \
        --project=PROJECT_ID \
        --location=LOCATION \
        --filter=FILTER_EXPRESSION
    

    Replace the following:

    • APPLICATION_NAME: the name of your application. You specify this value when you create an application.
    • PROJECT_ID: the ID of your host project or management project.
    • LOCATION: the resource location. Use global for global resources or a specific region, such as us-east1, for regional resources.
    • Optional: FILTER_EXPRESSION: the filter expression to specify attributes. For example, to list resources with a PRODUCTION environment type, use attributes.environment.type=PRODUCTION.
  2. List registered workloads in an application:

    gcloud apphub applications workloads list \
        --application=APPLICATION_NAME \
        --project=PROJECT_ID \
        --location=LOCATION \
        --filter=FILTER_EXPRESSION
    

Update service and workload attributes

Follow these steps to modify the user-defined attributes of services and workloads that are registered to an application:

Console

  1. In the Welcome page of the Google Cloud console, use the project picker to select your management project or host project:

    Go to Welcome

  2. Navigate to the App Hub Applications page:

    Go to Applications

    The page displays a list of your applications.

  3. Click the name the application for which you want to update service or workload attributes.

  4. In the Services and workloads tab, find the name of the service or workload you want to update.

  5. Click more_vert More, then click Edit service or Edit workload.

  6. In the pane that opens, edit the fields as required and click Save.

gcloud

  1. Find the project ID of your management project or host project.

  2. Update service or workload attributes:

    • Update service attributes:

      gcloud apphub applications services update SERVICE_NAME \
          --application=APPLICATION_NAME \
          --project=PROJECT_ID \
          --location=LOCATION \
          --display-name=DISPLAY_NAME \
          --criticality-type=CRITICALITY_LEVEL \
          --environment-type=ENVIRONMENT \
          --developer-owners=display-name=DEV_NAME,email=DEV_EMAIL \
          --operator-owners=display-name=OPERATOR_NAME,email=OPERATOR_EMAIL \
          --business-owners=display-name=BUSINESS_NAME,email=BUSINESS_EMAIL
      

      Replace SERVICE_NAME with the name of the service you want to update.

    • Update workload attributes:

      gcloud apphub applications workloads update WORKLOAD_NAME \
          --application=APPLICATION_NAME \
          --project=PROJECT_ID \
          --location=LOCATION \
          --display-name=DISPLAY_NAME \
          --criticality-type=CRITICALITY_LEVEL \
          --environment-type=ENVIRONMENT \
          --developer-owners=display-name=DEV_NAME,email=DEV_EMAIL \
          --operator-owners=display-name=OPERATOR_NAME,email=OPERATOR_EMAIL \
          --business-owners=display-name=BUSINESS_NAME,email=BUSINESS_EMAIL
      

      Replace WORKLOAD_NAME with the name of the workload you want to update.

      Replace the following required and optional flags:

      • Required: APPLICATION_NAME: the name of your application. You specify this value when you create an application.
      • Required: PROJECT_ID: the ID of your host project or management project.
      • Required: LOCATION: your resource location. Use global for global resources or a specific region, such as us-east1, for regional resources.
      • Optional: DISPLAY_NAME: the display name of your resource.
      • Optional: CRITICALITY_LEVEL: the importance level of the resource. Use one of the following values:

        • MISSION_CRITICAL
        • HIGH
        • MEDIUM
        • LOW
      • Optional: ENVIRONMENT: the stage of the software lifecycle. Use one of the following values:

        • PRODUCTION
        • STAGING
        • DEVELOPMENT
        • TEST
      • Optional: DEV_NAME and DEV_EMAIL: the display name and email address of the developer owner, respectively.

      • Optional: OPERATOR_NAME and OPERATOR_EMAIL: the display name and email address of the operator owner, respectively.

      • Optional: BUSINESS_NAME and BUSINESS_EMAIL: the display name and email address of the business owner, respectively.

Unregister services and workloads

Unregistering a service or workload removes it from an application. The underlying resource is not deleted and becomes a discovered resource again, available for registration to another application.

Follow these steps to unregister services and workloads:

Console

  1. In the Welcome page of the Google Cloud console, use the project picker to select your management project or host project:

    Go to Welcome

  2. Navigate to the App Hub Applications page:

    Go to Applications

    The page displays a list of your applications.

  3. Click the name the application from which you want to unregister services or workloads.

  4. In the Services and workloads tab, click the name of the service or workload you want to unregister.

  5. On the details page for the resource, click Unregister.

gcloud

  1. Find the project ID of your management project or host project.

  2. Unregister a service or a workload:

    • Unregister a service:

      gcloud apphub applications services delete SERVICE_NAME \
          --application=APPLICATION_NAME \
          --project=PROJECT_ID \
          --location=LOCATION
      

      Replace the following:

      • SERVICE_NAME: the name of the service you want to unregister.
      • APPLICATION_NAME: the name of your application. You specify this value when you create an application.
      • PROJECT_ID: the ID of your host project or management project.
      • LOCATION: the resource location. Use global for global resources or a specific region, such as us-east1, for regional resources.
    • Unregister a workload:

      gcloud apphub applications workloads delete WORKLOAD_NAME \
          --application=APPLICATION_NAME \
          --project=PROJECT_ID \
          --location=LOCATION
      

      Replace WORKLOAD_NAME with the name of the workload you want to unregister.

After unregistering all services and workloads, you can delete the application.

What's next