Skip to content

[MTA 8.0.0] Asset generation new features #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion assemblies/cli-guide/assembly_generating-assets.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ endif::[]

Starting from {ProductShortName} version 7.3.0, you can use the `discover` and `generate` commands in containerless mode to automatically generate the manifests needed to deploy a Cloud Foundry (CF) application in the {ocp-short}:

* Use the `discover` command to generate the discovery manifest in the YAML format from the CF application manifest. The discovery manifest preserves the specifications found in the CF manifest that define the metadata, runtime, and platform configurations.
* Use the `discover` command to generate the discovery manifest in the YAML format directly from a CF instance or from either of the following manifest files:

** A single application manifest
** A CF manifest
** A path to the directory with multiple manifest files, for example, with application manifests, CF manifests, or both of these manifest types.

+
The discovery manifest preserves the specifications found in the CF manifest. The specifications define the metadata, runtime, and platform configurations.

* Use the `generate` command to generate the deployment manifest for {ocp} deployments by using the discovery manifest. The deployment manifest is generated by using a templating engine, such as Helm, that converts the discovery manifest into a Kubernetes-native format. You can also use this command to generate non-Kubernetes manifests, such as a Dockerfile or a configuration file.

:FeatureName: Generating platform assets for application deployment
Expand All @@ -35,6 +43,10 @@ Generating deployment assets has the following benefits:

include::topics/mta-cli/proc_generating-discovery-manifest.adoc[leveloffset=+1]

include::topics/mta-cli/proc_performing-a-live-discovery.adoc[leveloffset=+1]

include::topics/mta-cli/proc_concealing-sensitive-information.adoc[leveloffset=+1]

include::topics/mta-cli/proc_generating-deployment-manifest.adoc[leveloffset=+1]

include::topics/mta-cli/ref_discover-generate-command-options.adoc[leveloffset=+1]
Expand Down
80 changes: 80 additions & 0 deletions docs/topics/mta-cli/proc_concealing-sensitive-information.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
:_newdoc-version: 2.18.5
:_template-generated: 2025-07-22
:_mod-docs-content-type: PROCEDURE

[id="concealing-sensitive-information_{context}"]
= Concealing sensitive information in a discovery manifest

You can conceal sensitive information, for example, services and docker credentials, in a Cloud Foundry (CF) discovery manifest by using the `mta-cli discover cloud-foundry --conceal-sensitive-data` command. This command generates the following files:

* A discovery manifest
* A file with concealed data

NOTE: If you do not specify the `--conceal-sensitive-data` option, the option is automatically set to `false`.



.Procedure
. Display the contents of the CF manifest and locate sensitive data:
+
[subs="+quotes"]
....
$ *cat _<manifest_name>_.yaml*
name: _<manifest_name>_
disk_quota: 512M
memory: 500M
timeout: 10
docker:
image:myregistry/myapp:latest
username: *docker-registry-user*
....

. Generate the discovery manifest for the CF application as an output file and conceal sensitive data:
+
[subs="+quotes"]
....
$ *mta-cli discover cloud-foundry --conceal-sensitive-data=true --input _<path_to_application_manifest>_ --output-dir _<path_to_output_directory>_*
....



.Verification
. Display the repository structure:
+
[subs="+quotes,macros"]
....
$ *tree _<path_to_discovery_manifest>_*
_<path_to_discovery_manifest>_
├── discover_manifestpass:[_]_<app-name>_.yaml
├── secretspass:[_]_<discovery_manifest_name>_.yaml

1 directory, 2 files
....

. Display the contents of the discovery manifest:
+
[subs="+quotes"]
....
$ *cat _<discovery_manifest_name>_.yaml*
name: _<discovery_manifest_name>_
timeout: 10
docker:
image:myregistry/myapp:latest
username: *$(f0e9ea9e-1913-446f-8483-da9301373eef)*
disk: 512M
memory: 500M
instances: 1
....
+
The sensitive data was replaced with a UUID (Universally Unique Identifier).


. Display the contents of the `secretspass:[_]_<discovery_manifest_name>_.yaml` file:
+
[subs="+quotes,macros"]
....
$ *cat secretspass:[_]_<discovery_manifest_name>_.yaml*
f0e9ea9e-1913-446f-8483-da9301373eef: docker-registry-user
....
+
The file contains the mapping of the UUID to the concealed sensitive data.
10 changes: 3 additions & 7 deletions docs/topics/mta-cli/proc_generating-discovery-manifest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ You can generate the discovery manifest for the Cloud Foundry (CF) application b
.Prerequisites

* You have Cloud Foundry (v3) as a source platform.
* You have {ocp-short} as a target platform.
* You installed {ProductShortName} {CLIName} version 7.3.0.
* You have a CF application manifest as a YAML file.
* You installed {ProductShortName} {CLIName} version 7.3.0 or later.

.Procedure

Expand All @@ -26,13 +24,11 @@ You can generate the discovery manifest for the Cloud Foundry (CF) application b
$ *mta-cli discover --list-platforms*
----

. Generate the discovery manifest for a CF application as an output file:
. Generate the discovery manifest:
+
[subs="+quotes"]
----
$ *mta-cli discover cloud-foundry \
--input _<path_to_application-manifest>_ \
--output _<path_to_discovery-manifest>_\*
$ *mta-cli discover cloud-foundry --input _<path_to_input>_ --output-dir _<path_to_output-directory>_*
----

[role="_additional-resources"]
Expand Down
48 changes: 48 additions & 0 deletions docs/topics/mta-cli/proc_performing-a-live-discovery.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
:_newdoc-version: 2.18.5
:_template-generated: 2025-07-22
:_mod-docs-content-type: PROCEDURE

[id="performing-a-live-discovery_{context}"]
= Performing a live discovery in a remote CF instance

You can use a live discovery if you want to determine what is deployed in a certain Cloud Foundry (CF) cluster. For example, you can determine how many applications are in the cluster. You can also use the live discovery if you do not have access to manifest YAML files.

You can run the live discovery for a remote CF instance by using the `mta-cli discover cloud-foundry --use-live-connection --spaces=_<space_name>_` command.

IMPORTANT: You must always define Cloud Foundry spaces to analyze during a live discovery by using the `--spaces` option.


.Prerequisites
* You have permission to remotely connect to the CF instance.

.Procedure
. Optional: Investigate the contents of the remote CF instance
+
[subs="+quotes"]
....
$ *cf spaces*
$ *cf apps*
....

. Copy the CF configuration file to the directory of your choice:
+
[subs="+quotes"]
....
$ *mkdir _<path_to_the_directory>_/.cf*
....

. Run the live discovery in a remote CF instance:
+
[subs="+quotes"]
....
$ *mta-cli discover cloud-foundry --use-live-connection --spaces=_<space_name>_ --output-dir _<path_to_output_directory>_ --cf-config=_<path_to_CF_config_file>_*
....
+
The command runs the discovery for each application from each space.
+
If you want to run the discovery for a specific application, enter, for example:
+
[subs="+quotes"]
....
$ *mta-cli discover cloud-foundry --use-live-connection --app-name=_<application_name>_ --spaces=_<space_name>_ --output-dir _<path_to_output_directory>_ --cf-config=_<path_to_CF_config_file>_*
....
45 changes: 42 additions & 3 deletions docs/topics/mta-cli/ref_discover-generate-command-options.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,64 @@ You can use the following options together with the `discover` or `generate` com
|===
| Command | Option | Description

.2+a|`discover`
.5+a|`discover`
a|`--app-name`
a|An application to run the discovery for.

a|`-h`, `--help`
a|Display details for different command arguments.

a|`--list-apps`
a|List the available applications on the source platform, for example:

[subs="+quotes"]
----
$ *mta-cli discover cloud-foundry --use-live-connection --spaces=space,space-2 --cf-config=/home/gloria/ --list-apps*
INFO[0000] Cloud Foundry client created successfully
INFO[0000] Analyzing space space_name=space
INFO[0006] Apps discovered count=2
INFO[0006] Analyzing space space_name=space-2
INFO[0007] Apps discovered count=1
Space: space
- nginx
- test-app
Space: space-2
- test-app
----

a|`--list-platforms`
a|List the supported platforms for the discovery process.

a|`--log-level`
a|Set the log level, for example, `discover --log-level 1`. The default log level is `4`.

.3+a|`discover cloud-foundry`
.6+a|`discover cloud-foundry`
a|
a|Discover Cloud Foundry applications.

a|`--conceal-sensitive-data`
a|Extract sensitive information from a discovery manifest and put it into a separate file.

a|`--input`
a|Specify the location of the _<app-manifest-name>_.yaml file to discover the application configurations.
a|Specify the location of the YAML manifest file to discover the CF applications, for example:

* A path to the single application manifest.
* A path to the Cloud Foundry manifest.
* A path to the directory with multiple manifest files.

a|`--output`
a|Specify the location to save the _<discovery-manifest-name>_.yaml file.

a|`--spaces`
a|A comma-separated list of Cloud Foundry spaces to analyze during a live discovery, for example:

----
--spaces=space1,space2,…
----

a|`--use-live-connection`
a|Enable real-time discovery by using live platform connections.

a|`generate`
a|`-h`, `--help`
a|Display details for different command arguments.
Expand Down