Help Center/ ServiceStage/ User Guide/ Component Management/ Cloning Components in Batches
Updated on 2024-12-16 GMT+08:00

Cloning Components in Batches

This avoids complex and repeated configurations because multiple microservice components may have same configurations, for example, scheduling policy, AS policy, data storage, log storage, and lifecycle configurations, and only minor differences need to be modified. ServiceStage provides the function of cloning and deploying components in batches to improve component deployment efficiency and user experience.

Prerequisites

Only components in the Running, Not ready, or Abnormal states can be cloned. For details about how to check the component status, see Viewing Component Details.

Cloning Components in Batches

  1. Log in to ServiceStage.
  2. Choose Application Management.
  3. Click the application where the target components are located. The Overview page of the application is displayed.
  4. Select the components to be cloned in batches in Component List and click Bulk Clone.
  5. Set the version configuration information of the components to be cloned by referring to the following table.

    Parameter

    Description

    Component

    Name of a component, which cannot be changed after the component is cloned.

    Enter 2 to 64 characters. Start with a letter and end with a letter or digit. Only use letters, digits, underscores (_), and hyphens (-).

    For container-deployed components:
    • Components with the same name in different applications can be deployed in the same environment.
    • Components with the same name in the same application can be deployed in different CCE clusters in the same HA environment.
    • Components with the same name in the same application can be deployed in different environments.

    For VM-deployed components:

    • Components with the same name in different applications can be deployed in the same environment.
    • Components with the same name in the same application can be deployed in different environments.

    Component Version

    Version number of a component.

    • By default, the version number is the time when you start to clone components in batches. The format is yyyy.mmdd.hhmms, where s is the ones place of the second in the timestamp. For example, if the timestamp is 2022.0803.104321, the version number is 2022.0803.10431.
    • You can also customize the version number in the format of A.B.C, or A.B.C.D. A. B, C, and D are natural numbers, for example, 1.0.0 or 1.0.0.0.
    NOTE:

    You can perform the following operations to synchronize component versions in batches:

    1. Move the cursor to the Component Version text box of the specified component and click .
    2. Select other components whose versions need to be synchronized.
    3. Click OK.

    Application

    Select the application to which the component belongs. You can perform the following operations to synchronize the applications to which components belong in batches:

    1. Move the cursor to the Application drop-down list of the specified component and click .
    2. Select other components whose applications need to be synchronized.
    3. Click OK.

    Environment

    Select the component deployment environment.

    For container-deployed components, only the Kubernetes environment can be selected. For VM-deployed components, only the VM environment can be selected.

    NOTICE:

    If the component has been bound to a specified microservice engine, distributed cache, or cloud database instance but the specified instance is not bound to the environment selected for the component, an error is reported during advanced settings pre-check.

    You can perform the following operations to set the environment to which components belong in batches for components deployed in the same mode:

    1. Move the cursor to the Environment drop-down list of the specified component and click .
    2. Select other components whose environments need to be synchronized.
    3. Click OK.

      After the environment is reset, the cluster to which the container-deployed components belong is changed to the cluster bound to the new environment, and the namespace to which the component belongs is changed to the default namespace of the cluster bound to the new environment.

    Cluster

    Select a CCE cluster for deploying and running the container-deployed component.

    You can perform the following operations to synchronize the namespaces to which components belong in batches:

    1. Move the cursor to the Cluster drop-down list of the specified component and click .
    2. Select other components whose clusters need to be synchronized.
    3. Click OK.

      After the cluster is set, the cluster is changed only when the selected cluster is bound to the environment to which the component belongs. In addition, the namespace to which the component belongs is changed to the default namespace of the new cluster.

    Namespace

    Select the namespace of the CCE cluster in the build environment for the container-deployed component to isolate build data. For details, see Managing Namespaces.

    You can perform the following operations to synchronize the namespaces to which components belong in batches:

    1. Move the cursor to the Namespace drop-down list of the specified component and click .
    2. Select other components whose namespaces need to be synchronized.
    3. Click OK.

      After the namespace is set, the namespace is changed only when the selected namespace exists in the cluster to which the component belongs.

    Image Package

    Click , and select the component source again. For details, see Component Source.
    NOTICE:

    The technology stack and version of the reselected component source must be the same as those of the component to be cloned. Otherwise, the cloning will fail.

    • If you select an image package for a container-deployed component:
      • You can customize the container name. The name contains 1 to 63 characters, including lowercase letters, digits, and hyphens (-), and must start with a lowercase letter and end with a lowercase letter or digit.
      • Click in the upper right corner of the selected image package to change the image package source.
    • If you select a software package for a container-deployed component, you can customize the container name. The name contains 1 to 63 characters, including lowercase letters, digits, and hyphens (-), and must start with a lowercase letter and end with a lowercase letter or digit.
    • If the component source is software package and Custom file address is selected, perform the following operations:
      1. Enter the custom HTTP/HTTPS file download address of the software package.
      2. Determine whether to enable authentication.

        If authentication is disabled, any user can download the software package in the custom file address by default.

        Click to enable authentication. Only authenticated users can download the software package in the custom file address. Authentication mode can be User name and password authentication or User-defined Header Authentication. The authentication mode and the corresponding authentication parameters are determined by the authentication mode supported by the server where the custom file directory is located.

    • For container-deployed components, you can set Image Access Credential. You can select up to 16 image access credentials. Click Create Secret to create an image access credential. Secret Type must be kubernetes.io/dockerconfigjson. For details, see Creating a Secret.

    Instances

    Set the number of running instances of the component.

    • For container-deployed components, the value ranges from 1 to 200. You can perform the following operations to synchronize the number of component instances in batches:
      1. Move the cursor to the Instances text box of the specified component and click .
      2. Select other components whose number of component instances need to be synchronized.
      3. Click OK.
    • For VM-deployed components, you can perform the following operations to reset the number of component instances:
      1. Click Select.
      2. Reselect the number of ECSs for component deployment.

        The ECSs to be selected must have the VM agent installed and be running properly.

        If the status of the target ECS agent indicates that the agent is missing and to install it first, click Install. For details, see 6 to 8 in Installing a VM Agent.

      3. Click OK.

  6. Reset the component build parameters.

    This parameter is available when the component is deployed based on a container and the technology stack type is Java, Tomcat, Node.js, Python, or PHP.
    1. Locate the target component and click Build in the Operation column.
    2. Set the parameters by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

      Parameter

      Description

      *Command

      If the component source is Source code repository, set Command based on service requirements.

      • Default command or script: preferentially executes build.sh in the root directory. If build.sh does not exist, the code will be compiled using the common method of the selected language. Example: mvn clean package for Java.
      • Custom command: Commands are customized using the selected language. Alternatively, the default command or script is used after build.sh is modified.
        NOTICE:
        • If Custom command is selected, exercise caution when inputting sensitive information in the echo, cat, or debug command, or encrypt sensitive information to avoid information leakage.
        • To run the compilation command in the project subdirectory, you need to go to the project subdirectory and then run other script commands. Example:

          cd ./weather/

          mvn clean package

      *Dockerfile Address

      If the component source is Source code repository, set Dockerfile Address based on service requirements.

      Dockerfile Address is the directory where the Dockerfile is located relative to the root directory (./) of the project. The Dockerfile is used to build an image.

      If Dockerfile Address is not specified, the system searches for the Dockerfile in the root directory of the project by default. If the Dockerfile does not exist in the root directory, the system automatically generates the Dockerfile based on the selected operating environment.

      *Organization

      An organization is used to manage images generated during component build.

      *Build

      Select the type of the environment used to build an image. The build environment must be a Kubernetes environment, and can access the Internet.

      You are advised to select Use current environment. If the CCE cluster in the current environment cannot access the Internet and you have planned an independent build environment, you can select Use independent environment.

      • Use independent environment: Use an independent build environment to build an image. The CCE clusters in the independent build environment and in the current component deployment environment must have the same CPU architecture. Otherwise, the component deployment fails.
      • Use current environment: Use the deployment environment to which the component belongs to build an image. In the current environment, masters and nodes in the CCE cluster must have the same CPU architecture. Otherwise, the component build fails.

      *Environment

      • If Use independent environment is selected for Build, select an independent build environment different from that to which the component belongs.
      • If Use current environment is selected for Build, select the deployment environment to which the component belongs.

      *Select Cluster

      Select a cluster for build if Environment is set to HA Environment.

      For details about the HA environment, see Environment Overview.

      *Namespace

      Select the namespace of the CCE cluster in the environment where the build is executed, which is used to isolate build data. For details, see Managing Namespaces.

      Node Label

      In the following cases, set a node label to deliver the build job to the fixed node bound with an EIP to ensure that the component can be successfully built and deployed:

      • If Use independent environment is selected for Build, set a node label to deliver the build job to the node in the independent environment, to ensure that the node CPU architecture is the same as that of the node in the current component deployment environment.
      • If Use current environment is selected for Build and the CPU architecture of a node is different from that of the master node in the environment, set a node label to deliver the build job to the node that has the same CPU architecture as the master node.

      For details about how to add a label, see Managing Node Labels.

    3. Click OK.

  7. Locate the target component and click Advanced Settings in the Operation column.
  8. Select a component technology stack and version. For details, see Technology Stack.
  9. Set Headless Service Settings for container-deployed stateful components.

    It provides a fixed access domain name for every pod for mutual pod access in a StatefulSet.

    Parameter

    Description

    *Service Name

    Enter the name of the service that can be accessed by external services.

    A service is an abstract method that exposes a group of applications running on a pod as network services.

    NOTE:

    Service names of components deployed on the same CCE must be unique. Otherwise, component deployment will fail.

    *Port Settings

    Set the following port parameters:

    • Port Name: name of the port for communication between pods.
    • Container Port: port used by an application for listening in a container.
    • Access Port: port for accessing the service.

    To add port settings, click Add Setting.

  10. Set Public Network Access.

    • For container-deployed components, go to 11.
    • For VM-deployed components, go to 12.

  11. Click to enable public network access for container-deployed components.

    After public network access is enabled for a component, you can use a public network domain name to access the component through an ELB bound with an EIP to use services provided by the component.
    • After a component with public network access enabled is created and deployed, you can change the configured component access domain name by referring to Changing the Component Access Domain Name.
    • By default, public network access is disabled for a component. After a component is created and deployed, you can also configure the component access mode. For details, see Configuring the Component Access Mode.
    1. Set Public Network Load Balancer.
      • Select a load balancer that has been bound to an EIP in the selected environment.
      • If no load balancer exists, click Add One. On the Edit Environment page that is displayed, click Add Optional Resource to add created load balancers to the environment.
      • To create ELB resources, refer to the following table.

        Scenario

        Reference

        Use the domain name to access an application.

        ELB dark launch

        See Creating a Dedicated Load Balancer.

        • An EIP has been bound to the load balancer and must be in the same VPC and subnet as the compute resources managed in the current component deployment environment.
        • Components must be bound with different load balancers in different deployment environments to avoid route errors.
    2. Set Client Protocol.
      • HTTP has security risks. You are advised to select HTTPS.
      • If HTTPS is selected, click Use existing to select an existing certificate.

        If no certificate exists, click Create new to create a server certificate. For details, see Adding a Certificate.

    3. Set Domain Name.
      • If Automatically generated is selected, the automatically generated domain name is valid only for seven days.
      • If Bound is selected, enter a domain name.
    4. Set Listening Port.

      Enter the listening port number of the application process.

    Figure 1 Configuring public access

  12. Click to enable public network access for VM-deployed components.

    After public network access is enabled for a component, you can use a public network domain name to access the component through an ELB bound with an EIP to use services provided by the component.

    1. Set Public Network Load Balancer.
      • Select a load balancer that has been bound to an EIP in the selected environment.
      • If no load balancer exists, click Add One. On the Edit Environment page that is displayed, click Add Optional Resource to add created load balancers to the environment.
      • To create ELB resources:
        • An EIP has been bound to the load balancer and must be in the same VPC and subnet as the compute resources managed in the current component deployment environment.
        • Components must be bound with different load balancers in different deployment environments to avoid route errors.
    2. Set Client Protocol.
      • HTTP has security risks. You are advised to select HTTPS.
      • If HTTPS is selected, click Use existing to select an existing certificate.

        If no certificate exists, click Create new to create a server certificate. For details, see Adding a Certificate.

    3. Set Domain Name.
      • If Automatically generated is selected, the automatically generated domain name is valid only for seven days.
      • If Bound is selected, enter a domain name.

  13. Set other component configurations.

  14. Click OK.
  15. (Optional) Click Pre-check Advanced Settings to check whether the advanced settings of each component are correct.

    If the component has been bound to a specified microservice engine, distributed cache, or cloud database instance but the specified instance is not bound to the environment to which the component belongs, an error is reported during advanced settings pre-check. Perform the following operations to reconfigure the parameters and then continue:

    1. In the Pre-check Advanced Settings dialog box that is displayed, confirm the information and click OK.
    2. Click Advanced Settings in the Operation column of the abnormal component and set the parameter by referring to 13.

  16. Click Complete and Execute. The system automatically checks whether the advanced settings of each component are correct.

    • If no, reset the parameters based on the error information by referring to 13.
    • If yes, wait until the component statuses change from Initializing to Running, indicating that the components have been cloned. On the Deployment Records page, view the deployment logs.

      For container-deployed components, if "Querying the Status of a Workload Instance" is displayed, click View Event to view details.