Promote resources from builds and between Spaces

This topic tells you how to manage resources in a GitOps project. In these examples the GitOps project at ~/gitops-project has this structure:

.
├── spaces
│   └── space-dev
│   └── space-prod
└── tanzu.yml

Promote resources from a build to a Space

To promote resources from a build to a Space:

  1. With your current directory as the root of your source code, generate a build you want to promote by running:

    tanzu build --output-dir DIR-PATH
    
  2. Promote the build to a GitOps-managed Space by running:

    tanzu promote --from-build DIR-PATH --to ~/gitops-project/spaces/space-dev
    

    You can deploy these resources as a part of the GitOps project.

Promote resources from one Space to another

Promote resources from space-dev to space-prod by running:

cd ~/gitops-project/spaces/space-dev
tanzu promote --to ../space-prod

You can deploy these resources as a part of the GitOps project.

By running the tanzu promote command you can detect fields that might not be shared between environments. For example, if a ContainerApp in space-prod is configured to have eight replicas even though it has only three replicas in space-dev, the ContainerApp continues to have eight replicas in space-prod when subsequent builds are promoted.

For more information, see ContainerApp API reference.

Promote only some resources from one Space to another

You can promote only resources that are associated with a specific ContainerApp. For example, to promote only resources associated with the ContainerApp where-for-dinner-ui from space-dev to space-prod run:

cd ~/gitops-project/spaces/space-dev
tanzu promote --to ../space-prod --filter ContainerApp/where-for-dinner-ui
# For multiple apps
tanzu promote --to ../space-prod --filter ContainerApp/where-for-dinner-crawler,ContainerApp/where-for-dinner-availability
check-circle-line exclamation-circle-line close-line
Scroll to top icon