Setting up a managed controller using CasC

3 minute readScalabilityAutomation

Controllers send requests for their configuration bundles through a secure HTTP(S) endpoint in operations center. Each controller is aware of the bundle it is connected to through the casc-bundle-link.yml file that contains the bundle URL and access token.

When using CloudBees CI on modern cloud platforms, you do not need to create the casc-bundle-link.yml and add the startup options for the managed controller; these steps are taken care of automatically.

You can assign a bundle to a managed controller before it has been provisioned. If you assign a bundle to a managed controller after it has been provisioned, you must restart the controller for the configuration to take effect. For more information, refer to Assigning a bundle to a controller.
Setting up a managed controller
Figure 1. Setting up a managed controller

Prerequisites

The following plugins must be installed to your controller:

Setting up a team controller using CasC

Configuration bundles can be assigned to team controllers. The association mechanism used for team controllers is the same mechanism used for managed controllers. However, you must assign a bundle to the team controller after it has been provisioned. For more information, see Assigning a bundle to a controller.

Plugins and plugin catalogs coming from creation recipes, which are unique to team controllers, are ignored when using a Configuration as Code bundle for a team controller. The Configuration as Code bundle takes precedence over the creation recipe values even though other parameters in recipes, such as provisioning configuration, are still applied.

Adding system properties when initializing a managed controller

When initializing a managed controller using CloudBees CI on modern cloud platforms, system properties can be added in the Provisioning options when the controller is being created. You can add the same recurrencePeriod property to the Java Options section in the UI. For example, to check for updates every 5 minutes add the Java Option highlighted in red in the screenshot below:

Adding recurrencePeriod property to Java options in UI
Figure 2. Adding recurrencePeriod property to Java options

Assigning a bundle to a controller

Once you have configured bundle availability, you can assign a bundle to the controller.

To assign a bundle to a controller:

  1. Ensure you are signed in to the operations center as a user with the Configure or Administer permission.

  2. From the operations center dashboard, select the down arrow to the right of your controller’s name, and then select Configure.

    Controller dropdown menu
    Figure 3. Controller dropdown menu
  3. Scroll down to Configuration as Code (CasC).

  4. Select the appropriate bundle to assign to the controller.

    If a Default bundle has already been selected from the Configuration as Code bundles screen, it is pre-selected in the Bundle dropdown.
  5. Select Save.

  6. If the controller has already been provisioned, you must restart the controller for the configuration change to take effect.

    CasC bundle validation is automatically performed when the instance is started and the bundle is assigned to the controller. If problems are detected, validation messages are displayed in the managed controller’s log file and on the managed controller’s Manage screen. For more information, refer to Troubleshooting CasC for controllers.

Regenerating a bundle token

You can regenerate a bundle’s access token using the casc-bundle-regenerate-token CLI command. Re-generating the access token is not usually required and should only be done in certain situations, such as for security purposes. Any controller currently using the token will lose access to it after it is regenerated. For more information, refer to Configuration as Code (CasC) CLI.

For managed controllers, if the token needs to be regenerated, the controller using the token needs to be restarted from operations center and the casc-bundle-link.yml file needs to be updated with the new token.

Adding the CasC bundle column to the operations center dashboard

Once you have set up your controller and assigned a bundle to it, you can add the CasC bundle column to the operations center dashboard to display the CasC bundle assigned to each controller.

To add the CasC bundle column to the operations center dashboard:

  1. From the operations center dashboard, select Edit View in the left pane.

  2. Scroll down to Columns.

  3. Select Add column.

  4. Select CasC bundle.

  5. Select OK.

    The CasC bundle column is now displayed in the operations center dashboard.

    CasC bundle column
    Figure 4. CasC bundle column
In August 2020, the Jenkins project voted to replace the term master with controller. We have taken a pragmatic approach to cleaning these up, ensuring the least amount of downstream impact as possible. CloudBees is committed to ensuring a culture and environment of inclusiveness and acceptance - this includes ensuring the changes are not just cosmetic ones, but pervasive. As this change happens, please note that the term master has been replaced through the latest versions of the CloudBees documentation with controller (as in managed controller, client controller, team controller) except when still used in the UI or in code.