This example shows how to use the app-features parameter in an MTA to enable or disable different Cloud Foundry features for your applications. The app-features parameter allows fine-grained control over CF app capabilities during deployment. This feature also helps solve the 130KB environment variable limit issue described in garden-runc-release#160 by providing an alternative way to configure app features without using environment variables.
For more information about the app-features parameter and other module-specific parameters, see:
SAP BTP Documentation - Module-Specific Parameters
The app-features parameter accepts an array of feature flags that can be used to:
- Enable or disable specific Cloud Foundry application features
- Control runtime behavior of applications
- Customize deployment characteristics per environment
The following features can be controlled via the app-features parameter:
-
ssh: Enable/disable SSH access to the application container -
file-based-vcap-services: Use file-based service bindings instead of environment variables
More features may be added in the future as Cloud Foundry evolves, please refer to the following link for the latest updates.
The example demonstrates how to configure different app features using the app-features parameter.
This approach uses deployment descriptor mtad.yaml and ready application binaries appBits.zip:
$ cf deploy ./ -f ;This approach uses development descriptor mta.yaml and application binaries appBits.zip to build an MTAR archive:
$ mbt build -p cf -t . ;The built MTAR is then deployed:
$ cf deploy cf.app.features_0.0.0.mtar -f ;$ cf mta cf.app.features ;
Showing health and status for multi-target app cf.app.features in org **** / space **** as ****...
OK
Version: 0.0.0
Namespace:
Apps:
name requested state instances memory disk urls
my-featured-app-module STARTED 1/1 19.6M 5.3M orgname-spacename-my-featured-app-module.example.com
Services:
name service plan bound apps last operation
xsuaa-service xsuaa application my-featured-app-module create succeededCheck that the app was deployed with the specified features:
$ cf curl v3/apps/$(cf app my-featured-app-module --guid)/features
{
"resources": [
{
"name": "ssh",
"description": "Enable SSHing into the app.",
"enabled": true
},
{
"name": "revisions",
"description": "Enable versioning of an application",
"enabled": true
},
{
"name": "service-binding-k8s",
"description": "Enable k8s service bindings for the app",
"enabled": false
},
{
"name": "file-based-vcap-services",
"description": "Enable file-based VCAP service bindings for the app",
"enabled": true
}
],
"pagination": {
"total_results": 4,
"total_pages": 1,
"first": {
"href": "/v3/apps/e41aef45-76e1-4c2a-b375-f17b7ae47566/features"
},
"last": {
"href": "/v3/apps/e41aef45-76e1-4c2a-b375-f17b7ae47566/features"
},
"next": null,
"previous": null
}
}If SSH feature is enabled in the app-features:
$ cf ssh my-featured-app ;If File based VCAP services is enabled, then service bindings will be set in file with specified path in VCAP_SERVICES_FILE_PATH environment variable:
$ cf env my-featured-app-module
Getting env variables for app my-featured-app-module in org **** / space **** as ****...
System-Provided:
VCAP_SERVICES_FILE_PATH: "/etc/cf-service-bindings/vcap_services"
...Enable SSH for debugging:
app-features:
ssh: trueEnable file based VCAP services to mitigate env limit of 130kB:
app-features:
file-based-vcap-services: true