Creating and managing application assemblers

You can create and use application assembler resources for use in assembling resources to create hybrid applications.

The application assembly process provides you with the ability to discover application components and group them together automatically as an application to manage. For more information about the application discovery and assembly process, see Application discovery and assembly

Create an application assembler

If you plan to use the console to assemble an application, you do not need to manually create an assembler reasource. The console creates this resource automatically. For more information, see Assemble an application with the console

The application assembler resource shares the same name as the application resource to be assembled. Both resources reside in the same namespace. Due to this grouping, an application can have only 1 associated application assembler.

  1. Compose the definition YAML content for your application assembler. For more information about the YAML structure, including the required fields, see application assembler definition.

  2. Create the application assembler resource within IBM Cloud Pak for Multicloud Management.

    To create a application assembler, you can use the Kubernetes CLI (kubectl) tool, or REST API:

    • To use the Kubernetes CLI tool:

      1. Run the following command to apply your file to an apiserver. Replace filename with the name of your file:

        kubectl apply -f filename.yaml
        
      2. Verify that your application assembler is created, by running the following command:

        kubectl get ApplicationAssembler
        

        Ensure that your new application assembler is listed in the resulting output.

    • To use REST API, you need to use the application assembler POST API.

Updating an application assembler

To update a application assembler, you can use the Kubernetes command line interface (kubectl) tool, or REST API.

Deleting a application assembler

To delete a application assembler, you can use the Kubernetes command line interface (kubectl) tool, or REST API.

Application assembler definition YAML structure

apiVersion: tools.hybridapp.io/v1alpha1
kind: ApplicationAssembler
metadata:
  name:
  namespace:
spec:
  hubComponents:
  - apiVersion:
    kind:
    name:
    namespace:
  managedClustersComponents:
  - cluster:
    components:
    - apiVersion:
      kind:
      name:
      namespace:
Attribute Required Description
apiVersion Y Set the value to tools.hybridapp.io/v1alpha1.
kind Y Set the value to ApplicationAssembler to indicate that the resource is a application assembler.
metadata.name Y The name for identifying the assembler.
metadata.namespace Y The namespace resource to use for the assembler. This needs to be the same namespace that includes the application resources.
spec.hubComponents N The details for the type of resources to discover on the hub cluster for assembling the application. If you do not have resources on the hub cluster, leave the section empty.
spec.managedClusterComponents N The details for the type of resources to discover on a managed cluster for assembling the application. If you do not have resources on a managed cluster, leave the section empty.
spec.managedClusterComponents.cluster N THe name of the managed cluster where the application components are placed and run.

For identifying the components, you might have applications that include resources from both the hub cluster or a managed cluster, or both. If you you have to discover components from the hub cluster, but not a managed cluster, your definition can include the following spec structure:

spec:
  hubComponents:
  - apiVersion: infra.management.ibm.com/v1alpha1
    kind: VirtualMachine
    name: cfvmid-92
    namespace: default
  managedClustersComponents: []

If you have components to discover on a managed cluster, but not the hub cluster, your definition can include the following spec structure:

spec:
  hubComponents: []
  managedClustersComponents:
  - cluster: minikube
    components:
    - apiVersion: app.k8s.io/v1beta1
      kind: Application
      name: gbapp
      namespace: default

Example application assembler

The following YAML shows an example application assembler that assembles application components from both hub cluster and managed clusters:

apiVersion: tools.hybridapp.io/v1alpha1
kind: ApplicationAssembler
metadata:
  name: demoapp
  namespace: default
spec:
  hubComponents:
  - apiVersion: infra.management.ibm.com/v1alpha1
    kind: VirtualMachine
    name: cfvmid-83
    namespace: default
  managedClustersComponents:
  - cluster: minikube
    components:
    - apiVersion: v1
      kind: Service
      name: redis-slave
      namespace: default
    - apiVersion: v1
      kind: Service
      name: frontend
      namespace: default
    - apiVersion: apps/v1
      kind: Deployment
      name: frontend
      namespace: default
    - apiVersion: apps/v1
      kind: Deployment
      name: redis-slave
      namespace: default