Este contenido no está disponible en el idioma seleccionado.
Chapter 8. Generating platform assets for application deployment
Starting from MTA 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 OpenShift Container Platform:
-
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
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.
Generating platform assets for application deployment is a Developer Preview feature only. Developer Preview features are not supported by Red Hat in any way and are not functionally complete or production-ready. Do not use Developer Preview features for production or business-critical workloads. Developer Preview features provide early access to upcoming product features in advance of their possible inclusion in a Red Hat product offering, enabling customers to test functionality and provide feedback during the development process. These features might not have any documentation, are subject to change or removal at any time, and testing is limited. Red Hat might provide ways to submit feedback on Developer Preview features without an associated SLA.
Benefits of generating deployment assets
Generating deployment assets has the following benefits:
- Generating the Kubernetes and non-Kubernetes deployment manifests.
- Generating deployment manifests by using familiar template engines, for example, Helm, that are widely used for Kubernetes deployments.
- Adhering to Kubernetes best practices when preparing the deployment manifest by using Helm templates.
8.1. Generating a discovery manifest Copiar enlaceEnlace copiado en el portapapeles!
You can generate the discovery manifest for the Cloud Foundry (CF) application by using the discover
command. The discovery manifest preserves configurations, such as application properties, resource allocations, environment variables, and service bindings found in the CF manifest.
Prerequisites
- You have Cloud Foundry (v3) as a source platform.
- You have OpenShift Container Platform as a target platform.
- You installed MTA CLI version 7.3.0.
- You have a CF application manifest as a YAML file.
Procedure
-
Open the terminal application and navigate to the
<MTA_HOME>/
directory. List the supported platforms for the discovery process:
mta-cli discover --list-platforms
$ mta-cli discover --list-platforms
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the discovery manifest for a CF application as an output file:
mta-cli discover cloud-foundry \ --input <path_to_application-manifest> \ --output <path_to_discovery-manifest>\
$ mta-cli discover cloud-foundry \ --input <path_to_application-manifest> \ --output <path_to_discovery-manifest>\
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2. Generating a deployment manifest Copiar enlaceEnlace copiado en el portapapeles!
You can auto-generate the Red Hat OpenShift Container Platform deployment manifest for the Cloud Foundry (CF) application by using the generate
command. Based on the Helm template that you provide, the command generates manifests, such as a ConfigMap, and non-Kubernetes manifests, such as a Dockerfile, for application deployment.
Prerequisites
- You have Cloud Foundry (v3) as a source platform.
- You have OpenShift Container Platform as a target platform.
- You installed MTA CLI version 7.3.0.
- You generated a discovery manifest.
- You created a Helm template with the required configuration for the OCP deployment.
Procedure
-
Open the terminal application and navigate to the
<MTA_HOME>/
directory. Generate the deployment manifest as an output file:
mta-cli generate helm --chart-dir helm_sample \ --input <path_to_discovery-manifest> \ --output-dir <location_of_deployment_manifest> \
$ mta-cli generate helm --chart-dir helm_sample \ --input <path_to_discovery-manifest> \ --output-dir <location_of_deployment_manifest> \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the ConfigMap:
mta-cli cd <location_of_deployment_manifest> \ $ cat configmap.yaml cat configmap.yaml cat Dockerfile
$ mta-cli cd <location_of_deployment_manifest> \ $ cat configmap.yaml $ cat Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the Dockerfile:
mta-cli cd <location_of_deployment_manifest> \ $ cat Dockerfile cat Dockerfile
$ mta-cli cd <location_of_deployment_manifest> \ $ cat Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.3. The discover and generate command options Copiar enlaceEnlace copiado en el portapapeles!
You can use the following options together with the discover
or generate
command to adjust the command behavior to your needs.
Command | Option | Description |
---|---|---|
|
| Display details for different command arguments. |
| List the supported platforms for the discovery process. | |
| Discover Cloud Foundry applications. | |
| Specify the location of the <app-manifest-name>.yaml file to discover the application configurations. | |
| Specify the location to save the <discovery-manifest-name>.yaml file. | |
|
| Display details for different command arguments. |
| Generate a deployment manifest by using the Helm template. | |
| Specify a directory that contains the Helm chart. | |
| Specify a location of the <discovery-manifest-name>.yaml file to generate the deployment manifest. | |
| Generate only non-Kubernetes templates, such as a Dockerfile. | |
| Specify a location to which the deployment manifests are saved. | |
| Override values of attributes in the discovery manifest with the key-value pair entered from the CLI. |
8.4. Assets generation example Copiar enlaceEnlace copiado en el portapapeles!
The following is an example of generating discovery and deployment manifests of a Cloud Foundry (CF) Node.js application.
For this example, the following files and directories are used:
-
CF Node.js application manifest name:
cf-nodejs-app.yaml
-
Discovery manifest name:
discover.yaml
-
Location of the application Helm chart:
helm_sample
- Deployment manifests: a ConfigMap and a Dockerfile
-
Output location of the deployment manifests:
newDir
Assumed that the cf-nodejs-app.yaml
is located in the same directory as the MTA CLI binary. If the CF application manifest location is different, you can also enter the location path to the manifest as the input
.
Prerequisites
- You installed MTA CLI 7.3.0.
- You have a CF application manifest as a YAML file.
- You created a Helm template with the required configurations for the OCP deployment.
Procedure
-
Open the terminal application and navigate to the
<MTA_HOME>/
directory. Verify the content of the CF Node.js application manifest:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the discovery manifest:
mta-cli discover cloud-foundry \ --input cf-nodejs-app.yaml \ --output discover.yaml \
$ mta-cli discover cloud-foundry \ --input cf-nodejs-app.yaml \ --output discover.yaml \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the content of the discover manifest:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the deployment manifest in the
newDir
directory by using thediscover.yaml
file:mta-cli generate helm \ --chart-dir helm_sample \ --input discover.yaml --output-dir newDir
$ mta-cli generate helm \ --chart-dir helm_sample \ --input discover.yaml --output-dir newDir
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the contents of the Dockerfile in the
newDir
directory:cat ./newDir/Dockerfile FROM busybox:latest RUN echo "Hello cf-nodejs!"
$ cat ./newDir/Dockerfile FROM busybox:latest RUN echo "Hello cf-nodejs!"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the contents of the ConfigMap in the
newDir
directory:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the ConfigMap, override the
name
tonodejs-app
andINSTANCES
to2
:mta-cli generate helm \ --chart-dir helm_sample \ --input discover.yaml --set name="nodejs-app" \ --set instances=2 \ --output-dir newDir \
$ mta-cli generate helm \ --chart-dir helm_sample \ --input discover.yaml --set name="nodejs-app" \ --set instances=2 \ --output-dir newDir \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the contents of the ConfigMap again:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow