Developing portions of an application independently

You can develop and debug parts of your application independently by splitting your application into Skaffold modules. For a sample Skaffold.yaml file with Skaffold modules and dependencies defined, see the Skaffold.yaml file in the Bank of Anthos sample.

Defining Skaffold modules and configuration dependencies

To define Skaffold modules and configuration dependencies:

  1. Install the latest Insiders builds.
  2. Open the project where you want to define the modules.
  3. Open the skaffold.yaml file.
  4. If your skaffold.yaml file has multiple configurations, to make a configuration a Skaffold module, specify the following line:
    metadata:
      name: MODULE_NAME
  5. For configurations that rely on another configuration being deployed before the current configuration can be deployed, define dependencies. To specify a dependency, use the configs tag. The following sample shows a dependency that's defined in the same file. The configs tag can also reference other skaffold.yaml files in the current project.
    requires:
        - configs: [DEPENDENCY_NAME]
        
  6. Test your configuration dependencies by building each of the Skaffold modules separately to make sure that they're deployed with their dependencies.
    1. Open the Command Palette (Ctrl/Cmd+Shift+P) and then run Cloud Code: Run on Kubernetes.
    2. Click Select modules.
    3. Choose the modules that you want to deploy and then click OK. Each module is built with its dependencies.
    4. When prompted, choose an image registry and then press Enter.

Building select Skaffold modules and their dependencies

If your project doesn't have a launch.yaml file defined, when you run Cloud Code: Run on Kubernetes or Cloud Code: Debug on Kubernetes, you're prompted to select the modules to build.

If your project has a launch.yaml file, follow these steps to choose the Skaffold modules to build:

  1. Open the terminal by clicking **Terminal** > **New Terminal**.
  2. Run the following command, where you specify the names of the modules to build as a comma-delimited list:
    skaffold dev --module MODULE1_NAME,MODULE2_NAME