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
To promote resources from a build to a Space:
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
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 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.
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