The following sections describe 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.
tanzu promote
detects fields that might not be shared between environments. For example, if a ContainerApp in space-prod
is configured to have 8 replicas even though it has only 3 replicas in space-dev
, the ContainerApp continues to have 8 replicas in space-prod
when subsequent builds are promoted.
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